Jump to content
Sign in to follow this  
sinsilenc

remote printer install via psexec

Recommended Posts

Ok guys this is something i put together to install printers on a network using psexec for if you dont have a print server.

"Script to setup printers by remote by net admins using psexec
$username = InputBox( "Username", "Your username", "", "*")
$password = inputbox( "Password", "Your Password", "", "*")
$computername = inputbox ("Computer Name", "The name of the computer you want to install the printer to", "", "*")
$psexec = "\\ppxppghbo2\d$\isstech\luken\psexec.exe"
"location of your psexec on the network for users to copy"
$printer = ' rundll32 printui.dll,PrintUIEntry /if /b "HP CP4700DTN 10.30.124.31" /f "\\ppxppghbo2\d$\isstech\luken\hp4700\hpc4700c.inf" /r "IP_10.30.112.60" /m "HP Color LaserJet 4700 PCL 6"'
"this is the run dll to install the printer. in this you need to modify after /f where the inf file for your printer driver is. /r is the ip for the printer /m is the exact driver name and if you "
"install it manually on the machine it will be listed on the advanced page under driver"
FileCopy( $psexec, @SystemDir, 1)
ShellExecute("c:\windows\system32\psexec.exe","-d \\"&$computername&" "&"-u domain\"&$username&" "&"-p "&$password&" cscript c:\windows\system32\prnport.vbs -a -r IP_10.30.124.31 -h 10.30.124.31 -o raw -n 9100","","open",@sw_hide)
"this line set's up the ip address on the local machine you need to change domain name to match yours, you also need to change the ip after the -r and -h to what the static ip is on the printer"
ShellExecute("c:\windows\system32\psexec.exe","-d \\"&$computername&" "&"-u domain\"&$username&" "&"-p "&$password&$printer,"","open",@sw_hide)
"this line executes $printer all you need to change is the domain name"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...