Casper4242 Posted September 13, 2006 Posted September 13, 2006 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.ExampleNewCTXApp.cmd MyAppthe line I was trying in batch in the .cmd was:net localgroup CTX-CMC-Admins CTX-%1-Admin /ADD /DOMAINThis works great when there are no quotesBut 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 /DOMAINwhich 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.
allen2 Posted September 14, 2006 Posted September 14, 2006 Why not use %* instead of %1 ?It should take care of space problems.
chuchi Posted September 21, 2006 Posted September 21, 2006 Hi why you dont use : http://www.microsoft.com/technet/scriptcen...s/adgpvb03.mspxConst 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now