aww dangit

This commit is contained in:
Zachary Gorman 2024-09-13 16:55:52 -07:00
parent ddd1f02fed
commit c0a406a590
8 changed files with 18 additions and 7 deletions

BIN
Data/gamblecore.wav Normal file

Binary file not shown.

BIN
Data/xfiles.wav Normal file

Binary file not shown.

View file

@ -134,7 +134,7 @@ Function Find-ISMBusinessObject {
if (!$Query){ if (!$Query){
Write-Host "No results returned for the $BusinessObject Business Object!" -ForegroundColor yellow #Write-Host "No results returned for the $BusinessObject Business Object!" -ForegroundColor yellow
} elseif ($Query.Edmx){ } elseif ($Query.Edmx){
@ -238,7 +238,7 @@ Function Find-ISMBusinessObject {
} }
catch { catch {
write-warning "Failed querying for $BusinessObject!" write-warning "Failed querying Spark!"
} }

View file

@ -36,14 +36,14 @@ function Get-Hostname ([string]$name) {
$sccmMatches = Get-SCCM_HostnameMatch $name $sccmMatches = Get-SCCM_HostnameMatch $name
if ($SCCMMatches -and $SCCMMatches.Count -lt 2) { if ($SCCMMatches -and $SCCMMatches.Count -lt 2) {
return $SCCMMatches,'' return $SCCMMatches,''
} elseif (!$SCCMMatches) { $errMsg += "No SCCM match found`n" } } elseif (!$SCCMMatches) { $errMsg += "No SCCM name match found`n" }
elseif ($SCCMMatches.Count -ge 2) { $errMsg += "Many SCCM matches found`n" } elseif ($SCCMMatches.Count -ge 2) { $errMsg += "Many SCCM matches found`n" }
# CMDB check should be absolute last resort # CMDB check should be absolute last resort
$cmdbMatches = Find-ISMBO -bo cis -SearchQuery $name $cmdbMatches = Find-ISMBO -bo cis -SearchQuery $name
if ($cmdbMatches -and $cmdbMatches.Count -lt 2) { if ($cmdbMatches -and $cmdbMatches.Count -lt 2) {
return $cmdbMatches.Name,'' return $cmdbMatches.Name,''
} elseif (!$cmdbMatches) { $errMsg += "No CMDB match found`n" } } elseif (!$cmdbMatches) { $errMsg += "No CMDB name match found`n" }
elseif ($cmdbMatches.Count -ge 2) { elseif ($cmdbMatches.Count -ge 2) {
# Try more specific queries # Try more specific queries
# Asset tag # Asset tag

View file

@ -164,7 +164,7 @@ Function Get-ISMBusinessObject {
if (!$Query){ if (!$Query){
Write-Host "No results returned for the $BusinessObject Business Object!" -ForegroundColor yellow #Write-Host "No results returned for the $BusinessObject Business Object!" -ForegroundColor yellow
} elseif ($Query.Edmx){ } elseif ($Query.Edmx){
@ -268,7 +268,7 @@ Function Get-ISMBusinessObject {
} }
catch { catch {
write-warning "Failed querying for $BusinessObject!" write-warning "Failed querying Spark!"
} }

View file

@ -138,7 +138,7 @@ BEGIN {
### If we have no BOMetaDataProperties then an invalid BusinessObject was supplied. ### If we have no BOMetaDataProperties then an invalid BusinessObject was supplied.
if (!$BOMetaDataProperties){ if (!$BOMetaDataProperties){
$ValidSyntax = $false $ValidSyntax = $false
Write-Host "Unable to query Metadata for the $BusinessObject Business Object! Check the name and try again." -ForegroundColor yellow Write-Host "Failed querying Spark!" -ForegroundColor yellow
} elseif ($BOMetaDataProperties.EntityType.count){ } elseif ($BOMetaDataProperties.EntityType.count){
$BOMetaDataProperties = $BOMetaDataProperties.EntityType[-1].Property.Name | Sort-Object $BOMetaDataProperties = $BOMetaDataProperties.EntityType[-1].Property.Name | Sort-Object
} else { } else {

View file

@ -244,6 +244,11 @@ Function Get-PC {
$comp,$msg = Get-Hostname $comp $comp,$msg = Get-Hostname $comp
if ($msg -and -not $SHSPrinter) { if ($msg -and -not $SHSPrinter) {
if ($SoundEnabled) {
$oopsSoundPath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\gamblecore.wav'
(New-Object Media.SoundPlayer $oopsSoundPath).Play()
}
Write-Host "`n$msg" -ForegroundColor Red Write-Host "`n$msg" -ForegroundColor Red
$props = [Ordered]@{ $props = [Ordered]@{
@ -599,6 +604,10 @@ Function Get-PC {
if ($adTest) { if ($adTest) {
Write-Warning "$comp is either disabled or off the domain" Write-Warning "$comp is either disabled or off the domain"
if ($SoundEnabled) {
$oopsSoundPath = Join-Path (get-item $PSScriptRoot).Parent.FullName 'Data\xfiles.wav'
(New-Object Media.SoundPlayer $oopsSoundPath).Play()
}
} }
Write-Progress -Activity "Looking up computer in AD" -Completed Write-Progress -Activity "Looking up computer in AD" -Completed
} }

View file

@ -4,6 +4,8 @@ Patch: 2024-09-13
-Refactor BatchInvokes uses Get-PCLocal so there is only one spot to update -Refactor BatchInvokes uses Get-PCLocal so there is only one spot to update
-Fix shortened Spark! timeout since Spark! typically won't succeed after 5 seconds -Fix shortened Spark! timeout since Spark! typically won't succeed after 5 seconds
-Fix bug when querying mobile devices -Fix bug when querying mobile devices
-Fix Less helpful (and less confusing) ISM error messages
-Tip try setting $SoundEnabled = $true
Patch: 2024-09-12 Patch: 2024-09-12
-Fix Hostnames now check SCCM for a hostname match as a fallback -Fix Hostnames now check SCCM for a hostname match as a fallback