mirror of
https://github.com/hmalik144/PowerShell-contract.git
synced 2025-12-10 03:05:33 +00:00
Create Wireless printer click script.ps1
This commit is contained in:
21
Wireless printer click script.ps1
Normal file
21
Wireless printer click script.ps1
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
$printerName = "HP_Wireless_Printer"
|
||||||
|
$printerInfPath = "Private\LAN\Drivers\Printers\Hp\UPD\PCL5_v5.5\x64\hpcu130t.inf"
|
||||||
|
$printDriverName = "HP Color LaserJet Enterprise Flow MFP M577z"
|
||||||
|
$printerIP = "169.254.228.56"
|
||||||
|
|
||||||
|
|
||||||
|
$portExists = Get-Printerport -Name $printerName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if (-not $portExists) {
|
||||||
|
Add-PrinterPort -name $printerName -PrinterHostAddress $printerIP
|
||||||
|
}
|
||||||
|
|
||||||
|
$printDriverExists = Get-PrinterDriver -name $printDriverName -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
if (-not $printDriverExists) {
|
||||||
|
Add-PrinterDriver -Name $printDriverName -InfPath $printerInfPath
|
||||||
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Add-Printer -Name "HP Wireless Printer" -PortName $printerName -DriverName $printDriverName
|
||||||
Reference in New Issue
Block a user