Jump to content

Recommended Posts

Posted

Anyone have a nice easy examlpe to add a group to another group?

I prefer this to be done in VBS as I already have around 100 lines of VBS doing other things and this is one of the last things I need.

The other big reason is I am passing an argument to the VBS that is sometimes in quotes and sometimes not. Its only in quotes when there is a space in it.

VBS treats this great, but if I was to try and do this on the command line it wouldnt work because the quotes come in as part of %1 and then get stuck in the middle of some text where they shouldnt be.

Example

NewCTXApp.cmd MyApp

the line I was trying in batch in the .cmd was:

net localgroup CTX-CMC-Admins CTX-%1-Admin /ADD /DOMAIN

This works great when there are no quotes

But if I run the same command with quotes and spaces...

NewCTXApp.cmd "My App"

then the line in question comes out as:

net localgroup CTX-CMC-Admins CTX-"My App"-Admin /ADD /DOMAIN

which obviously fails miserably.

Sooooo, if someone can hook me up with a short chunk of example code on adding a group to a group, that would be spectacular.


Posted

Hi why you dont use : http://www.microsoft.com/technet/scriptcen...s/adgpvb03.mspx

Const ADS_PROPERTY_APPEND = 3

Set objGroup = GetObject _

("LDAP://cn=Sea-Users,cn=Users,dc=NA,dc=fabrikam,dc=com")

objGroup.PutEx ADS_PROPERTY_APPEND, "member", _

Array("cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com", _

"cn=Executives,ou=Management,dc=NA,dc=fabrikam,dc=com", _

"cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")

objGroup.SetInfo

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...