+ Post New Thread
Results 1 to 6 of 6
Windows Thread, change local account membership in Technical; Hi, it has just come to my attention, that on the last image i have just rolled out to a ...
  1. #1
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    635
    Thank Post
    113
    Thanked 88 Times in 72 Posts
    Rep Power
    78

    change local account membership

    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

  2. #2

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    10,707
    Thank Post
    829
    Thanked 2,571 Times in 2,188 Posts
    Blog Entries
    9
    Rep Power
    731
    This is easy in VBS, have a look here:
    Remove Unapproved Local Administrators [vbScript] - Altirigos

    Code:
    ' 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

  3. Thanks to SYNACK from:

    linkazoid (4th March 2009)

  4. #3
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    635
    Thank Post
    113
    Thanked 88 Times in 72 Posts
    Rep Power
    78
    Ta very much....

    Can a member be specified to add to a local group? e.g power users

    Michael

  5. #4

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    10,707
    Thank Post
    829
    Thanked 2,571 Times in 2,188 Posts
    Blog Entries
    9
    Rep Power
    731
    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.
    Code:
    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.

  6. Thanks to SYNACK from:

    linkazoid (4th March 2009)

  7. #5
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    635
    Thank Post
    113
    Thanked 88 Times in 72 Posts
    Rep Power
    78
    Cheers SYNACK...

    Unfortunately i couldn't get that script to run... did manage to get a batch file to do what I wanted...

    Code:
    net localgroup "Power Users" "ecdl" /add
    Michael

  8. #6

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,144
    Thank Post
    113
    Thanked 518 Times in 447 Posts
    Blog Entries
    2
    Rep Power
    121
    You might also want to look at restricted groups - it's a group policy, no scripting, no panics and easy to use :-)

SHARE:
+ Post New Thread

Similar Threads

  1. local admin account re-set remotely BULK
    By Gavinc in forum Windows
    Replies: 11
    Last Post: 18th December 2008, 08:32 PM
  2. RADIUS and local XP user account
    By stjtech in forum Wireless Networks
    Replies: 1
    Last Post: 26th November 2008, 09:05 AM
  3. Need to reset a local account's password
    By timbo343 in forum Scripts
    Replies: 1
    Last Post: 21st September 2007, 01:16 PM
  4. Bulk Change Local Administrator Passwords.
    By Nij.UK in forum Windows
    Replies: 14
    Last Post: 15th June 2007, 01:45 PM
  5. Replies: 8
    Last Post: 12th November 2006, 02:02 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •