Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NT 4.0 WKS vbscript for non-admin users.

Status
Not open for further replies.

Bcolvin

Technical User
Sep 23, 2003
10
0
0
Noobie alert!

Okay, we're running in a mix environment of NT4.0 and W2k Pro. Users have very limited permissions locally. My vbscript attempts to make edits to the registry at login (map drives, printers, wallpaper, etc.).

It works fine for the W2K systems (non-admin users) but the same script (on the NT 4.0 Workstations) will not allow the changes to the registry (for non-admin users).

I've added the following lines to the script hoping that it will add Domain Accounts to the local administrators group:

UserString = WshNetwork.UserName
Set oShell = CreateObject("WScript.Shell")
oShell.Run "CMD.EXE /C net localgroup administrators /add DOMAIN_NAME\"+ UserString

but that doesn't work either.

How can I either

1. Run the script as admin in order to write to the registry?
2. Add Domain users to local administrators group and then execute script? (NOTE: I've seen other postings about this but that would only add a local account and not the domain account)

Any help would be appreciated.
 
Hello Bcolvin,

Something like this.
Code:
set oUser=getobject("WinNT://Domain/username,user")
set oLocAdm=getobject("WinNT://Computer/Administrators,group")
if not oLocAdm.IsMember(oUser.AdsPath) then
    oLocAdm.add oUser.AdsPath
end if
set oLocAdm=nothing : set oUser=nothing
regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top