Option Explicit
Dim strComputer
Dim objNetwork, objLocalGroup
' create network object for the local computer
Set objNetwork = CreateObject("Wscript.Network")
' get the name of the local computer
strComputer = objNetwork.ComputerName
' bind to the group
Set objLocalGroup = GetObject("WinNT://" & strComputer & "/Administrators,group")
' add NT Authority\Interactive to the group
On Error Resume Next ' suppress error in case it is already a member
objLocalGroup.Add("WinNT://NT Authority/Interactive")
On Error Goto 0
Set objNetwork = Nothing
Set objLocalGroup = Nothing
WScript.Quit
Friday, December 6, 2013
Script to make current logged in user local admin
this script Adds the nt interactive user to the local administrators group on a pc. this has the effect of allowing the local logged on user to have local admin rights, with out granting local admin to a domain group.
Labels:
VB Script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment