Formating output from get-mailboxdatabase query

rated by 0 users
This post has 1 Reply | 1 Follower

Top 500 Contributor
Posts 9
Steve4586 Posted: 02-17-2012 5:29 AM

I have a requirement to create a text file containing Exchange Database information in the following format:

Indentity:size Indentity:size

so this would look like

DBase01: 1234 Dbase02: 4321

I have a script the outputs the data in the format

DBase01: 1234

Dbase02: 4321

I am a little stuck on how to do this: script is below, any help would be appreciated.  For info, this is to create data that Cacti will accept to graph the data:

------------------------------------------------------------------------------------------------------------------

# Get all the Mailbox servers
$colon = ":"
ForEach ($server in Get-MailboxServer)

   # For each Mailbox server, get all the databases on it
   $strDB = Get-MailboxDatabase -Server $server 
   
   # For each Database, get the information from it
   ForEach ($objItem in $strDB) 
   { 
      $intUsers = ($objitem | Get-Mailbox -ResultSize Unlimited).count
 
      $strDBsize = Get-ChildItem $path 
      $ReturnedObj = New-Object PSObject 
      $ReturnedObj | Add-Member NoteProperty -Name "Database" -Value $objItem.name
      $ReturnedObj | Add-Member NoteProperty -Name "User Count" -Value $intUsers 
   
      $data = ($ReturnedObj.database +  $colon + $ReturnedObj.'User Count')
      Write-Output $output | FT -HideTableHeaders -AutoSize
   }
}

 

Thanks

 

 

Top 500 Contributor
Posts 9

Resolved.

 

Changed "Write-Output $output | FT -HideTableHeaders -AutoSize" to "Write-host $output -nonewline"

Page 1 of 1 (2 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.