I created the following script, which runs succesfully on the server.
echo d | xcopy \\ServerName\DCSWRepository\PsExec.exe c:\temp\ /Y
C:\temp\psexec.exe -u %computername%\administrator -p AdminPasswordHere -accepteula "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile Set-ExecutionPolicy RemoteSigned -Force
I setup a Custom Script configuration to run from the script repository. I get the following error.
C:\Program Files (x86)\DesktopCentral_Agent\Computer\Startup\618>echo d | xcopy \\ServerName\DCSWRepository\PsExec.exe c:\temp\ /Y
\\ServerName\DCSWRepository\PsExec.exe
1 File(s) copied
C:\Program Files (x86)\DesktopCentral_Agent\Computer\Startup\618>C:\temp\psexec.exe -u ServerName\Administrator -p AdminPasswordHere -accepteula "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile Set-ExecutionPolicy RemoteSigned -Force
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
Access is denied.
PsExec could not start C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe: