foreach($server in Get-ExchangeServer){ write-host `n$server -foregroundcolor white -backgroundcolor black try{ if($services = Get-Service msexc* -ComputerName $server){ if($server.IsExchange2007OrLater -eq $false){ $services += Get-Service RESvc -ComputerName $server $services += Get-Service IMAP4Svc -ComputerName $server $services += Get-Service POP3Svc -ComputerName $server } foreach($service in $services){ if($service.status -ne "Running"){ ## Not sure why get-wmiobject will take a variable but not an obj property -- This is a workaround, for now $wtf = $service.name $isSvcAuto = (gwmi -computer $server.name Win32_Service -Filter "Name='$wtf'") if($isSvcAuto.StartMode -eq "Auto"){ ## You can remove the above 'if' statement to start all Exchange services -- Regardless of startup type (i.e. Manual, Auto) ## Additional service information you could include: Name, DisplayName, Status, DependentServices, ServicesDependedOn, CanPauseAndContinue, CanShutdown, CanStop, ServiceType write-host Attempting To Start: $service.name -foregroundcolor black -backgroundcolor red $isSvcAuto.InvokeMethod("StartService",$null) | out-null ## This only fires off the command to start the service, implement option to wait for the execution to pass/fail if($? -eq $true){ write-host ` - Successfully Started: $service.name -foregroundcolor green -backgroundcolor black }else{ write-host ` - Failed To Start: $service.name -foregroundcolor red -backgroundcolor black } } }else{ write-host $service.name is running } # Remove the 'else{}' above to not display Exchange services already running }}} catch{ write-host ` - Failed To Retrieve Services -foregroundcolor red -backgroundcolor black } } write-host `n