#77044 - 2003-10-10 02:52 AM
wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
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
|
|
Top
|
|
|
|
#77045 - 2003-10-10 03:14 AM
Re: wshpipe issues
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
what version of KiXtart are you using? You can find out by outputing the value of @kix.
What version of WSH is installed on the computer?
|
|
Top
|
|
|
|
#77047 - 2003-10-10 03:17 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
Kix is version 4.21 and wsh is 5.6
Thanks.
|
|
Top
|
|
|
|
#77049 - 2003-10-10 03:37 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
yes.
I will try it now.
-Nick
|
|
Top
|
|
|
|
#77050 - 2003-10-10 03:43 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
Same error message?
|
|
Top
|
|
|
|
#77053 - 2003-10-10 03:52 AM
Re: wshpipe issues
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Change you $ShellCMD from quote: "m:\winnt\tscmd.exe dc1nwbgh datalan terminalserverprofilepath"
to quote: "%comspec% /c dir c:\"
Does the same error occur? If you hit an account without a TS profile your program may be bring back an unexpected value or aborting.
I think once you get past this error you will find another with "? $text" since $text should be an array. You will have to use a "for each" loop. [ 10. October 2003, 03:54: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#77056 - 2003-10-10 04:06 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
Ok,
Here is what I get now...
WScript.Shell Exec error: 1
|
|
Top
|
|
|
|
#77058 - 2003-10-10 04:10 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
After the update I get this...
Script error : unknown command ! createobject("wscript").Version ?
|
|
Top
|
|
|
|
#77059 - 2003-10-10 04:13 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
The command works at a command prompt. I did try with the following: "%comspec% /c dir c:\" and recieve the same error.
I stepped through the code and it stops at the While Not $oExec.Status Loop line.
Thanks.
|
|
Top
|
|
|
|
#77061 - 2003-10-10 04:18 AM
Re: wshpipe issues
|
nicktech
Fresh Scripter
Registered: 2003-10-09
Posts: 12
Loc: White Plains, NY
|
KiXtart = 4.02 -2147221005 - Invalid class string Script error : unknown command ! ? WSH = '+$oWSH.Version
|
|
Top
|
|
|
|
#77062 - 2003-10-10 04:24 AM
Re: wshpipe issues
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Two things. First you are not running KiXtart 4.21 as you stated and it looks like you DO NOT have WSH 5.6 installed.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 765 anonymous users online.
|
|
|