PowerShell script to check WDS Service status against of List of servers.

Below is a PowerShell script, this will list WDS Service status against of List of servers.

Below is a powershell script will list WDS Service status againest of List of servers.

$InPutComputersList = get-content “c:MyScriptslist.txt”
$OutPutFile = “c:MyScriptsWDS_ServiceStatus.csv”
$NotReachble = “c:MyScriptsNonPingSystems.csv”
$listResult = @()
foreach($ForEverComputerIntheTextFilelinebyLine in $InPutComputersList) {
if (test-path $ForEverComputerIntheTextFilelinebyLinec$windowswrite.exe)
{
$objService = Get-Service WDSServer -ComputerName $ForEverComputerIntheTextFilelinebyLine | select machinename, status, name, displayname

$objResult = New-Object PSObject -Property @{
ComputerName = $ForEverComputerIntheTextFilelinebyLine
ServiceStatus = $objService.Status
ServiceDisplayName = $objService.DisplayName
ServiceName = $objService.Name

}
$listResult += $objResult
}
Else
{
Write-Output “$ForEverComputerIntheTextFilelinebyLine,NotReachable” | out-file $NotReachble -append
}
}
$listResult| Export-Csv -Path $OutPutFile

Leave a Comment