Main Topics
Browse All TopicsHi everyone!
On our network we have some logon scripts that set certain registry values and run certain commands on each machine. In order to get these to work each user has to be setup as a local administrator on that machine.
The problem is that having each user as a local admin allows them unrestricted access to install applications and all kinds of other stuff.
What I would like to know is if it is possible to setup the users as standard users but give them the elevated privelages to allow the changes made by the login scripts!?
Does that make sense!?
Danny
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Try using something like: http://www.microsoft.com/t
-rich
Also, since it's not well documented anywhere in the encoder, or on MS's site (from my breif serach) here is a fine example of what to do:
.vbe tells the os that the VBS script has been encoded (remember encoded, is not encrypted, it's not a great form of security- but it's better than plain-text)
to run an encoded vbs file:
cscript encoded-file.vbe
below is "encoded-file.vbs" (a simple VBscript to show what user is running winword process)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Winword.exe'")
For Each objProcess in colProcessList
objProcess.GetOwner strUserName, strUserDomain
Wscript.Echo "Process " & objProcess.Name & " is owned by " _
& strUserDomain & "\" & strUserName & "."
Next
and to encrypt it type:
screnc /l vbscript encoded-file.vbs encoded-file.vbe
open word, and run the encrypted script
cscript encoded-file.vbe
should return:
Process WINWORD.EXE is owned by domainX\userX
(domainX and userX will be the person running winword)
-rich
hmm... from the documentation on the page they state"One important note: this approach, in which you run a script under alternate credentials, works only on remote machines. For some reason, WMI won't let you run a script under alternate credentials on your own computer. Go figure."
But the ADSI seems to be better for this "By the way, OpenDSObject also works with local user accounts; the primary difference is that you bind to WinNT provider instead of the LDAP provider"
here is another runas script I've used:
'Start of Script
'VBRUNAS.VBS
'v1.2 March 2001
'Jeffery Hicks
'jhicks@quilogy.com http://www.quilogy.com
'USAGE: cscript|wscript VBRUNAS.VBS Username Password Command
'DESC: A RUNAS replacement to take password at a command prompt.
'NOTES: This is meant to be used for local access. If you want to run a command 'across the network as another user, you must add the /NETONLY switch to the RUNAS 'command.
' **************************
' * THIS PROGRAM IS OFFERED AS IS AND MAY BE FREELY MODIFIED OR ALTERED AS * ' * NECESSARY TO MEET YOUR NEEDS. THE AUTHOR MAKES NO GUARANTEES OR WARRANTIES, * ' * EXPRESS, IMPLIED OR OF ANY OTHER KIND TO THIS CODE OR ANY USER MODIFICATIONS. * ' * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED IN A SECURED LAB * ' * ENVIRONMENT. USE AT YOUR OWN RISK. * ' **************************
On Error Resume Next
dim WshShell,oArgs,FSO
set oArgs=wscript.Arguments
if InStr(oArgs(0),"?")<>0 then
wscript.echo VBCRLF & "? HELP ?" & VBCRLF Usage end if
if oArgs.Count <3 then
wscript.echo VBCRLF & "! Usage Error !" & VBCRLF Usage end if
sUser=oArgs(0)
sPass=oArgs(1)&VBCRLF
sCmd=oArgs(2)
set WshShell = CreateObject("WScript.Shel
set FSO = CreateObject("Scripting.Fi
if FSO.FileExists(winpath) then
'wscript.echo winpath & " " & "verified"
else
wscript.echo "!! ERROR !!" & VBCRLF & "Can't find or verify " & winpath &"." & VBCRLF & "You must be running Windows 2000 for this script to work."
set WshShell=Nothing
set WshEnv=Nothing
set oArgs=Nothing
set FSO=Nothing
wscript.quit
end if
rc=WshShell.Run("runas /user:" & sUser & " " & CHR(34) & sCmd & CHR(34), 2, FALSE) Wscript.Sleep 30 'need to give time for window to open.
WshShell.AppActivate(WinPa
set WshShell=Nothing
set oArgs=Nothing
set WshEnv=Nothing
set FSO=Nothing
wscript.quit
'************************
'* Usage Subroutine *
'************************
Sub Usage()
On Error Resume Next
msg="Usage: cscript|wscript vbrunas.vbs Username Password Command" & VBCRLF & VBCRLF & "You should use the full path where necessary and put long file names or commands" & VBCRLF & "with parameters in quotes" & VBCRLF & VBCRLF &"For example:" & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog e:\scripts\admin.vbs" & VBCRLF & VBCRLF &" cscript vbrunas.vbs quilogy\jhicks luckydog " & CHR(34) &"e:\program files\scripts\admin.vbs 1stParameter 2ndParameter" & CHR(34)& VBCRLF & VBCRLF & VBCLRF & "cscript vbrunas.vbs /?|-? will display this message."
wscript.echo msg
wscript.quit
end sub
'End of Script
I've not modified it look for the password in the script... i'll work on it see if I can get it done. But if you use the first example, and put in a user/pass for an account that has Admin priv's on a machine, your reg files should work also... give it a try
-rich
Rich, that looks like it will be pretty much exactly what I need.
When you say try the first script I take it you mean the one below giving strUsername and strUserDomain a proper value?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'Winword.exe'")
For Each objProcess in colProcessList
objProcess.GetOwner strUserName, strUserDomain
Wscript.Echo "Process " & objProcess.Name & " is owned by " _
& strUserDomain & "\" & strUserName & "."
Next
Cheers,
Danny
Here is one I got going today... it uses Runas itself, and then uses sendkeys to send the password to runas... works well on local pc's
Option explicit
dim oShell
set oShell= Wscript.CreateObject("WScr
' Replace the path with the program you wish to run c:\ etc...
oShell.Run "runas /noprofile /user:administrator ""C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EX
WScript.Sleep 100
'Replace the string yourpassword~ below with
'the password used on your system. Include tilde
oShell.Sendkeys "yourpassword~"
Wscript.Quit
Work's very well.
-rich
Business Accounts
Answer for Membership
by: NJComputerNetworksPosted on 2005-01-06 at 06:20:14ID: 12972144
You can try to use a GPO to modify the registry rather then a logon script.
echnet/pro dtechnol/ w indowsserv er2003/tec hnologies/ management /gp/admtgp .mspx
http://www.microsoft.com/t