473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

WMI - Win32_Process - Commandline Problem

Hello!
I have wrote a windows service in vb.net. This service monitors the running
processes with WMI and the Win32_Process class. Till last month all seems
ok. But since the begin of september the service can't retrieve the
commandline property of the processes. I think this is an result of .NET
Framework 1.1 Service Pack 1 or XP SP2.
Did somebody recognice the same effect? Did anybody knows how i can retrieve
the commandline property of processes that other users have started. This
problem only occurs when the service retrieve the process infos of other
users, system processes were retrieved completly with the commandline
property. When i use the code in a winform, my own processes where also
retrieved completly with the commandline property. But other user processes
have a blank commandline property too. The service is running under an
account, that was in the local admin group, so the service must have all
rights to acces the processinfos of the other users.

C. Borger
Nov 21 '05 #1
2 7043
Hi,

Seam to get an error with system idle process only. Try this.
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Process")

moReturn = moSearch.Get

For Each mo In moReturn

Dim arOwner(2) As String

mo.InvokeMethod("GetOwner", arOwner)

Dim strOut As String

Trace.WriteLine("-------------")

strOut = String.Format("{0} Owner {1} Domain {2}", mo("Name"), arOwner(0),
arOwner(1))

Trace.WriteLine(strOut)

Try

Trace.WriteLine(mo("CommandLine").ToString)

Catch ex As System.Exception

Trace.WriteLine(ex.ToString)

End Try

Trace.WriteLine("-------------")

Next

Ken

----------------------------------

"Christoph Borger" <cb*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hello!
I have wrote a windows service in vb.net. This service monitors the running
processes with WMI and the Win32_Process class. Till last month all seems
ok. But since the begin of september the service can't retrieve the
commandline property of the processes. I think this is an result of .NET
Framework 1.1 Service Pack 1 or XP SP2.
Did somebody recognice the same effect? Did anybody knows how i can retrieve
the commandline property of processes that other users have started. This
problem only occurs when the service retrieve the process infos of other
users, system processes were retrieved completly with the commandline
property. When i use the code in a winform, my own processes where also
retrieved completly with the commandline property. But other user processes
have a blank commandline property too. The service is running under an
account, that was in the local admin group, so the service must have all
rights to acces the processinfos of the other users.

C. Borger

Nov 21 '05 #2
Thank you for your quick answer!
I tested the code, but it appears the same problem i have discribed in my
first posting. By the own processes and the system processes, the
CommandLine property is resolved correctly, but by the processes of the
other users, the CommandLine property is empty.
i have started the program normally, all my process command lines where
shown. I have started the program under the admin account, the process
command lines of my processes are emty! But the admin account must have
enough rights to retrieve my process command lines, because all other
properties were retrieved correctly, only the commandline and the executable
path properties fails!

C. Borger
"Ken Tucker [MVP]" <vb***@bellsouth.net> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

Seam to get an error with system idle process only. Try this.
' Add a Reference to System.Management

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Process")

moReturn = moSearch.Get

For Each mo In moReturn

Dim arOwner(2) As String

mo.InvokeMethod("GetOwner", arOwner)

Dim strOut As String

Trace.WriteLine("-------------")

strOut = String.Format("{0} Owner {1} Domain {2}", mo("Name"), arOwner(0),
arOwner(1))

Trace.WriteLine(strOut)

Try

Trace.WriteLine(mo("CommandLine").ToString)

Catch ex As System.Exception

Trace.WriteLine(ex.ToString)

End Try

Trace.WriteLine("-------------")

Next

Ken

----------------------------------

"Christoph Borger" <cb*****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hello!
I have wrote a windows service in vb.net. This service monitors the
running
processes with WMI and the Win32_Process class. Till last month all seems
ok. But since the begin of september the service can't retrieve the
commandline property of the processes. I think this is an result of .NET
Framework 1.1 Service Pack 1 or XP SP2.
Did somebody recognice the same effect? Did anybody knows how i can
retrieve
the commandline property of processes that other users have started. This
problem only occurs when the service retrieve the process infos of other
users, system processes were retrieved completly with the commandline
property. When i use the code in a winform, my own processes where also
retrieved completly with the commandline property. But other user
processes
have a blank commandline property too. The service is running under an
account, that was in the local admin group, so the service must have all
rights to acces the processinfos of the other users.

C. Borger

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: abovetreeline | last post by:
Hi, How to make javascript terminate a win32_process? vbscript will terminate a named process with the following code: strcomputer = "." Set objwmiservice = GetObject("winmgmts:" _ &...
4
by: nick | last post by:
Hi all: In the winform i want to run commandline with return value(string), then display this string in winform textbox. anyone has idea about that? Thanks Nick
3
by: Peter Neuburger via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Peter Neuburger Hi Everybody, I need some help with the WMI Terminate Method. I have a Listbox where I get all the Process...
5
by: jcrouse | last post by:
I have the following code: Dim MyStartupArguments() As String MyStartupArguments = System.Environment.GetCommandLineArgs UBound(MyStartupArguments) RomName =...
1
by: abcd | last post by:
I am using Python to create a process on another computer. Both computers are on the same domain with admin privileges. On computer B I have a batch script which starts a python script. From...
0
by: axlq | last post by:
While trying to learn the ins and outs of the php CURL library, I decided to write a php script that posts a form on the Chicago Board of Options (CBOE) web site, which returns an ASCII text file. ...
1
by: RSH | last post by:
Hi, I have a silly question... I have a Windows Form project (VB.Net) that was created in Visual Studio 2003. The project runs great. Now I have to add the ability to run the same...
2
by: andreas.huesgen | last post by:
Hello, I am writing a commandline tool in Python which is often feed with lots of commandline arguments. In practice, the commandline already reached a critical length which is to long for Windows...
1
by: Kerem Gümrükcü | last post by:
Hi, i try to create a remote process with Win32_Process.Create, but the remote machine always retruns 9 as result, which say that the path could not be found. Code seems to be fine, except the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.