Reputation: 105
I am having an issue with Windows Installer popup when running my script.
My script
function InstallMyMsi {
$File='C:\\my\\path\\my msi file.msi'
$DT = Get-Date -Format "yyyyMMdd_HHmm"
$Log = "C:\\my\\other_path\\Log_$DT.log"
$Params = "/L*V $Log", '/i', $File, '/qn!', '/quiet', '/passive'
$p = Start-Process `
'msiexec.exe' `
-ArgumentList $Params `
-NoNewWindow `
-Wait `
-PassThru
return $p.ExitCode
}
InstallMyMsi
I have tried different combinations of arguments with no luck.
Any ideas?
Edit: The file name of the msi contains space. I have edited that part, could this be the cause of the issue?
Upvotes: 1
Views: 729
Reputation: 309
I have run into this before. It's often easier to build a string and pass it that way. Also, you may need to surround your argument to /i with quotes as some paths to your installer may have a space it in.
function InstallMyMsi {
$File='C:\\my\\path\\file.msi'
$DT = Get-Date -Format "yyyyMMdd_HHmm"
$Log = "C:\\my\\other_path\\Log_$DT.log"
$Params = "/L*V $Log /i `"$File`" /qn /quiet /passive"
$p = Start-Process `
'msiexec.exe' `
-ArgumentList $Params `
-NoNewWindow `
-Wait `
-PassThru
return $p.ExitCode
}
InstallMyMsi
Upvotes: 1