Fixed jobsprinters
This commit is contained in:
parent
69f3146070
commit
31c72c9a6b
|
|
@ -226,7 +226,7 @@ $Headers = @{
|
||||||
$cmdbData = $Query.Value
|
$cmdbData = $Query.Value
|
||||||
} else {
|
} else {
|
||||||
$cmdbData = @{
|
$cmdbData = @{
|
||||||
Loc = "CMDB Mismatch!"
|
SHS_LocationDetails = "CMDB Mismatch!"
|
||||||
Status = "CMDB Mismatch!"
|
Status = "CMDB Mismatch!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -234,7 +234,7 @@ $Headers = @{
|
||||||
#Write-Host $_.Exception.Message
|
#Write-Host $_.Exception.Message
|
||||||
#Write-Warning "Failed querying Spark!"
|
#Write-Warning "Failed querying Spark!"
|
||||||
$cmdbData = @{
|
$cmdbData = @{
|
||||||
Loc = "Failed querying Spark!"
|
SHS_LocationDetails = "Failed querying Spark!"
|
||||||
Status = "Failed querying Spark!"
|
Status = "Failed querying Spark!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,15 @@ function Get-SHSPrinter {
|
||||||
[string]$printer
|
[string]$printer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Spark connection params
|
||||||
|
$Tenant = 'https://samaritanhealth-amc.ivanticloud.com'
|
||||||
|
$Headers = @{
|
||||||
|
"Content-Type" = "application/json"
|
||||||
|
"Authorization" = 'rest_api_key=EB68123D62F8489295C807353C92D75B'
|
||||||
|
"Accept" = "*/*"
|
||||||
|
"Accept-Encoding" = "gzip, deflate, br"
|
||||||
|
}
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $printer" -Status 'Getting IP Address' -PercentComplete 10 -ParentId 1
|
Write-Progress -Activity "Getting printer details for $printer" -Status 'Getting IP Address' -PercentComplete 10 -ParentId 1
|
||||||
$snmp = New-Object -ComObject olePrn.OleSNMP
|
$snmp = New-Object -ComObject olePrn.OleSNMP
|
||||||
|
|
||||||
|
|
@ -32,7 +41,26 @@ function Get-SHSPrinter {
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $printer" -Status 'Getting CMDB data' -PercentComplete 20 -ParentId 1
|
Write-Progress -Activity "Getting printer details for $printer" -Status 'Getting CMDB data' -PercentComplete 20 -ParentId 1
|
||||||
# $cmdbRecord = Get-LANDeskCMDBItem -Name $printer
|
# $cmdbRecord = Get-LANDeskCMDBItem -Name $printer
|
||||||
$cmdbRecord = Search-ISMBO -BO cis -filter "Name eq '$Printer'" -RawFilter
|
$timeout = if ($SparkQueryTimeoutSec) {$SparkQueryTimeoutSec} else {5}
|
||||||
|
$uri = "$Tenant/api/odata/businessobject/cis`?`$filter=Name eq '$printer'&`$top=1&`$skip=0"
|
||||||
|
try {
|
||||||
|
$Query = Invoke-RestMethod -Method GET -uri $uri -headers $Headers -TimeoutSec $timeout
|
||||||
|
if ($Query) {
|
||||||
|
$cmdbData = $Query.Value
|
||||||
|
} else {
|
||||||
|
$cmdbData = @{
|
||||||
|
SHS_LocationDetails = "CMDB Mismatch!"
|
||||||
|
Status = "CMDB Mismatch!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
#Write-Host $_.Exception.Message
|
||||||
|
#Write-Warning "Failed querying Spark!"
|
||||||
|
$cmdbData = @{
|
||||||
|
SHS_LocationDetails = "Failed querying Spark!"
|
||||||
|
Status = "Failed querying Spark!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$LocationConstructors = @(
|
$LocationConstructors = @(
|
||||||
"SHS_AssetLocality",
|
"SHS_AssetLocality",
|
||||||
|
|
@ -42,275 +70,250 @@ function Get-SHSPrinter {
|
||||||
"SHS_LocationDetails"
|
"SHS_LocationDetails"
|
||||||
)
|
)
|
||||||
|
|
||||||
$LocationData = Foreach ($Loc in $LocationConstructors) {
|
$LocationData = Foreach($Loc in $LocationConstructors){
|
||||||
|
|
||||||
if ($Loc -eq 'SHS_Floor') {
|
if ($Loc -eq 'SHS_Floor'){
|
||||||
$(if ($cmdbRecord.$Loc -match '-') { $cmdbRecord.$Loc.split('-')[-1] + " Floor" } else { $cmdbRecord.$Loc })
|
$(if ($cmdbData.$Loc -match '-'){$cmdbData.$Loc.split('-')[-1] + " Floor"} else{$cmdbData.$Loc})
|
||||||
}
|
} elseif (![string]::IsNullOrEmpty($cmdbData.$Loc)){
|
||||||
elseif (![string]::IsNullOrEmpty($cmdbRecord.$Loc)) {
|
$cmdbData.$Loc
|
||||||
$cmdbRecord.$Loc
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$LocationData = $LocationData -join ' | '
|
$LocationData = $LocationData -join ' | '
|
||||||
|
|
||||||
# $locationData = $cmdbRecord.SHS_AssetLocality + " | " + $cmdbRecord.ivnt_Location + " | " + + " | " + $cmdbRecord.SHS_Department + " | " + $cmdbRecord.SHS_LocationDetails
|
if ($cmdbData) {
|
||||||
# if($cmdbRecord.values._SHSLocation3.Length -gt $cmdbRecord.values._SHSCalcLocationString.Length){
|
|
||||||
# $locationData = $cmdbRecord.values._SHSLocation3
|
|
||||||
# }
|
|
||||||
# else{
|
|
||||||
# $locationData = $cmdbRecord.values._SHSCalcLocationString
|
|
||||||
# }
|
|
||||||
if ($cmdbRecord) {
|
|
||||||
# $CMDB_POA = $cmdbRecord.values._SHSPOANumber
|
|
||||||
# $CMDB_AssetTag = $cmdbRecord.values._SHSAssetTag
|
|
||||||
# $CMDB_Location = $locationData
|
|
||||||
# $CMDB_MAC = $cmdbRecord.values._SHSMACAddress
|
|
||||||
# $CMDB_model = $cmdbRecord.values._Model
|
|
||||||
# $CMDB_serial = $cmdbRecord.values._SerialNumber
|
|
||||||
# $CMDB_IP = $cmdbRecord.values._IPAddress
|
|
||||||
|
|
||||||
### Spark Properties
|
### Spark Properties
|
||||||
$CMDB_POA = $cmdbRecord.SHS_POANumber
|
$CMDB_POA = $cmdbData.SHS_POANumber
|
||||||
$CMDB_AssetTag = $cmdbRecord.AssetTag
|
$CMDB_AssetTag = $cmdbData.AssetTag
|
||||||
$CMDB_Location = $locationData
|
$CMDB_Location = $locationData
|
||||||
$CMDB_MAC = $cmdbRecord.MACAddress
|
$CMDB_MAC = $cmdbData.MACAddress
|
||||||
$CMDB_model = $cmdbRecord.Model
|
$CMDB_model = $cmdbData.Model
|
||||||
$CMDB_serial = $cmdbRecord.SerialNumber
|
$CMDB_serial = $cmdbData.SerialNumber
|
||||||
$CMDB_IP = $cmdbRecord.IPAddress
|
$CMDB_IP = $cmdbData.IPAddress
|
||||||
|
$CMDB_Status = $cmdbData.Status
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -eq $result.IPAddress) {
|
||||||
|
if ($CMDB_IP) {
|
||||||
|
$offlineIP = 'CMDB IP - ' + $CMDB_IP
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$offlineIP = 'No DNS Entry'
|
||||||
|
}
|
||||||
|
$props = [Ordered]@{
|
||||||
|
Machine = $printer
|
||||||
|
Status = 'No DNS Entry'
|
||||||
|
IP = $offlineIP
|
||||||
|
DomainName = 'No DNS Entry'
|
||||||
|
MAC = $CMDB_MAC
|
||||||
|
Model = $CMDB_model
|
||||||
|
Serial = $CMDB_serial
|
||||||
|
#Comment = $comment
|
||||||
|
Color = 'No DNS Entry'
|
||||||
|
Trays = 'No DNS Entry'
|
||||||
|
PageCount = 'No DNS Entry'
|
||||||
|
'CMDB POA' = $CMDB_POA
|
||||||
|
'CMDB AssetTag' = $CMDB_AssetTag
|
||||||
|
'CMDB Location' = $CMDB_Location
|
||||||
|
'CMDB Status' = $CMDB_Status
|
||||||
|
}
|
||||||
|
$obj = New-Object -TypeName PSObject -Property $props
|
||||||
|
return $obj
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Connecting to printer' -PercentComplete 30 -ParentId 1
|
||||||
|
|
||||||
|
$printerip = $result.IPAddress
|
||||||
|
$null = $result.Name -match '[^.]*\.(.*)'
|
||||||
|
$domainName = $Matches[1]
|
||||||
|
|
||||||
|
#checks to see if the printer is online
|
||||||
|
$online = Test-Connection $printerip -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if (-not $online) {
|
||||||
|
$status = "Offline"
|
||||||
|
$MAC = $CMDB_MAC
|
||||||
|
$model = $CMDB_model
|
||||||
|
$serial = $CMDB_serial
|
||||||
|
$color = "Offline"
|
||||||
|
$trays = "Offline"
|
||||||
|
$pagecount = "Offline"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$CMDB_POA = "*CMDB Mismatch - check CMDB*"
|
#opens snmp connection to the printer
|
||||||
$CMDB_AssetTag = "*CMDB Mismatch - check CMDB*"
|
$snmp.open($printerip, 'public', 2, 3000)
|
||||||
$CMDB_Location = "*CMDB Mismatch - check CMDB*"
|
|
||||||
$CMDB_MAC = "*CMDB Mismatch - check CMDB*"
|
|
||||||
$CMDB_model = "*CMDB Mismatch - check CMDB*"
|
|
||||||
$CMDB_serial = "*CMDB Mismatch - check CMDB*"
|
|
||||||
$CMDB_IP = "*CMDB Mismatch - check CMDB*"
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($null -ne $result.IP) {
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for MAC address' -PercentComplete 40 -ParentId 1
|
||||||
|
# Start of MAC
|
||||||
|
$pMAC = $SNMP.get(".1.3.6.1.2.1.2.2.1.6.2")
|
||||||
|
$MAC = [System.Text.Encoding]::Default.GetBytes($PMac) | ForEach-Object {
|
||||||
|
$_.ToString('X2')
|
||||||
|
}
|
||||||
|
$MAC = $MAC -join ':'
|
||||||
|
#End of MAC
|
||||||
|
|
||||||
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 'Querying for model' -PercentComplete 50 -ParentId 1
|
||||||
|
# MODEL
|
||||||
|
try { $model = $snmp.Get('.1.3.6.1.2.1.25.3.2.1.3.1') } catch { $model = $null }
|
||||||
|
|
||||||
$printerip = $result.IP
|
# IF IT HAS A MODEL NAME...
|
||||||
$domainName = $result.Path
|
if ($model) {
|
||||||
|
|
||||||
#checks to see if the printer is online
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for color' -PercentComplete 60 -ParentId 1
|
||||||
$online = Test-Connection $printerip -ErrorAction SilentlyContinue
|
# COLOR
|
||||||
|
# might want to check on this one
|
||||||
|
try { if ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') -match 'Toner|Cartridge|ink') { $color = 'Yes' } else { $color = 'No' } } catch { $color = 'No' }
|
||||||
|
|
||||||
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for trays' -PercentComplete 70 -ParentId 1
|
||||||
|
# TRAYS
|
||||||
|
try { $trays = $($snmp.GetTree('.1.3.6.1.2.1.43.8.2.1.13') | ? { $_ -notlike 'print*' }) -join ';' } catch { $trays = $null }
|
||||||
|
|
||||||
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for serial numbers' -PercentComplete 80 -ParentId 1
|
||||||
|
# SERIAL
|
||||||
|
try { $serial = $snmp.Get('.1.3.6.1.2.1.43.5.1.1.17.1') } catch { $serial = $null }
|
||||||
|
|
||||||
if ($online) {
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for page count' -PercentComplete 90 -ParentId 1
|
||||||
#opens snmp connection to the printer
|
#PAGECOUNT
|
||||||
$snmp.open($printerip, 'public', 2, 3000)
|
try { $pagecount = $snmp.Get('.1.3.6.1.2.1.43.10.2.1.4.1.1') } catch { $page = $null }
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for MAC address' -PercentComplete 40 -ParentId 1
|
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for model features' -PercentComplete 100 -ParentId 1 -Id 2
|
||||||
# Start of MAC
|
##### FEATURES, NAME
|
||||||
$pMAC = $SNMP.get(".1.3.6.1.2.1.2.2.1.6.2")
|
switch -Regex ($model) {
|
||||||
$MAC = [System.Text.Encoding]::Default.GetBytes($PMac) | ForEach-Object {
|
'^sharp' {
|
||||||
$_.ToString('X2')
|
try { $status = $snmp.Get('.1.3.6.1.2.1.43.18.1.1.8.1.1') } catch { $status = $null }
|
||||||
}
|
# Start of MAC
|
||||||
$MAC = $MAC -join ':'
|
$pMAC = $SNMP.get(".1.3.6.1.4.1.11.2.4.3.1.23.0")
|
||||||
#End of MAC
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for model' -PercentComplete 50 -ParentId 1
|
$MAC = [System.Text.Encoding]::Default.GetBytes($PMac) | ForEach-Object {
|
||||||
# MODEL
|
$_.ToString('X2')
|
||||||
try { $model = $snmp.Get('.1.3.6.1.2.1.25.3.2.1.3.1') } catch { $model = $null }
|
|
||||||
|
|
||||||
# IF IT HAS A MODEL NAME...
|
|
||||||
if ($model) {
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for color' -PercentComplete 60 -ParentId 1
|
|
||||||
# COLOR
|
|
||||||
# might want to check on this one
|
|
||||||
try { if ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') -match 'Toner|Cartridge|ink') { $color = 'Yes' } else { $color = 'No' } } catch { $color = 'No' }
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for trays' -PercentComplete 70 -ParentId 1
|
|
||||||
# TRAYS
|
|
||||||
try { $trays = $($snmp.GetTree('.1.3.6.1.2.1.43.8.2.1.13') | ? { $_ -notlike 'print*' }) -join ';' } catch { $trays = $null }
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for serial numbers' -PercentComplete 80 -ParentId 1
|
|
||||||
# SERIAL
|
|
||||||
try { $serial = $snmp.Get('.1.3.6.1.2.1.43.5.1.1.17.1') } catch { $serial = $null }
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for page count' -PercentComplete 90 -ParentId 1
|
|
||||||
#PAGECOUNT
|
|
||||||
try { $pagecount = $snmp.Get('.1.3.6.1.2.1.43.10.2.1.4.1.1') } catch { $page = $null }
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Status 'Querying for model features' -PercentComplete 100 -ParentId 1 -Id 2
|
|
||||||
##### FEATURES, NAME
|
|
||||||
switch -Regex ($model) {
|
|
||||||
'^sharp' {
|
|
||||||
try { $status = $snmp.Get('.1.3.6.1.2.1.43.18.1.1.8.1.1') } catch { $status = $null }
|
|
||||||
# Start of MAC
|
|
||||||
$pMAC = $SNMP.get(".1.3.6.1.4.1.11.2.4.3.1.23.0")
|
|
||||||
|
|
||||||
$MAC = [System.Text.Encoding]::Default.GetBytes($PMac) | ForEach-Object {
|
|
||||||
$_.ToString('X2')
|
|
||||||
}
|
|
||||||
$MAC = $MAC -join ':'
|
|
||||||
#End of MAC
|
|
||||||
}
|
}
|
||||||
'^zebra' {
|
$MAC = $MAC -join ':'
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for name' -PercentComplete 10 -ParentId 2
|
#End of MAC
|
||||||
try { $name = $snmp.Get('.1.3.6.1.4.1.10642.1.4.0').toupper() } catch { $name = $null }
|
}
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for model' -PercentComplete 30 -ParentId 2
|
'^zebra' {
|
||||||
try { $model = $snmp.Get('.1.3.6.1.4.1.10642.200.19.7.0').toupper() } catch { $model = $null }
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for name' -PercentComplete 10 -ParentId 2
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for MAC address' -PercentComplete 50 -ParentId 2
|
try { $name = $snmp.Get('.1.3.6.1.4.1.10642.1.4.0').toupper() } catch { $name = $null }
|
||||||
try { $MAC = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.10.2.1.5.2').toupper() } catch { $MAC = $null }
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for model' -PercentComplete 30 -ParentId 2
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for serial number' -PercentComplete 70 -ParentId 2
|
try { $model = $snmp.Get('.1.3.6.1.4.1.10642.200.19.7.0').toupper() } catch { $model = $null }
|
||||||
try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.200.19.5.0') } catch { $serial = $null }
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for MAC address' -PercentComplete 50 -ParentId 2
|
||||||
# try { $status = $snmp.Get('.1.3.6.1.4.1.10642.200.4.1.0') } catch { $status = $null }
|
try { $MAC = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.10.2.1.5.2').toupper() } catch { $MAC = $null }
|
||||||
# Zebra GK420
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for serial number' -PercentComplete 70 -ParentId 2
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode' -PercentComplete 80 -ParentId 2
|
try { $serial = $snmp.Get('.1.3.6.1.4.1.10642.200.19.5.0') } catch { $serial = $null }
|
||||||
try { $ipconfig = "($($snmp.Get('.1.3.6.1.4.1.10642.200.50.1.1.5.0')))" } catch { $ipconfig = $null }
|
# try { $status = $snmp.Get('.1.3.6.1.4.1.10642.200.4.1.0') } catch { $status = $null }
|
||||||
# Zebra ZD421
|
# Zebra GK420
|
||||||
if (!$ipconfig) {
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode' -PercentComplete 80 -ParentId 2
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode (2nd attempt)' -PercentComplete 85 -ParentId 2
|
try { $ipconfig = "($($snmp.Get('.1.3.6.1.4.1.10642.200.50.1.1.5.0')))" } catch { $ipconfig = $null }
|
||||||
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null }
|
# Zebra ZD421
|
||||||
$ipconfig = switch ($ipconfig) {
|
if (!$ipconfig) {
|
||||||
1 {'(All)'}
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for IP assignment mode (2nd attempt)' -PercentComplete 85 -ParentId 2
|
||||||
2 {'(GLEANING ONLY)'}
|
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.10642.20.10.20.15.2.1.5.2') } catch { $ipconfig = $null }
|
||||||
3 {'(RARP)'}
|
|
||||||
4 {'(BOOTP)'}
|
|
||||||
5 {'(DHCP)'}
|
|
||||||
6 {'(DHCP AND BOOTP)'}
|
|
||||||
7 {'(PERMANENT)'}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$model = "Zebra $model"
|
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2
|
|
||||||
#STATUS
|
|
||||||
$uri = $domainName
|
|
||||||
$html = Invoke-WebRequest -uri $uri
|
|
||||||
$raw = $html.rawcontent
|
|
||||||
$raw -match '([A-Z])\w+<.F' | Out-Null
|
|
||||||
$status = ($Matches[0] -split '<')[0]
|
|
||||||
#split off error condition
|
|
||||||
$raw -match 'RED>.+' | Out-Null
|
|
||||||
$split = $Matches[0] -split '>'
|
|
||||||
$err = $split[1] -split '<'
|
|
||||||
$status = $status + ' ' + $err[0]
|
|
||||||
|
|
||||||
Write-Progress -Activity "Getting zebra features from $name" -Completed
|
|
||||||
}
|
|
||||||
'^lexmark' {
|
|
||||||
Write-Progress -Activity "Getting lexmark features from $name" -Status 'Querying for name' -PercentComplete 50 -ParentId 2
|
|
||||||
try { $name = $snmp.Get('.1.3.6.1.4.1.641.1.5.7.6.0').toupper() } catch { $name = $null }
|
|
||||||
Write-Progress -Activity "Getting lexmark features from $name" -Completed
|
|
||||||
}
|
|
||||||
'^ricoh' {
|
|
||||||
Write-Progress -Activity "Getting ricoh features from $name" -Status 'Querying for name' -PercentComplete 50 -ParentId 2
|
|
||||||
try { $name = $snmp.Get('.1.3.6.1.4.1.367.3.2.1.7.3.5.1.1.2.1.1').toupper() } catch { $name = $null }
|
|
||||||
Write-Progress -Activity "Getting ricoh features from $name" -Completed
|
|
||||||
}
|
|
||||||
'^hp' {
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for name' -PercentComplete 5 -ParentId 2
|
|
||||||
try { $name = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.5.46.0').toupper() } catch { $name = $null }
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for status' -PercentComplete 10 -ParentId 2
|
|
||||||
try { $status = $snmp.Get('.1.3.6.1.4.1.11.2.3.9.1.1.3.0') } catch { $status = $null }
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for IP configuration' -PercentComplete 10 -ParentId 2
|
|
||||||
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.5.1.0') } catch { $status = $null }
|
|
||||||
$ipconfig = switch ($ipconfig) {
|
$ipconfig = switch ($ipconfig) {
|
||||||
1 { '(manual)' } #manual-one
|
1 {'(All)'}
|
||||||
2 { '(bootp)' } #bootp-two
|
2 {'(GLEANING ONLY)'}
|
||||||
3 { '(manual)' } #manual-three
|
3 {'(RARP)'}
|
||||||
4 { '(bootp)' } #bootp-four
|
4 {'(BOOTP)'}
|
||||||
5 { '(dhcp)' } #dhcp
|
5 {'(DHCP)'}
|
||||||
6 { '' } #not-configured
|
6 {'(DHCP AND BOOTP)'}
|
||||||
7 { '(default)' } #default-config
|
7 {'(PERMANENT)'}
|
||||||
8 { '(rarp)' } #rarp
|
|
||||||
9 { '' } #read-only
|
|
||||||
10 { '(auto-ip)' } #auto-ip
|
|
||||||
}
|
}
|
||||||
if ($MAC -eq '') {
|
}
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for MAC Address' -PercentComplete 15 -ParentId 2
|
$model = "Zebra $model"
|
||||||
$pMAC = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.1.12.1.2.5')
|
Write-Progress -Activity "Getting zebra features from $name" -Status 'Querying for status' -PercentComplete 90 -ParentId 2
|
||||||
$MAC = ($pMAC -split " ")[-1]
|
#STATUS
|
||||||
$MAC = ($MAC -replace '(..)', '$1:').trim(':')
|
$uri = $domainName
|
||||||
|
$html = Invoke-WebRequest -uri $uri
|
||||||
|
$raw = $html.rawcontent
|
||||||
|
$raw -match '([A-Z])\w+<.F' | Out-Null
|
||||||
|
$status = ($Matches[0] -split '<')[0]
|
||||||
|
#split off error condition
|
||||||
|
$raw -match 'RED>.+' | Out-Null
|
||||||
|
$split = $Matches[0] -split '>'
|
||||||
|
$err = $split[1] -split '<'
|
||||||
|
$status = $status + ' ' + $err[0]
|
||||||
|
|
||||||
}
|
Write-Progress -Activity "Getting zebra features from $name" -Completed
|
||||||
#TONER
|
}
|
||||||
<#
|
'^lexmark' {
|
||||||
HP Maintenance Kit Cur: 1.3.6.1.2.1.43.11.1.1.9.1.2
|
Write-Progress -Activity "Getting lexmark features from $name" -Status 'Querying for name' -PercentComplete 50 -ParentId 2
|
||||||
HP Maintenance Kit Max: 1.3.6.1.2.1.43.11.1.1.8.1.2
|
try { $name = $snmp.Get('.1.3.6.1.4.1.641.1.5.7.6.0').toupper() } catch { $name = $null }
|
||||||
HP Toner Cur: 1.3.6.1.2.1.43.11.1.1.9.1.1
|
Write-Progress -Activity "Getting lexmark features from $name" -Completed
|
||||||
HP Toner Max: 1.3.6.1.2.1.43.11.1.1.8.1.1
|
}
|
||||||
#>
|
'^ricoh' {
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color' -PercentComplete 20 -ParentId 2
|
Write-Progress -Activity "Getting ricoh features from $name" -Status 'Querying for name' -PercentComplete 50 -ParentId 2
|
||||||
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.1') -split ' ')[0] } catch { $tonerColor = $null }
|
try { $name = $snmp.Get('.1.3.6.1.4.1.367.3.2.1.7.3.5.1.1.2.1.1').toupper() } catch { $name = $null }
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner level' -PercentComplete 25 -ParentId 2
|
Write-Progress -Activity "Getting ricoh features from $name" -Completed
|
||||||
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.1') } catch { $tonerLvl = $null }
|
}
|
||||||
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.1') } catch { $tonerMax = $null }
|
'^hp' {
|
||||||
try { $toner = $tonerLvl / $tonerMax } catch { $toner = $null }
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for name' -PercentComplete 5 -ParentId 2
|
||||||
[int]$toner = $toner * 100
|
try { $name = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.5.46.0').toupper() } catch { $name = $null }
|
||||||
$supplies = "$tonerColor" + ":$toner% "
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for status' -PercentComplete 10 -ParentId 2
|
||||||
if ($color -eq 'Yes') {
|
try { $status = $snmp.Get('.1.3.6.1.4.1.11.2.3.9.1.1.3.0') } catch { $status = $null }
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color levels' -PercentComplete 35 -ParentId 2
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for IP configuration' -PercentComplete 10 -ParentId 2
|
||||||
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') -split ' ')[0] } catch { $tonerColor = $null }
|
try { $ipconfig = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.5.1.0') } catch { $status = $null }
|
||||||
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.2') } catch { $tonerLvl = $null }
|
$ipconfig = switch ($ipconfig) {
|
||||||
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.2') } catch { $tonerMax = $null }
|
1 { '(manual)' } #manual-one
|
||||||
try { $toner = $tonerLvl / $tonerMax * 100 } catch { $toner = $null }
|
2 { '(bootp)' } #bootp-two
|
||||||
$supplies += "$tonerColor" + ":$toner% "
|
3 { '(manual)' } #manual-three
|
||||||
|
4 { '(bootp)' } #bootp-four
|
||||||
|
5 { '(dhcp)' } #dhcp
|
||||||
|
6 { '' } #not-configured
|
||||||
|
7 { '(default)' } #default-config
|
||||||
|
8 { '(rarp)' } #rarp
|
||||||
|
9 { '' } #read-only
|
||||||
|
10 { '(auto-ip)' } #auto-ip
|
||||||
|
}
|
||||||
|
if ($MAC -eq '') {
|
||||||
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for MAC Address' -PercentComplete 15 -ParentId 2
|
||||||
|
$pMAC = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.1.12.1.2.5')
|
||||||
|
$MAC = ($pMAC -split " ")[-1]
|
||||||
|
$MAC = ($MAC -replace '(..)', '$1:').trim(':')
|
||||||
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color levels' -PercentComplete 50 -ParentId 2
|
}
|
||||||
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.3') -split ' ')[0] } catch { $tonerColor = $null }
|
#TONER
|
||||||
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.3') } catch { $tonerLvl = $null }
|
<#
|
||||||
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.3') } catch { $tonerMax = $null }
|
HP Maintenance Kit Cur: 1.3.6.1.2.1.43.11.1.1.9.1.2
|
||||||
try { $toner = $tonerLvl / $tonerMax * 100 } catch { $toner = $null }
|
HP Maintenance Kit Max: 1.3.6.1.2.1.43.11.1.1.8.1.2
|
||||||
$supplies += "$tonerColor" + ":$toner% "
|
HP Toner Cur: 1.3.6.1.2.1.43.11.1.1.9.1.1
|
||||||
|
HP Toner Max: 1.3.6.1.2.1.43.11.1.1.8.1.1
|
||||||
|
#>
|
||||||
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color' -PercentComplete 20 -ParentId 2
|
||||||
|
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.1') -split ' ')[0] } catch { $tonerColor = $null }
|
||||||
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner level' -PercentComplete 25 -ParentId 2
|
||||||
|
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.1') } catch { $tonerLvl = $null }
|
||||||
|
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.1') } catch { $tonerMax = $null }
|
||||||
|
try { $toner = $tonerLvl / $tonerMax } catch { $toner = $null }
|
||||||
|
[int]$toner = $toner * 100
|
||||||
|
$supplies = "$tonerColor" + ":$toner% "
|
||||||
|
if ($color -eq 'Yes') {
|
||||||
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color levels' -PercentComplete 35 -ParentId 2
|
||||||
|
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') -split ' ')[0] } catch { $tonerColor = $null }
|
||||||
|
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.2') } catch { $tonerLvl = $null }
|
||||||
|
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.2') } catch { $tonerMax = $null }
|
||||||
|
try { $toner = $tonerLvl / $tonerMax * 100 } catch { $toner = $null }
|
||||||
|
$supplies += "$tonerColor" + ":$toner% "
|
||||||
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color levels' -PercentComplete 65 -ParentId 2
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color levels' -PercentComplete 50 -ParentId 2
|
||||||
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.4') -split ' ')[0] } catch { $tonerColor = $null }
|
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.3') -split ' ')[0] } catch { $tonerColor = $null }
|
||||||
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.4') } catch { $tonerLvl = $null }
|
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.3') } catch { $tonerLvl = $null }
|
||||||
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.4') } catch { $tonerMax = $null }
|
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.3') } catch { $tonerMax = $null }
|
||||||
try { $toner = $tonerLvl / $tonerMax * 100 } catch { $toner = $null }
|
try { $toner = $tonerLvl / $tonerMax * 100 } catch { $toner = $null }
|
||||||
$supplies += "$tonerColor" + ":$toner% "
|
$supplies += "$tonerColor" + ":$toner% "
|
||||||
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for maintenance kit status' -PercentComplete 80 -ParentId 2
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for toner color levels' -PercentComplete 65 -ParentId 2
|
||||||
try { $supplyName = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.6') -split ' ')[0] } catch { $tonerColor = $null }
|
try { $tonerColor = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.4') -split ' ')[0] } catch { $tonerColor = $null }
|
||||||
if ($supplyName -contains 'Fuser' -or $supplyName -contains 'Maint') {
|
try { $tonerLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.4') } catch { $tonerLvl = $null }
|
||||||
try { $supplyPartNumber = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.6') } catch { $supplyPartNumber = $null }
|
try { $tonerMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.4') } catch { $tonerMax = $null }
|
||||||
$supplyPartNumber -match '110V-(?<Name>.+), ' | Out-Null
|
try { $toner = $tonerLvl / $tonerMax * 100 } catch { $toner = $null }
|
||||||
$supplyPartNumber = $Matches.Name
|
$supplies += "$tonerColor" + ":$toner% "
|
||||||
try { $mainLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.6') } catch { $mainLvl = $null }
|
|
||||||
try { $mainMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.6') } catch { $mainMax = $null }
|
|
||||||
if ($mainMax -gt 1) {
|
|
||||||
try { $maintKit = $mainLvl / $mainMax } catch { $maintKit = $null }
|
|
||||||
[int]$maintKit = $maintKit * 100
|
|
||||||
|
|
||||||
if ($null -ne $maintKit) {
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for maintenance kit status' -PercentComplete 80 -ParentId 2
|
||||||
$supplies += "| $supplyName" + ":$maintKit%[$supplyPartNumber]"
|
try { $supplyName = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.6') -split ' ')[0] } catch { $tonerColor = $null }
|
||||||
}
|
if ($supplyName -contains 'Fuser' -or $supplyName -contains 'Maint') {
|
||||||
}
|
try { $supplyPartNumber = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.6') } catch { $supplyPartNumber = $null }
|
||||||
}
|
|
||||||
else {
|
|
||||||
try { $supplyName = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.5') -split ' ')[1] } catch { $tonerColor = $null }
|
|
||||||
try { $supplyPartNumber = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.5') } catch { $supplyPartNumber = $null }
|
|
||||||
$supplyPartNumber -match '110V-(?<Name>.+), ' | Out-Null
|
|
||||||
$supplyPartNumber = $Matches.Name
|
|
||||||
try { $mainLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.5') } catch { $mainLvl = $null }
|
|
||||||
try { $mainMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.5') } catch { $mainMax = $null }
|
|
||||||
if ($mainMax -gt 1) {
|
|
||||||
try { $maintKit = $mainLvl / $mainMax } catch { $maintKit = $null }
|
|
||||||
[int]$maintKit = $maintKit * 100
|
|
||||||
|
|
||||||
if ($null -ne $maintKit) {
|
|
||||||
$supplies += "| $supplyName" + ":$maintKit%[$supplyPartNumber]"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for maintenance kit status' -PercentComplete 80 -ParentId 2
|
|
||||||
try { $supplyName = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') -split ' ')[0] } catch { $supplyName = $null }
|
|
||||||
try { $supplyPartNumber = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') } catch { $supplyPartNumber = $null }
|
|
||||||
$supplyPartNumber -match '110V-(?<Name>.+), ' | Out-Null
|
$supplyPartNumber -match '110V-(?<Name>.+), ' | Out-Null
|
||||||
$supplyPartNumber = $Matches.Name
|
$supplyPartNumber = $Matches.Name
|
||||||
try { $mainLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.2') } catch { $mainLvl = $null }
|
try { $mainLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.6') } catch { $mainLvl = $null }
|
||||||
try { $mainMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.2') } catch { $mainMax = $null }
|
try { $mainMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.6') } catch { $mainMax = $null }
|
||||||
if ($mainMax -gt 1) {
|
if ($mainMax -gt 1) {
|
||||||
try { $maintKit = $mainLvl / $mainMax } catch { $maintKit = $null }
|
try { $maintKit = $mainLvl / $mainMax } catch { $maintKit = $null }
|
||||||
[int]$maintKit = $maintKit * 100
|
[int]$maintKit = $maintKit * 100
|
||||||
|
|
@ -320,107 +323,99 @@ function Get-SHSPrinter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
try { $supplyName = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.5') -split ' ')[1] } catch { $tonerColor = $null }
|
||||||
|
try { $supplyPartNumber = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.5') } catch { $supplyPartNumber = $null }
|
||||||
|
$supplyPartNumber -match '110V-(?<Name>.+), ' | Out-Null
|
||||||
|
$supplyPartNumber = $Matches.Name
|
||||||
|
try { $mainLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.5') } catch { $mainLvl = $null }
|
||||||
|
try { $mainMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.5') } catch { $mainMax = $null }
|
||||||
|
if ($mainMax -gt 1) {
|
||||||
|
try { $maintKit = $mainLvl / $mainMax } catch { $maintKit = $null }
|
||||||
|
[int]$maintKit = $maintKit * 100
|
||||||
|
|
||||||
Write-Progress -Activity "Getting hp features from $name" -Completed
|
if ($null -ne $maintKit) {
|
||||||
|
$supplies += "| $supplyName" + ":$maintKit%[$supplyPartNumber]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
||||||
'^muratec' {
|
|
||||||
Write-Progress -Activity "Getting muratec features from $name" -Status 'Querying for name' -PercentComplete 30 -ParentId 2
|
|
||||||
try { $name = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.5.46.0').toupper() } catch { $name = $null }
|
|
||||||
Write-Progress -Activity "Getting muratec features from $name" -Status 'Querying for status' -PercentComplete 60 -ParentId 2
|
|
||||||
try { $status = $snmp.Get('.1.3.6.1.2.1.43.16.5.1.2.1.1') } catch { $status = $null }
|
|
||||||
# Start of MAC
|
|
||||||
Write-Progress -Activity "Getting muratec features from $name" -Status 'Querying for MAC address' -PercentComplete 90 -ParentId 2
|
|
||||||
$pMAC = $SNMP.get('.1.3.6.1.4.1.4322.101.1.2.1.5.2.1.1.3.1')
|
|
||||||
Write-Host $pMAC
|
|
||||||
$MAC = [System.Text.Encoding]::Default.GetBytes($PMac) | ForEach-Object {
|
|
||||||
$_.ToString('X2')
|
|
||||||
}
|
}
|
||||||
$MAC = $MAC -join ':'
|
|
||||||
#End of MAC
|
|
||||||
Write-Progress -Activity "Getting muratec features from $name" -Completed
|
|
||||||
}
|
}
|
||||||
default {
|
else {
|
||||||
|
Write-Progress -Activity "Getting hp features from $name" -Status 'Querying for maintenance kit status' -PercentComplete 80 -ParentId 2
|
||||||
|
try { $supplyName = ($snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') -split ' ')[0] } catch { $supplyName = $null }
|
||||||
|
try { $supplyPartNumber = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.6.1.2') } catch { $supplyPartNumber = $null }
|
||||||
|
$supplyPartNumber -match '110V-(?<Name>.+), ' | Out-Null
|
||||||
|
$supplyPartNumber = $Matches.Name
|
||||||
|
try { $mainLvl = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.9.1.2') } catch { $mainLvl = $null }
|
||||||
|
try { $mainMax = $snmp.Get('.1.3.6.1.2.1.43.11.1.1.8.1.2') } catch { $mainMax = $null }
|
||||||
|
if ($mainMax -gt 1) {
|
||||||
|
try { $maintKit = $mainLvl / $mainMax } catch { $maintKit = $null }
|
||||||
|
[int]$maintKit = $maintKit * 100
|
||||||
|
|
||||||
|
if ($null -ne $maintKit) {
|
||||||
|
$supplies += "| $supplyName" + ":$maintKit%[$supplyPartNumber]"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}#end switch -Regex ($model)
|
|
||||||
#if ($model -like 'SHARP*') {}
|
|
||||||
|
|
||||||
}#end if ($model)
|
Write-Progress -Activity "Getting hp features from $name" -Completed
|
||||||
}
|
|
||||||
else {
|
|
||||||
$status = "Offline"
|
|
||||||
$MAC = $CMDB_MAC
|
|
||||||
$model = $CMDB_model
|
|
||||||
$serial = $CMDB_serial
|
|
||||||
$color = "Offline"
|
|
||||||
$trays = "Offline"
|
|
||||||
$pagecount = "Offline"
|
|
||||||
}
|
|
||||||
|
|
||||||
$props = [Ordered]@{
|
}
|
||||||
Machine = $printer
|
'^muratec' {
|
||||||
Status = $status
|
Write-Progress -Activity "Getting muratec features from $name" -Status 'Querying for name' -PercentComplete 30 -ParentId 2
|
||||||
IP = "$printerip $ipconfig"
|
try { $name = $snmp.Get('.1.3.6.1.4.1.11.2.4.3.5.46.0').toupper() } catch { $name = $null }
|
||||||
DomainName = $domainName
|
Write-Progress -Activity "Getting muratec features from $name" -Status 'Querying for status' -PercentComplete 60 -ParentId 2
|
||||||
MAC = $MAC
|
try { $status = $snmp.Get('.1.3.6.1.2.1.43.16.5.1.2.1.1') } catch { $status = $null }
|
||||||
Model = $model
|
# Start of MAC
|
||||||
Serial = $serial
|
Write-Progress -Activity "Getting muratec features from $name" -Status 'Querying for MAC address' -PercentComplete 90 -ParentId 2
|
||||||
#Comment = $comment
|
$pMAC = $SNMP.get('.1.3.6.1.4.1.4322.101.1.2.1.5.2.1.1.3.1')
|
||||||
Color = $color
|
Write-Host $pMAC
|
||||||
Trays = $trays
|
$MAC = [System.Text.Encoding]::Default.GetBytes($PMac) | ForEach-Object {
|
||||||
#Features = $features
|
$_.ToString('X2')
|
||||||
#SystemDescription = $sysdescr0
|
}
|
||||||
#Addresses = $addr
|
$MAC = $MAC -join ':'
|
||||||
PageCount = $pagecount
|
#End of MAC
|
||||||
Supplies = $supplies
|
Write-Progress -Activity "Getting muratec features from $name" -Completed
|
||||||
'CMDB POA' = $CMDB_POA
|
}
|
||||||
'CMDB AssetTag' = $CMDB_AssetTag
|
default {
|
||||||
'CMDB Location' = $CMDB_Location
|
|
||||||
}
|
}
|
||||||
$obj = New-Object -TypeName PSObject -Property $props
|
}#end switch -Regex ($model)
|
||||||
$snmp.close()
|
#if ($model -like 'SHARP*') {}
|
||||||
Write-Progress -Activity "Getting printer details for $name" -Completed
|
|
||||||
return $obj
|
}#end if ($model)
|
||||||
}#end if ($printerIp)
|
|
||||||
if ($CMDB_IP) {
|
|
||||||
$offlineIP = 'CMDB IP - ' + $CMDB_IP
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$offlineIP = 'No DNS Entry'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$props = [Ordered]@{
|
$props = [Ordered]@{
|
||||||
Machine = $printer
|
Machine = $printer
|
||||||
Status = 'No DNS Entry'
|
Status = $status
|
||||||
IP = $offlineIP
|
IP = "$printerip $ipconfig"
|
||||||
DomainName = 'No DNS Entry'
|
DomainName = $domainName
|
||||||
MAC = $CMDB_MAC
|
MAC = $MAC
|
||||||
Model = $CMDB_model
|
Model = $model
|
||||||
Serial = $CMDB_serial
|
Serial = $serial
|
||||||
#Comment = $comment
|
#Comment = $comment
|
||||||
Color = 'No DNS Entry'
|
Color = $color
|
||||||
Trays = 'No DNS Entry'
|
Trays = $trays
|
||||||
PageCount = 'No DNS Entry'
|
#Features = $features
|
||||||
|
#SystemDescription = $sysdescr0
|
||||||
|
#Addresses = $addr
|
||||||
|
PageCount = $pagecount
|
||||||
|
Supplies = $supplies
|
||||||
'CMDB POA' = $CMDB_POA
|
'CMDB POA' = $CMDB_POA
|
||||||
'CMDB AssetTag' = $CMDB_AssetTag
|
'CMDB AssetTag' = $CMDB_AssetTag
|
||||||
'CMDB Location' = $CMDB_Location
|
'CMDB Location' = $CMDB_Location
|
||||||
|
'CMDB Status' = $CMDB_Status
|
||||||
}
|
}
|
||||||
$obj = New-Object -TypeName PSObject -Property $props
|
$obj = New-Object -TypeName PSObject -Property $props
|
||||||
$snmp.close()
|
$snmp.close()
|
||||||
|
Write-Progress -Activity "Getting printer details for $name" -Completed
|
||||||
return $obj
|
return $obj
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function Get-PrinterIP {
|
|
||||||
|
|
||||||
param (
|
|
||||||
[parameter(ValueFromPipeline)]
|
|
||||||
[string]$printer
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function Start-SHSPrinterWeb {
|
function Start-SHSPrinterWeb {
|
||||||
param(
|
param(
|
||||||
$printer
|
$printer
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue