Robert
Robert

Reputation: 1

Running a powershell script through Psexec

new to the forum. I've been trying to run a PowerShell script from sccm package via psexec command but can't seem to get it to work, possibly been asked before but I give it a go here. not sure if its pathway issues, permission issues or other input issues.

Tried running this:

psexec -i \\server\packages$\app\folder with space\deploy-script.ps1

This gives the error:

"couldn't access server\packages$\app\folder with space"
"Connecting to server..."

Tried to put "pathway" as well but also doesn't work. I've been running this with admin elevated rights still no go.

psexec -i \\server\packages$\app\folder with space\deploy-script.ps1

Initiates script installation.

Upvotes: 0

Views: 4220

Answers (1)

Cpt.Whale
Cpt.Whale

Reputation: 5351

Check the syntax of psexec here: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec

The correct systax for your command should look something like:

psexec \\server powershell.exe -f "\\path\to\script.ps1"

Upvotes: 1

Related Questions