linkazoid Posted March 4, 2009 Posted March 4, 2009 Hi, it has just come to my attention, that on the last image i have just rolled out to a couple of ict suites. that I left the local testing account as an administrator. I need to change this pronto, does anyone have any scripts, batch or vbs that can be run. Need to change the account called "ecdl" from being a administrator to a standard user. Cheers, Michael
SYNACK Posted March 4, 2009 Posted March 4, 2009 This is easy in VBS, have a look here: Remove Unapproved Local Administrators [vbScript] - Altirigos ' Remove Unapproved Local Administrators. 'vbscript '** Written By: '** Dane Jones '** Define Variables Dim PermittedAdmins' As Array '** Define Permited Administrators List PermittedAdmins = Array("Administrator", "Domain Admins") '<--- Add to this Array any additional permited admins '** Get Local Administrator Group Set AdminGroup = GetObject("WinNT://./Administrators, Group") '** Search for Invalid Members & Remove Them For Each GroupMember in AdminGroup.Members Debug.WriteLine GroupMember.Name, GroupMember.Class, IsPermitedAdmin(GroupMember.Name) If Not IsPermitedAdmin(GroupMember.Name) Then AdminGroup.Remove GroupMember.ADsPath End If Next '** Functions ***************************************************************** Function IsPermitedAdmin(MemberName)' As Boolean Dim i' As Long For i = LBound(PermittedAdmins) To UBound(PermittedAdmins) If UCase(MemberName) = UCase(PermittedAdmins(i)) Then IsPermitedAdmin = True Exit Function End If Next IsPermitedAdmin = False End Function 1
linkazoid Posted March 4, 2009 Author Posted March 4, 2009 Ta very much.... Can a member be specified to add to a local group? e.g power users Michael
SYNACK Posted March 4, 2009 Posted March 4, 2009 Thats also doable, check out here for a rundown on some of the common operations for local accounts: Scripting Local Groups using VBScript Adds a user (kenmyer) to the local Administrators group on a computer named MyComputer. strComputer = "MyComputer" Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators,group") Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer,user") objGroup.Add(objUser.ADsPath) just change strComputer = "MyComputer" to strComputer = "." to make it run on the local computer rather than going after a specific box over the network. 1
linkazoid Posted March 4, 2009 Author Posted March 4, 2009 Cheers SYNACK... Unfortunately i couldn't get that script to run... did manage to get a batch file to do what I wanted... net localgroup "Power Users" "ecdl" /add Michael
srochford Posted March 4, 2009 Posted March 4, 2009 You might also want to look at restricted groups - it's a group policy, no scripting, no panics and easy to use :-)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now