Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

wmic "process" path failing on XP (Pro SP2, current fixes)

209 views
Skip to first unread message

Michael Wojcik

unread,
Apr 28, 2008, 9:53:25 AM4/28/08
to
wmic's "process" path doesn't appear to work on XP, at least on the
three systems I've tried. These are all XP Pro SP2 plus current fixes.
It works fine on 2003 Server.

On 2003, "wmic process" writes a list of processes to stdout, just as
expected (and documented).

On the XP boxes, a simple "wmic process" produces the following
astonishingly helpful error message:

-----
c:\> wmic process
Invalid XML content.
-----

Terrific. Now if it mentioned, say, *where* the invalid XML was, it
might be possible to correct the problem. And, of course, this error
does not appear to be documented anywhere.

Other wmic paths I tried work on XP - it's just process that's broken.
Presumably this means a bad wmic configuration file somewhere. Anyone
have any idea where?

(I'm using wmic, by the way, because it's a scriptable way to get
command-line information for running processes that only requires
software that's typically already installed on the platforms I'm
interested in. On machines I control, I have better tools available;
this is for a script we can send to customers.)

--
Michael Wojcik
Micro Focus

olivier

unread,
Apr 28, 2008, 11:38:26 AM4/28/08
to
Michael Wojcik wrote:

> c:\> wmic process
> Invalid XML content.
> -----
>
> Terrific. Now if it mentioned, say, *where* the invalid XML was, it
> might be possible to correct the problem. And, of course, this error
> does not appear to be documented anywhere.
>
> Other wmic paths I tried work on XP - it's just process that's broken.
> Presumably this means a bad wmic configuration file somewhere. Anyone
> have any idea where?

If no one can reproduce your bug, it will be difficult to debug it...
But why don't you make an exe, that you can send to customers, which
enumerate processes in C/C++ code ?

Michael Wojcik

unread,
Apr 28, 2008, 1:53:34 PM4/28/08
to
olivier wrote:
> If no one can reproduce your bug, it will be difficult to debug it...

If no one could reproduce it, it might be difficult to fix - though
that error message clearly exists in the source, and I doubt it's
difficult to determine what causes it. Were Microsoft not so enamored
of black boxes, I'd have likely found and fixed it already.

But *I* can reproduce it, so your hypothetical is not relevant here.

Perhaps you meant "if no one else can reproduce it"; but that remains
to be seen. Do you have some evidence that no one else can reproduce it?

> But why don't you make an exe, that you can send to customers, which
> enumerate processes in C/C++ code ?

That fails to meet the already stated requirement of "a scriptable
solution that only requires software that's already installed".

Note that, if "wmic process" worked reliably on XP, I would not need
to send customers anything. I could describe the command over the
phone, for example.

Boris

unread,
Apr 28, 2008, 2:14:27 PM4/28/08
to
On Vista/Win2003 there's TASKLIST command (available via CMD shell).
But I'm not sure if XP has it.

Boris

"Michael Wojcik" <mwo...@newsguy.com> wrote in message
news:fv52v...@news4.newsguy.com...

Michael Wojcik

unread,
Apr 28, 2008, 7:47:04 PM4/28/08
to
Boris wrote:
> On Vista/Win2003 there's TASKLIST command (available via CMD shell).
> But I'm not sure if XP has it.

tasklist is included in XP, but it doesn't show the process command
line, which is what I need. (I ought to have noted that in the initial
post; but in any case I'm really looking to find out why wmic isn't
working, and how to fix it.)

Jeff Henkels

unread,
Apr 29, 2008, 5:09:49 PM4/29/08
to
Try using Process Explorer from
http://technet.microsoft.com/en-us/sysinternals/default.aspx; it will show
you the command line.

"Michael Wojcik" <mwo...@newsguy.com> wrote in message

news:fv75s...@news4.newsguy.com...

boris

unread,
Apr 30, 2008, 2:25:52 AM4/30/08
to

"Michael Wojcik" <mwo...@newsguy.com> wrote in message
news:fv75s...@news4.newsguy.com...
I don't know what's the problem here. It's pretty trivial stuff. There's
WIN32_Process WMI class that provides all the info you need - all you have
to do: write trivial VBS script using this class.

Boris

boris

unread,
Apr 30, 2008, 2:27:52 AM4/30/08
to
> I don't know what's the problem here. It's pretty trivial stuff. There's
> WIN32_Process WMI class that provides all the info you need - all you have
> to do: write trivial VBS script using this class.
>
> Boris
Here's sample script:
>>>>>>>>>>>>>>>>>>>
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecQuery( _
"select * from win32_process" )
For Each objProcess in colProcesses

If objProcess.GetOwner ( User, Domain ) = 0 Then
Wscript.Echo "Process " & _
objProcess.Caption & ": " & objProcess.ProcessId & _
" belongs to " & Domain & _
"\" & User
Else
Wscript.Echo "Problem " & Rtn & _
" getting the owner for process " _
& objProcess.Caption & ": " & objProcess.ProcessId
End If
Wscript.Echo "Command line is: " & objProcess.CommandLine
Next

<<<<<<<<<<<<<<<<<<
Boris


Michael Wojcik

unread,
Apr 30, 2008, 10:50:02 AM4/30/08
to
Jeff Henkels wrote:
> Try using Process Explorer from
> http://technet.microsoft.com/en-us/sysinternals/default.aspx; it will show
> you the command line.

Yes, I know. I've been using Process Explorer since it was first
released. That's why, in my original and second posts, I explained
that I am specifically trying to find a *scriptable command-line
solution using only Windows software*.

And more specifically, I'd like to know why "wmic process" doesn't
work on XP.

Michael Wojcik

unread,
Apr 30, 2008, 10:59:10 AM4/30/08
to

Yes, that's a partial solution for the original problem. (I'd prefer
to use JScript rather than VBScript, as I find the latter language
distasteful, but that shouldn't make any difference to WSH.) And
thanks for the suggestion, as I hadn't gotten around to tracking down
the WMI docs yet.

This still doesn't really address the original requirements, though.
If "wmic process" worked on XP, I'd have a solution that a support
engineer could describe to a customer over the phone. I can't expect
customers to write their own WSH scripts. (Some can, certainly, but
many aren't familiar with the technology.)

And I'd still like to know what's wrong with wmic process on XP.

0 new messages