user3416223
user3416223

Reputation: 1

How to make vbscript run as local administrator

I'm very new to VBscript I'm at work under a domain. I want to be able to install printers on every users machine by having them run this script. But the users don't have the credentials to run script.

Is there a way for me to add log in credentials in the VBscript

set objNetwork = Createobject("WScript.Network")
'objNetwork.AddwindowsPrinterConnection "\\print-serv\HP LaserJet 4350 PCL 5 it"
objNetwork.AddwindowsPrinterConnection "\\print-serv\uniFlow Secure Print"
'objNetwork.AddwindowsPrinterConnection "\\print-serv\Brother HL-4570CDW color"
wscript.echo "Printers have been Mapped

Upvotes: 0

Views: 871

Answers (1)

Nathan Rice
Nathan Rice

Reputation: 3111

You can use PSExec to execute your script remotely.

http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

You'll be able to pass the computer name, or a list of computers in a text file, and the credentials you'd like to run your script as. Something like this:

psexec \\computer1 -u admin -p password c:\windows\system32\cscript.exe \\computer2\share\yourscript.vbs

Upvotes: 3

Related Questions