I am trying to install one client\'s software by using PowerShell silent scripting. Below is the script which I have created and its not working and throwing errors like be
There are several things you may want to fix in your code:
$args
is an automatic variable. Don't try to overwrite it. Use a different variable name, e.g. $params
. As others have already mentioned, put the parameters in quotes when defining the array.Start-Process
it's easier to use the call operator and splatting.try
/catch
on them is pointless.$LastExitCode
.$installer = 'C:\Software\Software.exe'
$params = '/S', '/L1033', '-INSTALL_TYPE=PRESERVE_VERSION',
'START_MENU=AStartMenuFolder\Software\production'
& $Installer @params
if ($LastExitCode -eq 0) {
[Windows.MessageBox]::Show('Installation Completed Successfully')
} else {
[Windows.MessageBox]::Show('Installation Failled')
}