Start-Process "Positional parameter cannot be found" error...

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Bob McCoy Bob McCoy 11 months ago.

  • Author
  • #32297
    Profile photo of Jesper Kristensen
    Jesper Kristensen

    Hi Guys.

    I am completely new to Powershell and am working on my first script. Have been watching some Microsoft PS videos and seeking knowledge on forums etc. and now have high hopes of automating a whole bunch of things, to make my IT life easier.

    This script of mine is to install various applications automatically (and silently if possible) on Windows 7 clients. I found numerous posts regarding "possitional parameter error", but I haven't been able to make any of the solutions work in my own script! So now I am trying this. Will be very thankfull for any help.

    My script looks like this:


    $Greenshot = 'Greenshot-INSTALLER-'
    $GreenshotArgList = '/i', '/VERYSILENT', '/NORESTART', '-Wait'
    $Java =
    $Symantec =
    $Adobe =

    $username = "xxx"
    $password = "xxx"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))

    # **************** PROGRAMS ******************


    Start-Process -Credential ($credentials) -FilePath "\\server1\msi\New_Machine\$Greenshot" /ArgumentList "$GreenshotArgList"

    The plan is to use the same method on Java, SEP client, Adobe Reader etc.

    I tried with numerous different variations of the argument variable etc. The switches used is from Greenshots homepage, so I am confident that tey are correct.
    But I keep getting the error:
    Start-Process : A positional parameter cannot be found that accepts argument '/VERYSILENT /NORESTART -Wait'.

    The line below works and starts up the Greenshot exe file (but ofcourse isn't silent), so I think installing from UNC path is not the problem:
    Start-Process -Credential ($credentials) -FilePath "\\server1\msi\New_Machine\$Greenshot"

    Can anyone help me out, getting the arguments to work?

    Best Regards,

  • #32302

    Start-Process -Credential ($credentials) -FilePath "\\server1\msi\New_Machine\$Greenshot" /ArgumentList "$GreenshotArgList"

    Use -ArgumentList instead of /ArgumentList.

  • #32304
    Profile photo of Jesper Kristensen
    Jesper Kristensen

    O M G.
    ...and I even used the dash in the $credentials variable.

    Thanks a lot Matt.

  • #32305
    Profile photo of Bob McCoy
    Bob McCoy

    Old habits can be hard to break. Welcome to PowerShell. It's better here.

You must be logged in to reply to this topic.