Solved

Can I create a vbs script the will use DSQuery and DSGet to find if a user is in a group?

Posted on 2007-11-13
3
2,231 Views
Last Modified: 2012-05-05
Can I create a vbs script the will use DSQuery and DSGet to find if a user is in a group?

What I want to do is take user ids from a txt file and first use DSQuery to see if they are in the Domain then use DSGet to see if they are in a group. If they are not in the group out put the user ID to a text file.

So is this doable in a vbs script?
0
Comment
Question by:pointhigh
3 Comments
 
LVL 11

Expert Comment

by:bsharath
ID: 20277278
Is it that you want to find users in the txt file if they are a member of any group.?
0
 
LVL 3

Accepted Solution

by:
elissaqp earned 250 total points
ID: 20277551
This is an example of "Returns the members of an Active Directory group named Scientists."

On Error Resume Next
 
Set objGroup = GetObject _
  ("LDAP://cn=Scientists,ou=R&D,dc=NA,dc=fabrikam,dc=com")
objGroup.GetInfo
 
arrMemberOf = objGroup.GetEx("member")
 
WScript.Echo "Members:"
For Each strMember in arrMemberOf
  WScript.echo strMember
Next


If you need to write info on a txt file, this is an example:

Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
    ("c:\scripts\service_status.txt", ForAppending, True)
Set colServices =  GetObject("winmgmts:").ExecQuery _
    ("Select * from Win32_Service")
For Each objService in colServices    
    objTextFile.WriteLine(objService.DisplayName & vbTab & _
        objService.State)
Next
objTextFile.Close

0
 

Author Comment

by:pointhigh
ID: 20289820
That looks like a good solution
Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now