Sign in to follow this  
Followers 0
Gnat

DSGET script help plz

2 posts in this topic

I am trying to write a script that will query AD using dsquery and then use the output from that to get some info from AD using dsget...

The dsquery part works and I get the output that I expect, but the dsget portion gives me nothing...

Any help would be greatly appreciated...

Here is the code...

#Include <Constants.au3>

Global $dsqOutput, $CN, $dsgOutput, $Membership, $Error

$dsqOutput = Run(@ComSpec & " /c dsquery computer domainroot -name hostname", @SystemDir, @SW_HIDE, $STDOUT_CHILD)

$CN = StdoutRead($dsqOutput)

MsgBox(0, "CN=", $CN)

$dsgOutput = Run(@ComSpec & ' /c dsget computer ' & $CN & ' -memberof', @SystemDir, @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD)

$Membership = StdoutRead($dsgOutput)

$Error = StderrRead($dsgOutput)

MsgBox(0, "Groups", $Membership)

MsgBox(0, "Error", $Error)

Share this post


Link to post
Share on other sites



I had the same problem, but resolved with that code:

Global $dsqOutput, $CN, $PC

$PC = "hostname"

$dsqOutput = Run(@ComSpec & " /c dsquery computer domainroot -name " & $PC & " | dsget computer -memberof", @SystemDir, @SW_HIDE, $STDOUT_CHILD)
Sleep (200)
$CN = StdoutRead($dsqOutput)
MsgBox(0, "Groups of " & $PC, $CN)

Best regards,

hometronix

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0