function ScanToEmail { param ( [string]$printer ) $DNSServers = @{ 'Sam Square/Walnut' = @{ 'Primary' = '10.98.2.45' 'Secondary' = '10.98.2.74' } 'AGH' = @{ 'Primary' = '10.10.15.11' 'Secondary' = '10.30.15.18' } 'SPCH' = @{ 'Primary' = '10.50.15.25' 'Secondary' = '10.60.15.14' } 'GSRMC' = @{ 'Primary' = '10.20.15.16' 'Secondary' = '10.98.2.74' } 'SLCH' = @{ 'Primary' = '10.30.15.18' 'Secondary' = '10.10.15.11' } 'SNLH' = @{ 'Primary' = '10.60.15.14' 'Secondary' = '10.50.15.25' } } <# Typically SNMP is set to read-only on most printers so we'll have to replicate web requests. There isn't really a standard so this support will have to be added for each new scheme. We can determine which scheme to use based on the model number #> $snmp = New-Object -ComObject olePrn.OleSNMP $printerip = (Resolve-DnsName $printer).IPAddress $snmp.open($printerip, 'public', 2, 3000) try { $model = $snmp.Get('.1.3.6.1.2.1.25.3.2.1.3.1') } catch { $model = $null } switch -Regex ($model) { '^HP LaserJet Pro M404n' { $function:ScanToEmailHPLJM400} } }