Exchange powershell help


ive got command runs fine.

(get-mailbox -resultsize unlimited) | select-object name,@{n="primary size(mb)";e={(get-mailboxstatistics $_).totalitemsize.value.tomb()}},@{n="archive size(mb)";e={(get-mailboxstatistics -archive $_).totalitemsize.value.tomb()}} |export-csv  c:\mailboxsize.csv

i want add primary , archive databases in new columns. hadded following end archive database dosent work. command hangs

,@{n="archive database";e=(get-mailboxstatistics -archive databasename)

so in

(get-mailbox -resultsize unlimited) | select-object name,@{n="primary size(mb)";e={(get-mailboxstatistics $_).totalitemsize.value.tomb()}},@{n="archive size(mb)";e={(get-mailboxstatistics -archive $_).totalitemsize.value.tomb()}},@{n="archive  database";e=(get-mailboxstatistics -archive databasename) |export-csv c:\mailboxsize.csv

any ideas how database name added?


wednesday, april 08, 2015 2:08 pm

actually 1 wrong because subtly changed doing.

$mailboxes=get-mailbox -resultsize unlimited  $mailboxes|     foreach-object{         $arch=get-mailboxstatistics -archive $_         $stats=get-mailboxstatistics $_         new-object psobject -property @{             name=$_.name             databasename=$stats.databasename             'primary size(mb)'=$stats.totalitemsize.value.tomb()             'archive database'=$arch.databasename             'archive size(mb)'=$arch.totalitemsize.value.tomb()         }     } |     export-csv c:\mailboxsize.csv 


\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Generating Event ID 91, 44 with CA (In Event Viewer with source as Certsvc)

Group policy default policy cannot be edited because network name not found

Problem when changing update source