Quantcast
Channel: Sysinternals Forums
Viewing all articles
Browse latest Browse all 10386

PsTools : PSEXEC Hangs when running WMI commands

$
0
0
Author: jamesavery
Subject: PSEXEC Hangs when running WMI commands
Posted: 15 December 2014 at 9:34pm

I'm running PSEXEC logging into a remote machine and running the firewall.cmd batch file. The log stops when the remote system is trying to run a wmic command on the first line.

  • I am running this from an Administrator Cmd Prompt.
  • When it hangs, I have to go to the remote computer and open Task Manager and kill PSEXEC.

I've tried this with a simple command running PSEXEC. This Hangs and the PSEXEC service is acting like it's waiting for something to complete the script.
psexec \\TEST123 -u TEST123\administrator -p PWD123 -accepteula -h cmd /c "wmic os get version"

But if I use ECHO it works as in this cmd line:
psexec \\TEST123 -u TEST123\administrator -p PWD123 -accepteula -h cmd /c "echo | wmic os get version"

The batch file I'm using works on Windows 7 and Windows 2008 R2. It's only with Server 2003 R2 am I having these issues.

-------------------------------------------------------------------------------------------------
Information of contents and versions
-------------------------------------------------------------------------------------------------
OS Version: Windows Server 2003 R2

PSEXEC version 2.11.0.0

Command running: psexec \\TEST123 -u TEST123\administrator -p PWD123 -accepteula -h cmd /c "c:\SccmTemp\firewall.cmd >c:\SccmTemp\TEST123_Firewall.log"

Firewall.cmd contents:
FOR /F "tokens=1 delims= " %%G IN ('wmic os get version ^|find " "') DO (set _version=%%G)
FOR /F "tokens=1 delims= " %%X in ('wmic cpu get addresswidth ^|find " "') DO (set _osarch=%%X)
For /f "tokens=1,2,3 delims=. " %%G in ('echo %_version%') Do (set _major=%%G& set _minor=%%H& set _build=%%I) 
Echo Major version: %_major%  Minor Version: %_minor%.%_build% OS Architecture: %_osarch%

Log output:
C:\WINDOWS\system32>set _major= 
C:\WINDOWS\system32>set _minor= 
C:\WINDOWS\system32>set _build= 
C:\WINDOWS\system32>set _osarch= 
C:\WINDOWS\system32>FOR /F "tokens=1 delims= " %G IN ('wmic os get version |find " "') DO (set _version=%G ) 
----- Hangs here-----
When it hangs, I have to go to the remote computer and open Task Manager and kill PSEXEC.


IDEAS?


Viewing all articles
Browse latest Browse all 10386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>