General help and info provided by Helewix.com Consultants

« Set Local Admin Password using .vbs (VB Script) and GPOLogon VB Script to Create folder with shortcuts on Users Desktop and File Server »

Manage Local Groups using VBS

10/08/10 | by HendrikWiese - Helewix.com Consultant [mail] | Categories: Scripting

Remove Domain user from Local Administrators Group

You will just need to change YOURDOMAIN in the code below and then it will remove the current logged in domain user from the local administrators group.

Set WshS = WScript.CreateObject("WScript.Shell")

strComputer = WshS.ExpandEnvironmentStrings("%computername%")
strUser = WshS.ExpandEnvironmentStrings("%UserName%")
strDomain = "YOURDOMAIN"

Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUser & ",user")

objGroup.Remove(objUser.ADsPath)

Please leave comments and let me know what you think of this code.

Plutus Hosting - Quality and Affordable Website and Email Hosting

Property Pimp

Permalink

No feedback yet

General help and info provided by Helewix.com Consultants
May 2013
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Blogger Rating

Ads

Plutus Hosting - Quality and Affordable Website and Email Hosting
usafis
Loanfinder SA
AreYouInterested

WiCount

Listing4me

MarisIT

Search

Flag Counter

free counters

XML Feeds

powered by b2evolution