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

@ -313,12 +313,9 @@ function FindUSBDevice {
$p = $Matches[0]
}
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{
if($usbIDs[$i][0] -eq "`t"){ continue }
$man = ($usbIDs[$i] -split ' ')
$man = $man[2..$man.count] -join ' '
@ -345,8 +342,6 @@ function FindUSBDevice {
Description = $null
}
}
}
}
} end {
}

View file

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

View file

@ -80,7 +80,7 @@ function Get-SHSPrinter {
$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

View file

@ -26,8 +26,12 @@ function Invoke-UninstallProgram ($Computer) {
foreach ($item in $selection) {
Write-Host "Uninstalling $($apps[$item].Name)"
$res = $apps[$item].Uninstall()
if ($res.ReturnValue) {
Write-Warning "$appname failed to uninstall from $Computer with ReturnValue $($res.ReturnValue)"
switch ($res) {
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
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) {
$oopsSoundPath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\gamblecore.wav'
(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
-Add Powershell input pipeline support, unoptimized
-Add CMDB fields now hold Spark warnings rather than printing to console in SCCM and normal queries