Author Posts

November 26, 2015 at 2:41 am

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:

*********************
#VARIABLES

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

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

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

#GREENSHOT

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,
Jesper

November 26, 2015 at 3:46 am

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

Use -ArgumentList instead of /ArgumentList.

November 26, 2015 at 4:54 am

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

Thanks a lot Matt.

November 26, 2015 at 6:33 am

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