RunAs in XP
I have a simple form that allows users to install a local printer. The problem is that without admin rights they cannot install printers while on travel. Since I am new to VB I am seeing if there is an easy way to grant a user temp admin rights but have the admin name and password already coded and passed to RUNAS.
Below is the line I have that will run the Add Printer Wizard but am stuck at this point.
Call Shell("runas /user:%computername%\%name% rundll32.exe printui.dll,PrintUIEntry /il", vbNormalFocus)
Any help on this would be great.
Joe
[587 byte] By [
jastoto] at [2007-11-11 8:01:55]

# 1 Re: RunAs in XP
Try:
Call Shell("runas /user:" & computername & "\" & adminuser & "rundll32.exe printui.dll,PrintUIEntry /il", vbNormalFocus)
where computername and adminuser are string variables containing the computer name and admin user name.
# 3 Re: RunAs in XP
runas /savecred /user:domain\username program
Using the /savecred variable is extremely handy. The administrator only needs to run this command once before to save the information to the computer. Another way is to string vbscript code that allows text to be inputted everytime the script is run. Such as the admin username and password. I read about it earlier today. Try out http://www.ericphelps.com. This guy has some experience and advice to share. Not to mention scripts and other goodies.
Enjoy!
Ken
# 4 Re: RunAs in XP
Hi kennyrogersjr,
We have used the sme thing at our work but the problem is everytime the administrator changes their password the security token generated by the saved credentials is invalidated (and this happened every month !!!)
We did find another way though. Have a look at Remote Control at www.laek.com
This is an application specifically tailored to this kind of problem.