Small fixes

This commit is contained in:
Zachary Gorman 2025-04-14 11:28:50 -07:00
parent 4671387d85
commit 49750da7a5
7 changed files with 30 additions and 22 deletions

View file

@ -40,5 +40,8 @@
}, },
{ {
"DisplayName": "Maxx Audio Installer" "DisplayName": "Maxx Audio Installer"
},
{
"DisplayName": "Visage 7.1 (64 bit)"
} }
] ]

View file

@ -18,7 +18,7 @@ function Get-CMDBFallback {
if($cmdbData){ if($cmdbData){
$comp = $cmdbData.Name $comp = $cmdbData.Name
Write-Progress -Activity "CMDB Fallback $comp" -Status "Asset tag found, checking connection to $comp" -PercentComplete 70 -ParentId 1 Write-Progress -Activity "CMDB Fallback $comp" -Status "Asset tag found, checking connection to $comp" -PercentComplete 70 -ParentId 1
if(Test-Connection $comp){ if(Test-Connection $comp -Count 1){
Write-Progress -Activity "CMDB Fallback $comp" -Status "Rerunning get-pc with new name $comp" -PercentComplete 85 -ParentId 1 Write-Progress -Activity "CMDB Fallback $comp" -Status "Rerunning get-pc with new name $comp" -PercentComplete 85 -ParentId 1
$getpcData = get-pc $comp $getpcData = get-pc $comp
Write-Progress -Activity "CMDB Fallback $comp" -Completed Write-Progress -Activity "CMDB Fallback $comp" -Completed

View file

@ -1,11 +1,23 @@
function Get-Hostname ([string]$name) { function Get-Hostname ([string]$name) {
Write-Progress -Activity "Resolving hostname for $name" -PercentComplete 0 -ParentId 1 # IP address matching goes first so the next check doesn't short and return back the IP
Write-Progress -Activity "Resolving hostname for $name" -Status 'IP Address resolution' -PercentComplete 0 -ParentId 1
# Regex to match IP Address brought to you by https://stackoverflow.com/a/36760050
if ($name -match "^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$") {
$res = Resolve-DnsName $name
if ($res -and $res.NameHost -and ($res.NameHost -match "([^.]+)(\.[^.]+)?\.int\.samhealth\.net")) {
Write-Progress -Activity "Resolving hostname for $name" -Completed -ParentId 1
return $Matches[1],''
} else {
$errMsg += "IP Address couldn't be resolved to hostname`n"
}
}
Write-Progress -Activity "Resolving hostname for $name" -PercentComplete 10 -ParentId 1
# Return early if the hostname already resolves # Return early if the hostname already resolves
if (Resolve-DnsName $name) { if (Resolve-DnsName $name) {
Write-Progress -Activity "Resolving hostname for $name" -Completed -ParentId 1 Write-Progress -Activity "Resolving hostname for $name" -Completed -ParentId 1
return $name,'' return $name,''
} }
Write-Progress -Activity "Resolving hostname for $name" -Status 'SCCM Asset Tag Lookup' -PercentComplete 10 -ParentId 1 Write-Progress -Activity "Resolving hostname for $name" -Status 'SCCM Asset Tag Lookup' -PercentComplete 20 -ParentId 1
$errMsg = '' $errMsg = ''
if ($name.Length -eq 5) { if ($name.Length -eq 5) {
$res = Get-AssetConversion $name $res = Get-AssetConversion $name
@ -16,17 +28,6 @@ function Get-Hostname ([string]$name) {
# We don't check CMDB asset tags here because they often resolve to # We don't check CMDB asset tags here because they often resolve to
# something other than the hostname, like the asset tag itself # something other than the hostname, like the asset tag itself
} }
Write-Progress -Activity "Resolving hostname for $name" -Status 'IP Address resolution' -PercentComplete 20 -ParentId 1
# Regex to match IP Address brought to you by https://stackoverflow.com/a/36760050
if ($name -match "^((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b){4}$") {
$res = Resolve-DnsName $name
if ($res -and $res.NameHost -and ($res.NameHost -match "([^.]*)\.int\.samhealth\.net")) {
Write-Progress -Activity "Resolving hostname for $name" -Completed -ParentId 1
return $Matches[0],''
} else {
$errMsg += "IP Address couldn't be resolved to hostname`n"
}
}
Write-Progress -Activity "Resolving hostname for $name" -Status 'SCCM Serial Number lookup' -PercentComplete 30 -ParentId 1 Write-Progress -Activity "Resolving hostname for $name" -Status 'SCCM Serial Number lookup' -PercentComplete 30 -ParentId 1
if ($name.Length -eq 7) { if ($name.Length -eq 7) {
$res = Get-ServiceTagConversion $name $res = Get-ServiceTagConversion $name

View file

@ -14,7 +14,8 @@ 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)
Write-Output $dog.ReportChange() $null = $dog.Update()
Write-Output $dog
$dogs += $dog $dogs += $dog
} }
Write-Progress -Activity "Initializing sessions" -Completed Write-Progress -Activity "Initializing sessions" -Completed

View file

@ -29,12 +29,10 @@ $Headers = @{
$domains = @('.gsrmc.int.samhealth.net','.avery.int.samhealth.net','.sagh.int.samhealth.net','.snlh.int.samhealth.net','.slch.int.samhealth.net','.spch.int.samhealth.net') $domains = @('.gsrmc.int.samhealth.net','.avery.int.samhealth.net','.sagh.int.samhealth.net','.snlh.int.samhealth.net','.slch.int.samhealth.net','.spch.int.samhealth.net')
$result = Resolve-DnsName $printer -ErrorAction SilentlyContinue $result = Resolve-DnsName $printer -ErrorAction SilentlyContinue
if($null -eq $result){ foreach ($domain in $domains) {
foreach ($domain in $domains) { if($null -ne $result){ break }
$search = "$printer$domain" $search = "$printer$domain"
$result = Resolve-DnsName $search -ErrorAction SilentlyContinue $result = Resolve-DnsName $search -ErrorAction SilentlyContinue
if($null -ne $result){ break }
}
} }
#CMDB Data #CMDB Data

View file

@ -31,7 +31,7 @@ function Invoke-UninstallProgram ($Computer) {
1641 { Write-Host "Successfully Uninstalled $($apps[$item].Name) from $Computer"; Write-Warning "Restarting $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" } 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" } 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)" } default { Write-Warning "$appname failed to uninstall from $Computer with ReturnValue $($res.ReturnValue). See an MsiExec return value table for more information." }
} }
} }
} }

View file

@ -1,3 +1,8 @@
Patch
-Update Added Visage to the AppDiff ignore list
-Fix Capped ping attempts to one in CMDB fallback so it doesn't hang on offline computers
-Fix IP Address queries now resolve to the hostname correctly, but does not act as a workaround for duplicate A records
Patch 2025-3-20 Patch 2025-3-20
-Update GPUpdate is now more robust by clearing more files and registry keys -Update GPUpdate is now more robust by clearing more files and registry keys