Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - "add domain group to local group" stopped working

Reply
 
Old 09-17-2009   #1 (permalink)
billy


 
 

"add domain group to local group" stopped working

i have been using a script for years to add a domain group to the
local Administrators group but it stopped working when the "powers
that be" decided to turn off the WINS server. the basic code is:

Set objLocalGrp = GetObject("WinNT://" & strHostName & "/
Administrators,group")
Set objDSO = GetObject("WinNT:")
Set objGroup = objDSO.OpenDSObject("WinNT://mydomain.com/
MyAdminGroup,group", strUserID, strPassword, 3)
objLocalGrp.Add(objGroup.AdsPath)

On any network segment that has the WINS set via DHCP this works. On
any network segment that has WINS unset, this fails at the "third"
line with "The network path was not found".

I tried specifying a specific domain controller but am not sure i used
the correct syntax, so if you know that please share. Or if you know
of a different method of adding a domain group to a local group, i'm
all ears.


My System SpecsSystem Spec
Old 09-18-2009   #2 (permalink)
jmhj


 
 

Re: "add domain group to local group" stopped working

Here is what I use and I do not use WINS. Hope it helps.

' Specify AdsPath of domain group to be added to
' local Administrators group.
strDomainGroup = "WinNT://domainname/GroupName,group"

' Bind to domain group.
Set objDomainGroup = GetObject(strDomainGroup)

' Retrieve local computer NetBIOS name.
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

' Bind to local Administrators group.
Set objLocalGroup = GetObject("WinNT://" & strComputer _
& "/Administrators,group")

' Check if domain group is already a member.
If Not objLocalGroup.IsMember(objDomainGroup.AdsPath) Then
' Add domain group to local group.
objLocalGroup.Add(objDomainGroup.AdsPath)
End If

' Cleanup
Set objDomainGroup = Nothing
Set objNetwork = Nothing
Set objLocalGroup = Nothing


"billy" <wcasse@newsgroup> wrote in message
news:6e5451a5-420c-470d-8107-3401146797ce@newsgroup
Quote:

>i have been using a script for years to add a domain group to the
> local Administrators group but it stopped working when the "powers
> that be" decided to turn off the WINS server. the basic code is:
>
> Set objLocalGrp = GetObject("WinNT://" & strHostName & "/
> Administrators,group")
> Set objDSO = GetObject("WinNT:")
> Set objGroup = objDSO.OpenDSObject("WinNT://mydomain.com/
> MyAdminGroup,group", strUserID, strPassword, 3)
> objLocalGrp.Add(objGroup.AdsPath)
>
> On any network segment that has the WINS set via DHCP this works. On
> any network segment that has WINS unset, this fails at the "third"
> line with "The network path was not found".
>
> I tried specifying a specific domain controller but am not sure i used
> the correct syntax, so if you know that please share. Or if you know
> of a different method of adding a domain group to a local group, i'm
> all ears.
>

My System SpecsSystem Spec
Old 09-22-2009   #3 (permalink)
billy c


 
 

Re: "add domain group to local group" stopped working

On Sep 18, 10:48*am, "jmhj" <j...@newsgroup> wrote:
Quote:

> Here is what I use and I do not use WINS. *Hope it helps.
>
> ' Specify AdsPath of domain group to be added to
> ' local Administrators group.
> strDomainGroup = "WinNT://domainname/GroupName,group"
>
> ' Bind to domain group.
> Set objDomainGroup = GetObject(strDomainGroup)
>
> ' Retrieve local computer NetBIOS name.
> Set objNetwork = CreateObject("Wscript.Network")
> strComputer = objNetwork.ComputerName
>
> ' Bind to local Administrators group.
> Set objLocalGroup = GetObject("WinNT://" & strComputer _
> & "/Administrators,group")
>
> ' Check if domain group is already a member.
> If Not objLocalGroup.IsMember(objDomainGroup.AdsPath) Then
> ' Add domain group to local group.
> objLocalGroup.Add(objDomainGroup.AdsPath)
> End If
>
> ' Cleanup
> Set objDomainGroup = Nothing
> Set objNetwork = Nothing
> Set objLocalGroup = Nothing
>
> "billy" <wca...@newsgroup> wrote in message
>
> news:6e5451a5-420c-470d-8107-3401146797ce@newsgroup
>
Quote:

> >i have been using a script for years to add a domain group to the
> > local Administrators group but it stopped working when the "powers
> > that be" decided to turn off the WINS server. the basic code is:
>
Quote:

> > * *Set objLocalGrp = GetObject("WinNT://" & strHostName & "/
> > Administrators,group")
> > * *Set objDSO = GetObject("WinNT:")
> > * *Set objGroup = objDSO.OpenDSObject("WinNT://mydomain.com/
> > MyAdminGroup,group", strUserID, strPassword, 3)
> > * *objLocalGrp.Add(objGroup.AdsPath)
>
Quote:

> > On any network segment that has the WINS set via DHCP this works. On
> > any network segment that has WINS unset, this fails at the "third"
> > line with "The network path was not found".
>
Quote:

> > I tried specifying a specific domain controller but am not sure i used
> > the correct syntax, so if you know that please share. Or if you know
> > of a different method of adding a domain group to a local group, i'm
> > all ears.
not a huge difference between your code and mine, but i tried it and
it failed also. So i will not say that the cause of the problem is
that WINS went away, but instead is connected to the change that was
made when they disabled WINS. I did solve the problem though with good
old ...

WshShell.Run "NET LOCALGROUP ....

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
add a global group to a domain local group VB Script
Difference between a domain group and a local group VB Script
How to activate "file group option" under the Local Folders? Vista mail
Add domain group to local group question VB Script
adding a domain user to the local group PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

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