I'm trying to create script to run between two workgroup servers. I've tried to pass credentials through the administrator account (each admin account on different machines has a unique password). The script needs to execute from one server and stop the W3Svc, then restart the service on the other server. How do I do this? I am a PowerShell Moron...
I've created an advanced function for this, please try it on test system first. For querying non-domain machine pass the credential like this: Stop-RemoteService -ServiceName wuauserv -ComputerName server1 -Credential localhost\Administrator -Verbose
function Stop-RemoteService { [cmdletbinding()] Param( [parameter(Mandatory=$true,ValueFromPipeLine=$true,ValueFromPipeLineByPropertyName=$true)] [string[]]$ComputerName,
I work with Cindy and asked her to post this while I was waiting on my authorization email... Copied your code into the ISE and executed -- worked great, thanks!