Start-process: both positional parameter and can’t locate file specified

Ok, So I am working on the powershell remote deployment of software to ADUsers. I have remote access to the computer and all, no problems there.

Right now I am at the point where I have a exe file from Ninite to just install 7zip onto the client pc just to see when it works so i can start deploying some bigger programs to it.

The guide I have found to help me deploy out the software for now looks like this:

Invoke-Command -ComputerName *REDACTED* -Scriptblock {
    Start-Process C:\Users\Administrator\Documents\ninite_7_zip\Ninite 7Zip Installer.exe '/silent' -wait
}

When I do run this code, I get the error:

A positional parameter cannot be found that accepts argument 'Installer.exe'.

So I thought to myself, that it might be because of the spaces in the name. So therefore I changed it to:

Invoke-Command -ComputerName *REDACTED* -Scriptblock {
        Start-Process C:\Users\Administrator\Documents\ninite_7_zip\Ninite_7Zip_Installer.exe '/silent' -wait
    }

And ofcourse also changed it's name within the folder to match the "newly made" code.

But the error now changed into:

This command cannot be run due to the error: The system cannot find the file specified

Even though I use Powershell ISE, and I used it's guideboxes when writing, to enter the folder and find it, when I wrote the directory.

My only goal in this, is that I want to remotely run and complete this installer on the client PC when deployed from the DC upon which the file lies.

Anybody got a qualified guess? Or maybe even so, a solution.

Thanks in advance for your kind answers.



Read more here: https://stackoverflow.com/questions/64892806/start-process-both-positional-parameter-and-cant-locate-file-specified

Content Attribution

This content was originally published by Mike skovby at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: