Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Unable to run the PS query.

$
0
0
How to check if I have a list of SQL Servers in a .TXT file and in the list, what are the SQL Servers are not accessible/stopped/not working?$MachineList = get-content "C:\PS\list_server.txt";$MachineList.Countforeach ($Machine in $MachineList){#Run ping test$MachineName = $Machine$result = Get-WMIObject -query “select StatusCode from Win32_PingStatus where Address = ‘$MachineName’” }The above query is throwing error....

Viewing all articles
Browse latest Browse all 467

Trending Articles