header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Exchange 2003 Store Count
Last Post 06 Aug 2011 06:49 AM by Rob. 3 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
RobUser is Offline
New Member
New Member
Posts:32
Avatar

--
05 Jan 2011 06:20 AM
    Hi

    Hope someone can help with this, i'm working on a small script that will count the number of mailboxes on each server and total them up. Below is what i have so far but the problem i have is that if i add more then one server to the script it totals all the servers together and then out puts the results.

    Script so far.

    $ComputerName = "server03" 
    foreach ($Store in $ComputerName){
    $Total = (Get-WmiObject Exchange_Mailbox -NameSpace Root\MicrosoftExchangeV2 -ComputerName $ComputerName | Select-Object StoreName).count
    Write-Host $Store ":" $Total "users"
    }

    Ouput is

    server03 : 2354 users (correct)

    Output when another server is added. ($ComputerName = "server03", "server04")

    server03 : 5115 users
    server04 : 5115 users

    How can i change this to output the correct results with out it adding up all the mailboxes from each server together.

    Regards
     
    Rob

    Regards


    0ptikGhostUser is Offline
    Basic Member
    Basic Member
    Posts:367
    Avatar

    --
    05 Jan 2011 10:01 AM

    Try

    $ComputerName = "server03", "server04" foreach ($Store in $ComputerName){ $Total = (Get-WmiObject Exchange_Mailbox -NameSpace Root\MicrosoftExchangeV2 -ComputerName $Store | Select-Object StoreName).count Write-Host $Store ":" $Total "users" }
    RobUser is Offline
    New Member
    New Member
    Posts:32
    Avatar

    --
    05 Jan 2011 11:22 PM
    Great that fixed it, Thanks for the help.
    RobUser is Offline
    New Member
    New Member
    Posts:32
    Avatar

    --
    06 Aug 2011 06:49 AM
    Need to get some more help again with this one.

    I'm trying to get the output as a html file. I use the below in other scripts but i can't work out a way to incorporate it in to this script
    any help would be great.

    $a = "<style>"<br>$a = $a + "BODY{background-color:White;}"<br>$a = $a + "TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;margin-left: auto;margin-right: auto;text-align: center}"<br>$a = $a + "TH{border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color:LightSkyBlue}"<br>$a = $a + "TD{border-width: 1px;padding: 3px;border-style: solid;border-color: black;background-color:AliceBlue}"<br>$a = $a + "</style>"<br><br>.......<br><br>| ConvertTo-HTML -head $a | Out-File C:\***.htm
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer