asked on
Process and correct syntax for using psexec to run PowerShell script on remote servers
I have a PowerShell script named PSInstallAgent.ps1 that I need to run on several remote servers.
The contents of the PSInstallAgent.ps1 PowerShell script are contained at this URL.
I'm hoping to be able to do this with the PSExec Sysinternals PowerToy. The homepage for this utility is here.
So what is the process and the correct syntax for using psexec to run this PSInstallAgent.ps1 PowerShell script on remote servers?
One note about this PSInstallAgent.ps1 PowerShell script is that I have only been able to get it to execute correctly using group policy when it has been set to run during system startup.
This system startup location within group policy is found within the Computer Configuration\Policies\Windows Settings\Scripts (Startup/Shutdown)\PowerShell Scripts location:
ASKER
I'm hoping I can use UNC paths as described in my other questions.
The command I need to run as part of psexec that will run this command on the remote servers to install the Manage Engine agent on the remote servers will be something like the following:
Is this something that psexec will be able to run?
powershell.exe\\domain.com\SysVol\domain.com\Policies\{257C7763-BE37-42F0-B232-A3875D7D01B5}\Machine\Scripts\Startup\PSInstallAgent.ps1 "DesktopCentralAgent.msi" "DesktopCentralAgent.mst" "DMRootCA.crt" "DMRootCA-Server.crt"
ASKER
What will be the command line syntax for using psexec to run and then execute the command shown above to run this command on the remote servers by getting the computer names of these remote servers from a CSV file?
ASKER
ASKER
Can you provide me with more detailed steps on using PowerShell remoting?
https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
then you run from the command line; something like...
Open in new window
...then finish the command line