How to get the service status for a remote computer that needs a user name and password to log in?
I am trying to find a solution using the following code:
This also works:
net use \\server\c$ $password /USER:$username $service = Get-Service $serviceName -ComputerName $server
Note that password should not be in a secure string.