#176961 - 2007-06-13 09:08 PM
adding computer in groups
|
sealover
Fresh Scripter
Registered: 2005-05-09
Posts: 12
|
Hi all,
at first, sorry for my bad english and if the question already asked.
I'm trying to make a script that add computer to ad group (security, distribution, global).
All the example I found are for user. So is there a way to do what i want?
|
Top
|
|
|
|
#176967 - 2007-06-14 11:10 AM
Re: adding computer in groups
[Re: Arend_]
|
NTDOC
Administrator
Registered: 2000-07-28
Posts: 11624
Loc: CA
|
Nope, LOL
NETDOM has gone through extensive testing and has a hundred more options/features then your script
Now maybe some day you'll get time to match NETDOM in script format so I'll still have to at least suggest it.
For quickie your code should work though I suppose.
|
Top
|
|
|
|
#176971 - 2007-06-14 11:38 AM
Re: adding computer in groups
[Re: NTDOC]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
I'm not comparing NetDom to my scripts Just saying that anything NETDOM does can be done trough LDAP/WinNT Scripting.
|
Top
|
|
|
|
#176972 - 2007-06-14 12:55 PM
Re: adding computer in groups
[Re: Arend_]
|
sealover
Fresh Scripter
Registered: 2005-05-09
Posts: 12
|
so at first thanks for your answer...
Can I consider that a workstation is like a user? I want to say that I find a lot of add user group but never a add computer group?
|
Top
|
|
|
|
#181915 - 2007-10-25 12:07 AM
Re: adding computer in groups
[Re: Björn]
|
brewdude6
Hey THIS is FUN
Registered: 2000-10-21
Posts: 280
Loc: Nashville, TN
|
Does this work for anyone else?
$strDomain="Workgroup"
$strComp="jdoe"
$strGroupName ="Administrators"
$oDomain = GetObject("WinNT://" + $strDomain)
$oGroup = $oDomain.GetObject("Group", $strGroupName)
$oGroup.Add ("WinNT://" + $strDomain + "/" + $strComp) When I try to add a computer to a group I get this error:
0009] Encountered: COM exception error "Add" ((null) - (null)) [-2147352567/8002
I also get the same error when using the GroupAdd() udf.
_________________________
I could have made a neat retort but didn't, for I was flurried and didn't think of it till I was downstairs. -Mark Twain
|
Top
|
|
|
|
#182144 - 2007-10-31 06:52 PM
Re: adding computer in groups
[Re: NTDOC]
|
kholm
Korg Regular
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
When You are working on AD objects using WinNT the names are NT4 names, so the name for a computer named JDOE will be JDOE$. The code for Adding computer JDOE to a group would be:$strDomain="Workgroup"
$strComp="jdoe$$"
$strGroupName ="Administrators"
$oDomain = GetObject("WinNT://" + $strDomain)
$oGroup = $oDomain.GetObject("Group", $strGroupName)
$oGroup.Add ("WinNT://" + $strDomain + "/" + $strComp) -Erik
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 331 anonymous users online.
|
|
|