#198714 - 2010-05-25 10:21 PM
psexec and Shell and/or Run
|
Georges_K
Getting the hang of it
Registered: 2005-02-17
Posts: 83
Loc: Chino, CA
|
Hello all,
I have spent more than 2 hours trying to figure out this problem, and I think it's time to run it by you !
I have always been able to run psexec to trigger a kix script on a remote machine without any problems.
Today, as I was writing some scripts, I used that same method, only to find that it's always failing. I'm running XP SP3 in a VMWare View 4 environment. Running kix32 version 4.61 (also tried 4.60) psexec is at version 1.96 logged on user currently has local admin privileges, though I'd prefer for the particular script I'm working on to run in the system account without loading a profile, as non of what it's doing is profile related. (changing some files in the root of C: and making a couple of registry entry changes in HKLM)
Here's the situation, (and this is just to illustrate):
Kix Code: (test.kix)
BREAK on
If Exist("C:\test.bat")
? "C:\test.bat found"
Else
? "C:\Test.bat not found"
EndIf
Run '%COMSPEC% c:\test.bat'
? "DEBUG: " + @ERROR + " - " + @SERROR
get $x
If I run this on the workstation itself: kix32.exe c:\test.kix. I get the correct result, and test.bat is executed.
However, I run this same script through psexec: psexec -i \\<workstation> -u <username> -p <password> c:\windows\system32\kix32.exe c:\test.kix
I get the following: C:\Test.bat found DEBUG: 2 - The system cannot find the file specified.
This has always worked, until now... I have tried removing the username and password, and running psexec with the -e argument to not load current user profile. Nothing worked. The user on the workstation is a local admin, so I know they have read access to the file.
Also, I found one thing that was curious in the Application Log: Event Type: Error Event Source: KIXTART Event Category: None Event ID: 1312 Date: 5/25/2010 Time: 1:14:01 PM User: N/A Computer: AERIESCS-SB-001 Description: The description for Event ID ( 1312 ) in Source ( KIXTART ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: WkstaUserGetInfo failed Error : A specified logon session does not exist. It may already have been terminated. (0x520/1312).
Would anyone have any pointers as to what to look for at this point? I'm pretty stumped.
Thanks for any assistance you may be able to provide!
_________________________
Network Specialist Chino Unified School District
|
|
Top
|
|
|
|
#198721 - 2010-05-26 09:44 AM
Re: psexec and Shell and/or Run
[Re: Allen]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
The error almost certainly relates to not finding CMD.EXE
Consider wrapping %COMSPEC% in quotes to preserve the path.
Also, when executing KiXtart in a new environment it's usually a good idea to fix the current working directory:
BREAK on
; Fix current working directory
GO C:
CD \
If Exist("C:\test.bat")
"C:\test.bat found"+@CRLF
Else
"C:\Test.bat not found"+@CRLF
EndIf
; Wrap %COMSPEC% in quotes to preserve the path - especially useful if it contains spaces.
Run '"'+%COMSPEC%+'" c:\test.bat'
"DEBUG: " + @ERROR + " - " + @SERROR+@CRLF
get $x
|
|
Top
|
|
|
|
#198726 - 2010-05-26 05:16 PM
Re: psexec and Shell and/or Run
[Re: Richard H.]
|
Georges_K
Getting the hang of it
Registered: 2005-02-17
Posts: 83
Loc: Chino, CA
|
Thank you guys for your responses. Allen, I actually have never tried method in opening the file in question via UNC, but I do know for a fact that I can call a local file on the remote PC. i.e: psexec -i \\remoteserver c:\windows\system32\notepad.exe c:\test.txt
In the above scenario, test.txt is actually created on the c:\ drive of the remote server. I wonder if back then (in older version), psexec had different behavior (??)
Richard, Thanks for your pointer regarding wrapping %COMSPEC% in quotes.
Fortunately for me, since I'm working in VMWare, I was able to go back to a previous snapshot of the workstation, and get psexec to work. So, perhaps there were some changes that I had made in the latest release that broke the psexec functionality. Bottom line, I'm working again, but I really wish I could've known what the problem was, in order to avoid it in the future.
Oh well, in any case, I think I'm good. Thanks again for your time! I really appreciate it!
_________________________
Network Specialist Chino Unified School District
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 840 anonymous users online.
|
|
|