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

Test Exchange Services on all servers one cmd

$
0
0

Guys is there any way i can run the below in one cmd as i tried but getting a below error  i am try to check the exchange services from one cmd let instead of simple script

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

$ExchServer=Get-ExchangeServer
foreach ($Server in $ExchServer)
{
echo $Server.name (Test-ServiceHealth $Server)
}

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

Error***********

[PS] C:\Windows\system32>$ExchServer=Get-ExchangeServer | foreach ($Server in $ExchServer) {echo $Server.name (Test-ServiceHealth $Server)}
Unexpected token 'in' in expression or statement.
At line:1 char:53
+ $ExchServer=Get-ExchangeServer | foreach ($Server in <<<<  $ExchServer) {echo $Server.name (Test-ServiceHealth $Serve
r)}
    + CategoryInfo          : ParserError: (in:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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