Fixed UninstallProgram and SHSPrinterWeb

This commit is contained in:
Zachary Gorman 2025-01-17 15:37:32 -08:00
parent f02ec5d11d
commit c3259c33a2
6 changed files with 36 additions and 32 deletions

View file

@ -312,39 +312,34 @@ function FindUSBDevice {
$deviceID -match '(?<=PID_)(....)' | Out-Null $deviceID -match '(?<=PID_)(....)' | Out-Null
$p = $Matches[0] $p = $Matches[0]
} }
for ($i = 0; $i -lt $usbIDs.Count; $i++) { for ($i = 0; $i -lt $usbIDs.Count; $i++) {
if ($usbIDs[$i] -match $vid){ if (-not ($usbIDs[$i] -match $vid)){ continue }
if($usbIDs[$i][0] -eq "`t"){
}
else{
$man = ($usbIDs[$i] -split ' ')
$man = $man[2..$man.count] -join ' '
for ($y = $i+1; $y -lt $usbIDs.Count; $y++) {
if($usbIDs[$y][0] -ne "`t"){
return @{
Manufacturer = $man
Description = $null
}
}
if($usbIDs[$y] -match $p){
$dev = ($usbIDs[$y] -split ' ')
$dev = $dev[2..$dev.count] -join ' '
return @{
Manufacturer = $man
Description = $dev
}
}
} if($usbIDs[$i][0] -eq "`t"){ continue }
$man = ($usbIDs[$i] -split ' ')
$man = $man[2..$man.count] -join ' '
for ($y = $i+1; $y -lt $usbIDs.Count; $y++) {
if($usbIDs[$y][0] -ne "`t"){
return @{ return @{
Manufacturer = $man Manufacturer = $man
Description = $null Description = $null
} }
} }
if($usbIDs[$y] -match $p){
$dev = ($usbIDs[$y] -split ' ')
$dev = $dev[2..$dev.count] -join ' '
return @{
Manufacturer = $man
Description = $dev
}
}
}
return @{
Manufacturer = $man
Description = $null
} }
} }
} end { } end {

View file

@ -14,7 +14,7 @@ function Invoke-PCMonitor {
foreach ($comp in $comps) { foreach ($comp in $comps) {
Write-Progress -Activity "Initializing sessions" -Status $comp -PercentComplete ($dogs.Length/$comps.Length) Write-Progress -Activity "Initializing sessions" -Status $comp -PercentComplete ($dogs.Length/$comps.Length)
$dog = [WatchDog]::new($comp) $dog = [WatchDog]::new($comp)
$null = $dog.Update() Write-Host $dog.ReportChange()
$dogs += $dog $dogs += $dog
} }
Write-Progress -Activity "Initializing sessions" -Completed Write-Progress -Activity "Initializing sessions" -Completed

View file

@ -80,7 +80,7 @@ function Get-SHSPrinter {
$CMDB_IP = "*CMDB Mismatch - check CMDB*" $CMDB_IP = "*CMDB Mismatch - check CMDB*"
} }
if ($result.IP -ne $null) { if ($null -ne $result.IP) {
Write-Progress -Activity "Getting printer details for $name" -Status 'Connecting to printer' -PercentComplete 30 -ParentId 1 Write-Progress -Activity "Getting printer details for $name" -Status 'Connecting to printer' -PercentComplete 30 -ParentId 1

View file

@ -26,8 +26,12 @@ function Invoke-UninstallProgram ($Computer) {
foreach ($item in $selection) { foreach ($item in $selection) {
Write-Host "Uninstalling $($apps[$item].Name)" Write-Host "Uninstalling $($apps[$item].Name)"
$res = $apps[$item].Uninstall() $res = $apps[$item].Uninstall()
if ($res.ReturnValue) { switch ($res) {
Write-Warning "$appname failed to uninstall from $Computer with ReturnValue $($res.ReturnValue)" 0 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer" }
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Restarting $Computer" }
3010 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Please restart $Computer to finish uninstall" }
3011 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Please restart $Computer to finish uninstall" }
default { Write-Warning "$appname failed to uninstall from $Computer with ReturnValue $($res.ReturnValue)" }
} }
} }
} }

View file

@ -275,7 +275,7 @@ begin {
$comp,$msg = Get-Hostname $comp $comp,$msg = Get-Hostname $comp
Write-Progress -Activity "Get-PC flags processing" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete ($PCID*100/$NumberOfComputers) -Id 1 Write-Progress -Activity "Get-PC flags processing" -Status "$comp ($PCID/$NumberofComputers)" -PercentComplete ($PCID*100/$NumberOfComputers) -Id 1
if ($msg -and -not $SHSPrinter) { if ($msg -and -not $SHSPrinter -and -not $SHSPrinterWeb) {
if ($SoundEnabled) { if ($SoundEnabled) {
$oopsSoundPath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\gamblecore.wav' $oopsSoundPath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\gamblecore.wav'
(New-Object Media.SoundPlayer $oopsSoundPath).Play() (New-Object Media.SoundPlayer $oopsSoundPath).Play()

View file

@ -1,3 +1,8 @@
Patch: 2024-1-17
-Fix SHSPrinterWeb bug with site domain names e.g. sagh.int.samhealth.net
-Add Better result code handling in UninstallProgram
-Add Monitor now reports the initial state of monitored workstations
Patch: 2024-12-13 Patch: 2024-12-13
-Add Powershell input pipeline support, unoptimized -Add Powershell input pipeline support, unoptimized
-Add CMDB fields now hold Spark warnings rather than printing to console in SCCM and normal queries -Add CMDB fields now hold Spark warnings rather than printing to console in SCCM and normal queries