Last active
December 2, 2016 21:55
-
-
Save JohnL4/328f379e77f6532f28213f813d0fea95 to your computer and use it in GitHub Desktop.
Running msiexec as Administrator and getting the argument quoting right.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$VerbosePreference="Continue" | |
ls .\AllscriptsGateway, .\HCServer, .\EntMgr | ? {$_.Name -match '\.msi$'} | % {sudo msiexec ('/f "' + $_.FullName + '"'),'/passive'} | |
# VERBOSE: Start-Process «msiexec» -ArgumentList «/f "C:\SCM-Setup\Installers\AllscriptsGateway\Allscripts Gateway 16.3 (488).msi"»,«/passive» | |
# VERBOSE: Start-Process «msiexec» -ArgumentList «/f "C:\SCM-Setup\Installers\HCServer\Helios Connect 16.3.msi"»,«/passive» | |
# VERBOSE: Start-Process «msiexec» -ArgumentList «/f "C:\SCM-Setup\Installers\EntMgr\Enterprise Manager for Sunrise Enterprise 16.3 (488).msi"»,«/passive» | |
# Look at me, all fancy with my Unicode guillemet characters! | |
<# | |
Comments: | |
'sudo' is my little function that submits its args to Start-Process with the addition of -Wait and -Verb RunAs options. | |
So, we wind up with 'msiexec' being the -FilePath value, and the rest being the -ArgumentList value. | |
'msiexec' actually doesn't take the "normal" simple list of arguments, but rather "/i foo.msi" or "/f foo.msi" has to be | |
one argument. | |
#> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment