Page 1 of 1 1
Topic Options
#121094 - 2004-06-11 01:39 PM Add a domain group to local group
Phil Offline
Lurker

Registered: 2004-06-11
Posts: 1
I know questions have already been posted regarding this before. However I am still unable to find a working solution.

I want to add a domain group (ITSupport) to the local administration group on all of our XP, 2000 computers. This is to enable our technical support staff to automatically have full rights.

Is there a script that will automate this and solve the permissions problem that it needs to be run by an administrator.

Any help is appreciated.

Thanks.

Top
#121095 - 2004-06-11 01:49 PM Re: Add a domain group to local group
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you just need an adminscript.
easiest way to do it is to have a script that does it, ran on admin account.
then helpdesk has their script that will give a note to the admin script about what wksta they want to access.
admin script will then check and apply the rights if needed.
_________________________
!

download KiXnet

Top
#121096 - 2004-06-11 03:01 PM Re: Add a domain group to local group
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
If you know the list of machines (i.e. query AD), you can do something like:

Code:

$DomainString = "ComputerName"
$UserString = "ITSupport"
$GroupString = "Administrators"
$GroupObj = GetObject("WinNT://" + $DomainString + "/" + $GroupString)
$GroupObj.Add ("WinNT://" + $DomainString + "/" + $UserString)
$DomainObj = 0
$GroupObj = 0



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#121097 - 2004-06-11 06:02 PM Re: Add a domain group to local group
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Phil,

Here is another method similar to Kent's code.
You could do this one by one, but the best thing to do is probably read a file with the names of the computers you want to perform this task on, or a similar method.

I'd first have it ping and if successful run this code but supplying the computer name of the read in one each time.

This code allows you to add either Accounts or Groups.
 

Code:
Dim $SO,$AddAdmin

$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
 
$AddAdmin = AddToLocalAdmin('TestComputer','Administrators','YourDomain','ITSupport')
 
Function AddToLocalAdmin($Computer,$GroupToAddTo,$Domain,optional $GroupToAdd,optional $AccountToAdd)
Dim $Group,$User,$Admin,$Err
$Group = GetObject('WinNT://' + $Computer + '/' + $GroupToAddTo + ',group')
If $GroupToAdd<>""
$User = GetObject('WinNT://' + $Domain + '/' + $GroupToAdd + ',group')
EndIf
If $AccountToAdd<>""
$User = GetObject('WinNT://' + $Domain + '/' + $AccountToAdd + ',user')
EndIf
$Group.Add($User.ADsPath)
$Err = @ERROR
$AddToLocalAdmin=$Err
EndFunction
 
Function fnCOMErr($lErr)
If $lErr<0 $lErr=VAL("&"+Right(DecToHex($lErr),4)) EndIf
Exit $lErr
Endfunction


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.071 seconds in which 0.042 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org