TropicalPriest
asked on
Running VBscript as a local admin
I'm trying to have this vbscript run as a admin account that is local to every machine on our network. "!Admin". How do i get this to work without having to put the specific local hostname of each machine and where would i have the password in the script for the admin account not to prompt?
RemoveVirtScroll.vbs
RemoveVirtScroll.vbs
Will the script be run by users who do not have admin rights or will it be run by a background service of the software distribution system?
ASKER
the script will be run remotely through a Kaseya server. No user interaction.
If the script is configuring something that is NOT part of a user profile, you can configure it as a "System Startup" script to get admin rights.
In Group Policy Editor this is under "Computer Configuration > Windows Settings > Scripts (Startup/Shutdown) > Startup"
A reboot will be required to run the script.
In Group Policy Editor this is under "Computer Configuration > Windows Settings > Scripts (Startup/Shutdown) > Startup"
A reboot will be required to run the script.
I am not familiar with Kaseya server - but most likely it runs your scripts using a background process that already has admin rights.
Services under Windows 7 DO NOT HAVE UAC even when UAC is enabled.
In otherwords services with admin rights work just like they did on XP.
This is called an "unfiltered token."
If, however, Kaseya is actually running the script silent, but under the logged in user's non-admin profile - that is a completely different problem and I can propose some solutions for it as well.
Services under Windows 7 DO NOT HAVE UAC even when UAC is enabled.
In otherwords services with admin rights work just like they did on XP.
This is called an "unfiltered token."
If, however, Kaseya is actually running the script silent, but under the logged in user's non-admin profile - that is a completely different problem and I can propose some solutions for it as well.
Forgot to mention - if you are sending it through a background service, the best way to test what your script (or any program for that matter) will do in regard to UAC is to run it in an elevated command prompt. If you get no UAC prompt there, then you have a 99.999% chance you won't get one running under a service that is logged in as SYSTEM or any account with local admin.
ASKER
i need something like this,
Set objShell = CreateObject("WScript.Shel l")
WshShell.Run """%systemroot%\system32\r unas.exe"" /user:(domian here)\testtaker-team ""%programfiles(x86)%\test tkr\testtk r.exe""", 1, false
objShell.Exec("rundll32.ex e ""C:\Program Files\Lenovo\VIRTSCRL\clea nup.dll"", InfUninsta ll DefaultUninstall.LH 132 C:\Program Files\Lenovo\VIRTSCRL\tpdu _vs.inf")
The second part is the command i want to run. That part works when i run it as my domain admin account locally. the first part is a run as domain account example but i don't know how to change that to reflect the use of a local admin account then run the second line.
Set objShell = CreateObject("WScript.Shel
WshShell.Run """%systemroot%\system32\r
objShell.Exec("rundll32.ex
The second part is the command i want to run. That part works when i run it as my domain admin account locally. the first part is a run as domain account example but i don't know how to change that to reflect the use of a local admin account then run the second line.
Should be:
Set objShell = CreateObject("WScript.Shel l")
WshShell.Run """%systemroot%\system32\r unas.exe"" /user:(domian here)\testtaker-team "rundll32.exe ""C:\Program Files\Lenovo\VIRTSCRL\clea nup.dll"", InfUninsta ll DefaultUninstall.LH 132 ""C:\Program Files\Lenovo\VIRTSCRL\tpdu _vs.inf"" ", 1, false
Set objShell = CreateObject("WScript.Shel
WshShell.Run """%systemroot%\system32\r
ASKER
So Admin account is called "!Admin" how do i set it to use that account?
/user:localhost\!Admin?
When using these scripts there is now need to put the password for the specified account anywhere in the script?
/user:localhost\!Admin?
When using these scripts there is now need to put the password for the specified account anywhere in the script?
ASKER
I've been trying the following and i've had no luck.
Set objShell = CreateObject("WScript.Shel l")
WshShell.Run """%systemroot%\system32\r unas.exe"" /user:teamschools\!Admin "rundll32.exe ""C:\Program Files\Lenovo\VIRTSCRL\clea nup.dll"", InfUninsta ll DefaultUninstall.LH 132 ""C:\Program Files\Lenovo\VIRTSCRL\tpdu _vs.inf"" ", 1, false
Set objShell = CreateObject("WScript.Shel
WshShell.Run """%systemroot%\system32\r
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If the group of machines is small enough to do manually from your desk, you could also use psexec to remotely execute commands with admin.
http://live.sysinternals.com/psexec.exe
http://live.sysinternals.com/psexec.exe