Search This Blog

Nov 21, 2006

VBscripting tips

  1. To make sure you fetch the output only after the command finishes, add the following between shell.exec and stdout.all
    Do While oExec.Status = 0
    WScript.Sleep 100
    Loop
  2. To pipe output from one process to another
    Dim oUserDN
  • set oShell = createobject("wscript.shell")
    mystr = "dsquery user -samid %username% -o dn dsget user -memberof"
    set oUserDN = oShell.exec("%ComSpec% /c """ & mystr & """")
    Wscript.Echo oUserDN.StdOut.readall