Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Get-Mailbox -Database and Format-Table questions

$
0
0
Hi,

I've written a script that will get the number of mailboxes on each database on our exchange server and then create a report and email it to everyone. This is the first script that I've ever wrote so I'm fumbling around and don't really know what I'm doing. I want to learn though so any advice is welcome. It is working but it still doesn't look as nice as I'd like for it to and I was hoping someone could look at my code and tell me what I could do to make it better. Here is part of it and then below shows the output text file as it is formatted. I'd like for it to be all one one table instead of each being a separate one but I don't know how to do that. I was reading that you can use $obj but when I was reading it I was completely lost about what was going on. Thanks.  

________________
Get-Mailbox -Database DB0 | Group-Object -Property:Database | select name,count | Format-Table -Autosize > M:\Scripts\DBcountreport.txt
Get-Mailbox -Database DB1 | Group-Object -Property:Database | select name,count | Format-Table -Autosize -HideTableHeaders >> M:\Scripts\DBcountreport.txt
Get-Mailbox -Database DB2 | Group-Object -Property:Database | select name,count | Format-Table -Autosize -HideTableHeaders >> M:\Scripts\DBcountreport.txt
./DBcountreport.txt
________________

Name Count
----      -----
DB0    167
                \
                   ---  I want these spaces removed basically           
                / 
DB1    167



DB2    174



DB3    169

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>