Hello I have created a basic script for installing some printers see below
Dim multiPrinter, UNCpath1, UNCpath2
UNCpath1 = "\\server\printer1"
UNCpath2 = "\\server\printer2"
Set multiPrinter = CreateObject("WScript.Network")
multiPrinter.AddWindowsPrinterConnection UNCpath1
multiPrinter.AddWindowsPrinterConnection UNCpath2
WScript.Quit
This works fine for those with admin rights but doesn’t run well with those without.
I read that runas doesn’t work in srpits and found a vbs to exe convertor then tried this script below. Which I had edited from one found on microsoft’s website.
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run "runas /useromain\User" 'Open command prompt
WScript.Sleep 1000
WshShell.SendKeys "password" 'send password
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
'Run Copiers
WshShell.SendKeys "D:\copiers.EXE"
WshShell.SendKeys "{ENTER}"
set wshshell = nothing
This doesn’t work.
Can someone help by pointing out my failings or if there is another way to do the script as runas please.
I cant use ad or gpo for it and I want the users to run from their machine when able.
I have also got the vbs to vbe convertor to make the file secure.
It will run from a shared folder on the server.
Many thanks
Darren
Dim multiPrinter, UNCpath1, UNCpath2
UNCpath1 = "\\server\printer1"
UNCpath2 = "\\server\printer2"
Set multiPrinter = CreateObject("WScript.Network")
multiPrinter.AddWindowsPrinterConnection UNCpath1
multiPrinter.AddWindowsPrinterConnection UNCpath2
WScript.Quit
This works fine for those with admin rights but doesn’t run well with those without.
I read that runas doesn’t work in srpits and found a vbs to exe convertor then tried this script below. Which I had edited from one found on microsoft’s website.
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.run "runas /useromain\User" 'Open command prompt
WScript.Sleep 1000
WshShell.SendKeys "password" 'send password
WshShell.SendKeys "{ENTER}"
WScript.Sleep 1000
'Run Copiers
WshShell.SendKeys "D:\copiers.EXE"
WshShell.SendKeys "{ENTER}"
set wshshell = nothing
This doesn’t work.
Can someone help by pointing out my failings or if there is another way to do the script as runas please.
I cant use ad or gpo for it and I want the users to run from their machine when able.
I have also got the vbs to vbe convertor to make the file secure.
It will run from a shared folder on the server.
Many thanks
Darren