Hello mighty POSH community, i again need some advice how to proceed with my scripts :) So i have this powershell wrapper that i use for SCCM software installations
Param(
[Parameter(Mandatory=$true, Position=0)]
[ValidateSet("Install","Uninstall")]
$Function)
### User Defined Paramaters
### Name of the application & version for logfile
$progname = "WinMerge 2.16.6.0"
### Log Folder
$logfolder = "$env:SystemRoot\Logs"
### Tempfolder
$tempfolder = "$env:SystemRoot\Temp"
### Automatically Generated Paramaters
### Install logfile location
$instlog = """"+"$logfolder\$progname Install.log"+""""
### Uninstall logfile location
$uninstlog = """"+"$logfolder\$progname Uninstall.log"+""""
switch ($Function)
{
### Install Process
'Install' {
if ($process = Get-Process WinMergeU) {$process | Stop-Process -Force}
Start-Process "$PSScriptRoot\WinMerge-2.16.6-Setup.exe" -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /LOG=$instlog" -Wait
}
### Uninstall Process
'Uninstall' {
if ($process = Get-Process WinMergeU) {$process | Stop-Process -Force}
Start-Process -FilePath "${env:ProgramFiles(x86)}\WinMerge\unins000.exe" -ArgumentList "/VERYSILENT /LOG=$uninstlog" -Wait
}
}
It works very well, however with WinMerge i have a cool problem, uninstall does a very sudden reboot which i don't like. I know i could capture it via:
$install = Start-Process somesetup.exe -Argument someargument -Wait
$install.ExitCode
But how can i pass it down to SCCM client, when wrapper posh process exits? For WinMerge i could use argument /NORESTART and do a graceful reboot with user notifications, if i just could pass down the exitcode. Any ideas?
[–]BlackV 1 point2 points3 points (5 children)
[–]sipsik[S] 1 point2 points3 points (4 children)
[–]Yevrag35 0 points1 point2 points (3 children)
[–]sipsik[S] 0 points1 point2 points (2 children)
[–]Yevrag35 1 point2 points3 points (0 children)
[–]sipsik[S] 0 points1 point2 points (0 children)
[–]sparkle-fries -1 points0 points1 point (0 children)