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-18.104.22.168-RELEASE.exe’
$GreenshotArgList = ‘/i’, ‘/VERYSILENT’, ‘/NORESTART’, ‘-Wait’
$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?