I want to test whether or not winrm is running on a list of servers.
winrm id -r:servername works for individual systems but I want to test recursively for a list from a csv or text file.
With output to a file saying "working" or "not working" for each.
How do I do this?
Thanks all.
Edit:
Gotten to a point where I am passing a list of vm's and piping along until I get successful winrm connections output to a file and failures shown in the console.
get-vm |where {$.powerstate -like "PoweredOn"}|get-vmguest |where {$.guestfamily -like "windowsGuest"}|foreach {winrm id -r:$_.hostname} |Out-File c:\scripts\winrmtest.txt
In my out-file I am getting output like IdentifyResponse ProtocolVersion = http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd ProductVendor = Microsoft Corporation ProductVersion = OS: 6.1.7601 SP: 1.0 Stack: 2.0
for successful connections and on the console I get the following for failures:
Error number: -2144108526 0x80338012 The client cannot connect to the destination specified in the request. Verify that the service on the destination is run ning and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destinat ion, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination t o analyze and configure the WinRM service: "winrm quickconfig". WSManFault Message = The client cannot connect to the destination specified in the request. Verify that the service on the dest ination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running o n the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: "winrm quickconfig".
Need to get all the output into the file, along with the name of the guest vm the response is for.