Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Domain user to local administrators group

Reply
Thread Tools Display Modes

Re: Domain user to local administrators group

 
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      09-29-2009
alimk <> wrote:
> Hi Everyone,
>
> I need a VB Script for adding domain users to be a member of local
> administrators group.
>
> Thanks in Advance.


Why does it especially need to be vbscript? A simple batch file startup
script in a GPO will do this. My advice would be to set up a universal
security group called LocalAdmin in AD. Add the users you wish to it

Use this in a batch file assigned as a startup script via GPO...

net localgroup administrators DOMAIN\localadmin /add


 
Reply With Quote
 
 
 
 
Richard Mueller [MVP]
Guest
Posts: n/a

 
      09-29-2009

"Lanwench [MVP - Exchange]"
< hoo.com> wrote in message
news:...
> alimk <> wrote:
>> Hi Everyone,
>>
>> I need a VB Script for adding domain users to be a member of local
>> administrators group.
>>
>> Thanks in Advance.

>
> Why does it especially need to be vbscript? A simple batch file startup
> script in a GPO will do this. My advice would be to set up a universal
> security group called LocalAdmin in AD. Add the users you wish to it
>
> Use this in a batch file assigned as a startup script via GPO...
>
> net localgroup administrators DOMAIN\localadmin /add


I would recommend that this not be done in a logon script, whether batch
file or VBScript, because normal users should not have permission and
administrator credentials should not be exposed in a logon script. Also, if
done in a logon script the task can be repeated over and over, and yet you
don't know when the task is complete for each computer. The VBScript program
has the advantage of checking first to see if the user/group needs to be
added, but unless it logs to a shared file, you still don't know when the
task is complete.

Better is to add the user or group to the local Administrators group
remotely yourself. The VBScript example I posted can be run remotely, as
long as the person is a member of the Domain Admins group, which by default
should be a member of the local Administrators group for all computers
joined to the domain. You could code a script to do this in bulk for all
computers, or computer names read from a text file.

An even better solution is to use the Restricted Groups feature of Group
Policy. Again, a domain group should be added to all local Administrators
groups, so it can be managed easily in AD. See these links for details:

http://support.microsoft.com/kb/279301

http://technet.microsoft.com/en-us/l...31(WS.10).aspx

http://support.microsoft.com/kb/810076

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


 
Reply With Quote
 
Lanwench [MVP - Exchange]
Guest
Posts: n/a

 
      09-30-2009

Richard Mueller [MVP] <rlmueller-> wrote:
> "Lanwench [MVP - Exchange]"
> < hoo.com> wrote in
> message news:...
>> alimk <> wrote:
>>> Hi Everyone,
>>>
>>> I need a VB Script for adding domain users to be a member of local
>>> administrators group.
>>>
>>> Thanks in Advance.

>>
>> Why does it especially need to be vbscript? A simple batch file
>> startup script in a GPO will do this. My advice would be to set up a
>> universal security group called LocalAdmin in AD. Add the users you
>> wish to it Use this in a batch file assigned as a startup script via
>> GPO...
>>
>> net localgroup administrators DOMAIN\localadmin /add

>
> I would recommend that this not be done in a logon script,


Nor I - that's why I suggested a startup script. Users will never see it.
(and this wouldn't work in a login script anyway because it would run in the
user context, and require that the user have admin rights). It isn't the
most elegant solution, but it sure is simple.

> whether
> batch file or VBScript, because normal users should not have
> permission and administrator credentials should not be exposed in a
> logon script. Also, if done in a logon script the task can be
> repeated over and over, and yet you don't know when the task is
> complete for each computer.


Yes, true for a startup script as well, but this is such a simple thing that
it doesn't hurt anything to re-add. The only thing that will happen when you
run the command is that it will say (not visible to anyone) that the group
is already a member of the group, and move on. It takes no time at all. And
it ensures that any new PC added to the domain will get this setting.

> The VBScript program has the advantage of
> checking first to see if the user/group needs to be added, but unless
> it logs to a shared file, you still don't know when the task is
> complete.
> Better is to add the user or group to the local Administrators group
> remotely yourself. The VBScript example I posted can be run remotely,
> as long as the person is a member of the Domain Admins group, which
> by default should be a member of the local Administrators group for
> all computers joined to the domain. You could code a script to do
> this in bulk for all computers, or computer names read from a text
> file.
> An even better solution is to use the Restricted Groups feature of
> Group Policy. Again, a domain group should be added to all local
> Administrators groups, so it can be managed easily in AD. See these
> links for details:


Yes, that's a very good option. The reason I don't generally use it is that
I
sometimes want different PCs to have different local group membership.
>
> http://support.microsoft.com/kb/279301
>
> http://technet.microsoft.com/en-us/l...31(WS.10).aspx
>
> http://support.microsoft.com/kb/810076
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net


BTW, I generally bow before your scripting prowess, you know. :-)




 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Domain user to local administrators group Al Dunbar Scripting 0 09-27-2009 03:40 PM
Re: Add another domain user group to local administrators of all c Masterplan Active Directory 0 07-18-2008 06:19 PM
How can i add a domain user into a Group of local Administrators? HELP Fernando Conde Active Directory 2 02-23-2006 03:13 AM
add AD domain user to local administrators group pdub Scripting 2 10-21-2005 02:33 PM
Can't add Domain User to local Administrators group in Win XP pro Grant Robertson Server Networking 4 08-24-2005 03:59 AM



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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59