$cs.Shell\_Execute
Syntax
Section titled “Syntax”$cs.Shell_Execute(string command, string arguments = "", bool wait = true, int windowstyle = 0, bool mustexist = false, string workingdirectory = "")
Parameters
Section titled “Parameters”command
command to execute
arguments
argumtents for the command
wait
wait for command to complete (default True)
windowstyle
should command window be hidden or visible (default hidden). Choices (0=hidden, 1=normal, 2=minimized, 3=Maximized)
mustexist
check if command file exists before excuting (default False)
workingdirectory
working directory for command (default emtpy)
Example
Section titled “Example”$cs.Shell_Execute("msiexec","/i `"$Packageroot\kit\GoogleChromeStandaloneEnterprise64.Msi`" /QN REBOOT=REALLYSUPPRESS ALLUSERS=1")returns result in integer
Example - Install MSI with log upload to CapaInstaller
Section titled “Example - Install MSI with log upload to CapaInstaller”$MsiPath = Join-Path $global:Packageroot "kit" "7zip.msi"$LogPath = Join-Path $global:AppLogFolder "7zip_Install.log"$Arguments = "/i `"$MsiPath`" /qn /norestart /log `"$LogPath`""
$Result = $cs.Shell_Execute("msiexec.exe", $Arguments)if ($Result -ne 0 -and $Result -ne 3010) { $cs.Job_WriteLog("7-Zip installation failed with exit code: $Result") Exit-PSScript $Result}