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:
As far as I know, Get-Service doesn't accept a credential parameter. However, you can do it through WMI:
$cred = get-Credential -credential
Get-WMIObject Win32_Service -computer $computer -credential $cred
Update after comment:
You can save credentials as a securestring into a file, and then reload it for manually creating a credential without having a prompt. See information here.