I am trying to use the wshpipe function above and I am receiving the following error:
Script error : unknown command !
While Not $oExec.Status Loop
I am very new to this language, but I think I have do everything correctly. COuld anyone give me a bit of help?
As it says in the code i am using ie 6 sp1 and I do have the latest kixstart. So what do you guys think?
here is the code:
code:
Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If Not VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
While Not $oExec.Status Loop
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If Not $NoEcho $Output Endif
$WshPipe=Split($Output,CHR(10))
Exit($oExec.ExitCode)
EndFunction
break on
$tsProfilepath = "\\qas400\tsprofiles\"
$homedirpath = "\\qas400\user\"
$domain = @ldomain
$AD = getobject("WinNT://$domain")
for each $userobj in $AD
if $userobj.class="User"
$ouruser=$userobj.name
EndIf
if $ouruser="datalan"
? "Found user: "+$ouruser
$text=wshpipe("m:\winnt\tscmd.exe dc1nwbgh datalan terminalserverprofilepath")
? $text
endif
Next
$AD=""
Thanks.
-Nick