Gnat Posted January 29, 2007 Share Posted January 29, 2007 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) Link to comment Share on other sites More sharing options...
hometronix Posted April 4, 2010 Share Posted April 4, 2010 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 Link to comment Share on other sites More sharing options...
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