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:\MyScripts\list.txt"
$OutPutFile = "c:\MyScripts\WDS_ServiceStatus.csv"
$NotReachble = "c:\MyScripts\NonPingSystems.csv"
$listResult = @()
foreach($ForEverComputerIntheTextFilelinebyLine in $InPutComputersList) {
if (test-path \$ForEverComputerIntheTextFilelinebyLine\c$\windows\write.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

2 comments:

Unknown said...

Thank you. There's definitely a great deal to learn about this subject. I really like all the points you have made.! Thanks for provide the best information.
Custom Writing Service

واجهات حجر هاشمي شركة الهواري said...

سعر متر حجر هاشمي هيصم
سعر متر حجر هاشمى هيصم

Post a Comment