Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Remove all users in a file from a specific group.

Hi,

I have a file which has 100's of users nt logins.Need to remove them from just one specific group.Is there a way to remove all users in the file from just that group.Other groups the user is a member should remain the same..Have a results file with success results..

Regards
Sharath
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bsharath

ASKER

Rob i get this...

---------------------------

---------------------------
Could not connect the group at: LDAP://CN=Chennai_NewJoiners,OU=Chennai Distribution Groups,DC=Development,DC=Group,DC=co,DC=uk
---------------------------
OK  
---------------------------

It has to connect to the root Domain but its connecting to the local Domain..


The path should be like

CN=Chennai_NewJoiners,OU=Chennai Distribution Groups,DC=Group,DC=co,DC=uk
OK then, that's fine, just change these two lines:
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSName = objRootDSE.Get("defaultNamingContext")

to this:
strDNSName = "DC=Group,DC=Co,DC=uk"

Regards,

Rob.
Rob this works great .Can i have a results file on all that it has removed .If any failure..
I have to run out....just got an urgent phone call...will be back later tonight....

Rob.
Ok Rob...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Rob i get this...

C:\>"Remove users from group.vbs"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

C:\Remove users from group.vbs(33, 66) Microsoft VBScript compilation error: Exp
ected end of statement
Ooops, change
objOutputFile.WriteLine strNTLogin " was successfully removed."

to
objOutputFile.WriteLine strNTLogin & " was successfully removed."

Regards,

Rob.
I get this...

---------------------------
Windows Script Host
---------------------------
Script:      C:\Remove users from group.vbs
Line:      42
Char:      74
Error:      Expected end of statement
Code:      800A0401
Source:       Microsoft VBScript compilation error

---------------------------
OK  
---------------------------
Ooops, again, same thing, change this line:
If boolFound = False Then objOutputFile.WriteLine strNTLogin " is not a member."

to this:
If boolFound = False Then objOutputFile.WriteLine strNTLogin & " is not a member."

Regards,

Rob.
Thanks  a lot Rob...