Exchange management shell problem
My PS one line looks like below: C:\>Get-StorageGroup -server excserver01 -OutVariable SG | Where-Object {$_.CircularLoggingEnabled -eq "True"} | Get-MailboxDatabase | Where-Object {$_.StorageGroupName -eq $SG.name } Idea is that I like to dismount all databases which have circular logging enabled. I have used Get-MailboxDatabase cmdlet to see which databases this cmdlet returns. But the list is empty. When I can see correct databases I can change Get-MailboxDatabase to Dismount... -- Petri
August 20th, 2009 1:57pm

-OutVariable parameter at first command will enumerate all SGs in that server. Try this... $CLEnabledSG = Get-Storagegroup -server ExcServer01 | Where-object {$_.CircularLoggingEnabled -eq "true} you can see the output of this command in this Variable $CLEnableSG. $CLEnableSG | Foreach {Get-mailboxdatabase -storagegroup $_.identity | Dismount-database -confirm:$false} Let us know how it goes. Thanks. Vishal Ramnani | MCITP - Exchange 2007 | MCSE Messaging | MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2009 2:29pm

That does the work, but as for shell practice I would like to see this on one line, without extra variables. -- Petri
August 20th, 2009 3:08pm

well then try this... Get-Storagegroup -server ExcServer01 | Where-object {$_.CircularLoggingEnabled -eq "true} | Foreach-object {Get-mailboxdatabase -storagegroup $_.identity | Dismount-database -confirm:$false} Just removed the variable. Thanks.Vishal Ramnani | MCITP - Exchange 2007 | MCSE Messaging | MCTS - Win 2008 Config
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2009 3:26pm

Greaaaat !!!!! Big thanks to you ! I have feeling that "Foreach-object" might be needed in future as well :D -- Petri
August 20th, 2009 3:47pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics