0

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.

2
  • You should quote the path "PATH" and if this is supposed to be a UNC path, you need two backslashes at the beginning, so "\\server\packages$\app\folder with space\deploy-script.ps1" Commented Feb 13, 2019 at 15:11
  • Apologies if this is off-topic, but to be honest, I'd rather use Invoke-Command, if possible. I don't know if you have the option, but if you do, it's easier (you don't need PSExec) and output/ logging can be more relevant. Commented Feb 13, 2019 at 16:04

1 Answer 1

1

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"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.