I've used the PowerGUI script editor as my editor of choice ever since I started using Powershell, but I never really got the PowerGUI thing.
Recently at the UK Powershell User Group we had the brilliant opportunity to visit Quest in the UK and be presented to by Dmitry Sotnikov about PowerGUI and the AD cmdlets. Before going I figured I'd better get to grips with PowerGUI so spent some time watching the online tutorial videos and started playing around with it.
Doing this combined with what I picked up from the Quest visit it started to dawn on me how useful this could be. It had frustrated me for a while that although there is great support for Powershell in Exchange 2007 there wasn't anything native for Exchange 2003, which is what we use in our environment.; so I thought why not try and make a PowerGUI powerpack for it.
There's a fair bit on the web about using WMI to manage Exchange 2003, in particular a very helpful article from Dmitry.
So with a little bit of playing I have posted version 0.1 to the PowerGUI powerpack library. With a bit of work I think it could be improved a lot (I have no actions or links yet, just script nodes), but I'd be interested in any feedback so leave me a comment if you've used it. I know there's a lot of uptake with Exchange 2007 now, but I'm sure there's plenty of 2003 sites still out there.
Even while putting the powerpack together I discovered things I could manage with Powershell so easily which would be really tricky to do through the Exchange Management GUI - my favourite is Get-DisconnectedMailboxes.
Quite often I need to find mailboxes which have had the AD account deleted and are waiting to expire from Exchange - not easy to do when the AD record has gone so you don't know which database they were on (we have over Exchange 40 databases). With the below Powershell WMI script it is dead easy to get a list of all disconnected mailboxes and which database they are in by using the DataDiscoveredAbsentInDS property:
Get-Wmiobject -namespace root\MicrosoftExchangeV2 -class Exchange_Mailbox -computer $computer | where { $_.DateDiscoveredAbsentInDS -like '2*' } | sort-object MailboxDisplayName | select-object MailboxDisplayName,Servername,StorageGroupName,StoreName,Size,DateDiscoveredAbsentInDS}
PowerGUI then displays the results in a really nice view!
I think I'll be using PowerGUI a lot from now on...........
hi,
ReplyDeleteI´m using your exchange powerpack, i´ts great. Dew to lack of space I need do Monitor EBD size, I put together the following code from many script I found in the Net, cam you help me, I need to now if this is the best way, also need to fix the out put file do CSV
#region ****************************** Execution started - TreeNode: Get-exchangeDBsize ******************************
function func_Get-exchDBsize()
{
$root = New-Object System.DirectoryServices.DirectoryEntry("LDAP://RootDSE")
$cfgNC = [adsi]("LDAP://" + $root.Get("configurationNamingContext"))
$search = New-Object System.DirectoryServices.DirectorySearcher($cfgNC)
$search.filter = '(objectclass=msExchExchangeServer)'
$ExchServer = $search.FindAll()
foreach ($server in $ExchServer)
{
$ExchangeServers = $ExchangeServers + $ExchServer | foreach {$_.properties.name}
}
foreach ($computer in $ExchangeServers) {
Get-WmiObject -query "select * from cim_datafile where extension ='edb' or extension ='stm'" -computername $Computer
}
}
func_Get-exchDBsize | ft -property __SERVER, name, @{label="Size (MB)";expression={[math]::truncate($_.filesize/1MB)}} -autosize # | Export-Csv c\exchDB.csv
#endregion ****************************** Execution completed - TreeNode: Get-exchangeDBsize ******************************