psexec
1 TopicReplace psexec with native powershell commands
Hello, we have a remotely located ($remoteserver1) script that we want to run on the said remote computer ($remoteserver1) from a "controler" server (via a scheduled task). As of today in a CMD file (located in our controler server) we have something like this : %dir_command%\psexec.exe "\\servername" -accepteula powershell "C:\_Scripts\Pools_Scripts\myscript.ps1" "param1" "param2" "param3" "param4" For the moment I want to replace this cmd by a ps script as a first step. I have tried to use the call operator &, invoke-expression, invoke-command etc but nothing works. What would be the correct method for executing a remote script on a remote computer (knowing that the script is local to the remote server) ? As a secondary step I will probable try to run a "locally" (centralized smb share) stored script to the remote computer. But I can't go straight to this step. However if you already have recommandations for doing this I would be interested. thank you for your help.5.7KViews0likes10Comments