See if this is what you're looking for:
2853-start-remoteprocess-ps1-start-process-on-remote-computer-with-credentials
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Goodday,
I have a powershell script to create a folder on a remote computer with WMI. But i need to run this with alternate credentials. Normally we would just ad -credential $cred to the command but i don't know where to put it in this case.
$computer = "COMPUTERNAME" //add the computername where the folder needs to bee created
$pathname = "PATHNAME''//Add the path and foldername to be added
$p = [WMIClass]"\$computer\root\cimv2:Win32_Process" //Start local proces with help of WMI
$p.Create("cmd.exe /c md $pathname") // run CMD to execute the action
See if this is what you're looking for:
2853-start-remoteprocess-ps1-start-process-on-remote-computer-with-credentials