Printer Purge almost ready to be tested
This commit is contained in:
parent
dbc803b1cc
commit
433d89c8b9
18
Private/PrinterPurge.ps1
Normal file
18
Private/PrinterPurge.ps1
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Removes printer from all online computers. Useful when printer drivers
|
||||
# change to force users to install new drivers
|
||||
function Invoke-PrinterPurge ($printer) {
|
||||
$comps = HostnamesByPrinter($printer)
|
||||
# confirm step?
|
||||
for ($i = 0; $i -lt $comps.Length; $i += 1) {
|
||||
$comp = $comps[$i]
|
||||
Write-Progress -Activity "Dispatching Remove-Printer Jobs for $printer" -PercentComplete (100*$i / $comps.Length) -CurrentOperation $comp
|
||||
if ($comp -like "*EPIC*") { continue }
|
||||
if (-not (Test-Connection $comp -Count 1)) {
|
||||
Write-Output "$printer | $comp Offline"
|
||||
continue
|
||||
}
|
||||
# Remove-Printer $printer -ComputerName $comp -AsJob
|
||||
Write-Output "$printer | $comp Job Sent"
|
||||
}
|
||||
Write-Progress -Activity "Dispatching Remove-Printer Jobs for $printer" -Completed
|
||||
}
|
||||
|
|
@ -56,6 +56,7 @@ Function Get-PC {
|
|||
-RequestLauncher | starts request launcher
|
||||
-ResetRepository | remotely resets repository
|
||||
-Resources | more details about system resources
|
||||
-PrinterPurge | removes printer from all online computers
|
||||
-SCCM | queries sccm for the computer information
|
||||
-SHSPrinter | pulls data about a printer using snmp
|
||||
-SHSPrinterweb | pulls data about a printer and opens web interface and orion
|
||||
|
|
@ -105,6 +106,7 @@ Function Get-PC {
|
|||
[Switch]$RequestLauncher,
|
||||
[Switch]$Resources,
|
||||
[Switch]$ResetRepository,
|
||||
[Switch]$PrinterPurge,
|
||||
[Switch]$SCCM,
|
||||
[Switch]$SHSPrinter,
|
||||
[switch]$SHSPrinterWeb,
|
||||
|
|
@ -293,6 +295,11 @@ Function Get-PC {
|
|||
}
|
||||
break
|
||||
}
|
||||
|
||||
if ($PrinterPurge) {
|
||||
Invoke-PrinterPurge $comp
|
||||
continue
|
||||
}
|
||||
|
||||
#Launches the request launcher script which containts landesk request template scripts
|
||||
if ($RequestLauncher) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue