Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Installing Printer on Remote Computers Using Script

$
0
0

Dear Scripting Guy,

Good Day,

I have prepared below script for local printer installation that are connected to Network having an IP address.

Is it possible to modify this script and make it as to install printers on remote coimputers. My requirement is that if i run this script on my laptop then it will ask me for a Remote ComputerName and after putting the remote computerName the printer gets installed there.

Write-Host "Develop Ineo 363 Printer Installation Initilizing !!"

switch ([system.environment]::OSVersion.Version.Major) {

    5 {$PrnVBSDir = "$env:windir\system32"}
    6 {$PrnVBSDir = "$env:windir\System32\Printing_Admin_Scripts\en-US\"}
}

################################################################################
################# Installing the printer driver ################################
################################################################################
if ([System.IntPtr]::Size -eq 4)
 { 	
    Start-Process"RunDll32" -ArgumentList 'printui.dll PrintUIEntry /ia /m "Generic 42BW-4SeriesPCL" /h "x86" /v "Type 3 - User Mode" /f "\\helpdesk-pc\Drivers\Drivers\Printers\Develop 28BW-4\Driver CD-ROM\Driver\Drivers\PCL\EN\Win_x86\KOAYXJA_.inf"' -Wait
	Write-Host "x86 Printer Driver deployment finished !!" -ForegroundColor Green
 }

 else 
 { 	
    Start-Process "RunDll32" -ArgumentList 'printui.dll PrintUIEntry /ia /m "Generic 42BW-4SeriesPCL" /h "x64" /v "Type 3 - User Mode" /f "\\helpdesk-pc\Drivers\Drivers\Printers\Develop 28BW-4\Driver CD-ROM\Driver\Drivers\PCL\EN\Win_x64\KOAYXJA_.inf"' -Wait
	Write-Host "x64 Printer Driver deployment finished !!" -ForegroundColor Green 
 }
######################################################################
################## Create the printer port ###########################
######################################################################

$Port = ([wmiclass]"win32_tcpipprinterport").createinstance()

$Port.Name = "Develop-HR"
$Port.HostAddress = "192.168.24.20"
$Port.Protocol = "1"
$Port.PortNumber = "9100"
$Port.SNMPEnabled = $false
$Port.Description = "HR Develop Printer"

$Port.Put()

######################################################################
################# Installing The Printer #############################
######################################################################

$Printer = ([wmiclass]"win32_Printer").createinstance()

$Printer.Name = "Develop-HR"
$Printer.DriverName = "Generic 42BW-4SeriesPCL"
$Printer.DeviceID = "Develop-HR"
$Printer.Shared = $false
$Printer.PortName = "Develop-HR"
$Printer.Location = "HR Department"
$Printer.Comment = "Printer + Photocopier + Scanner"

$Printer.Put()

######################################################################
############################# END ####################################
######################################################################

Thank You

Regards

Abdul Wajid


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>