-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: spark
Message 2 in Discussion
Hi,<o:p></o:p>
So I have been putting in a little more time into my perl script and
playing around a bit. (also learning some perl in the process). Some features have
been added so I thought an update is in order as well as some sort of documentation on
the command line switches. The script has been renamed to wmi.pl.<o:p></o:p>
<o:p> </o:p>
> wmi.pl <o:p></o:p>
lists all the running processes<o:p></o:p>
> wmi.pl �executablepath <o:p></o:p>
lists all the processes as well as their exe paths
> wmi.pl -<some name>
lists all the processes with the specified property of the process
displayed. <o:p></o:p>
> wmi.pl ? <o:p></o:p>
lists all the properties an methods available for a process. So you
can refer this list and ask for any other additional property in the previous command.
<o:p></o:p>
> wmi.pl -*<o:p></o:p>
will list all available information about every process on the system.
Information such as memory usage, kernel usage, thread count etc are available.
<o:p></o:p>
<o:p> </o:p>
Now for some generalizations:
> wmi.pl <class name> [some other commands]<o:p></o:p>
Will cause the rest of the command to execute for the given class
name. The default class name is win32_process which is the class that indicates
processes on a windows system. However providing a different class name causes the
same behavior, but for a different class. For example win32_share is the class name
for shares of your computer so �wmi.pl win32_share� will list all the shares and
�wmi.pl win32_share �path� will list the share names and their physical paths on your
computer. Win32_Service represents services on your computer, win32_logicaldisk
represent drives on your system and so on. All available properties about a
win32_logicaldisk maybe queried by typing �wmi.pl win32_logicaldisk ?�. simple
?<o:p></o:p>
<o:p> </o:p>
> wmi.pl dir<o:p></o:p>
will list all the available classes that you can query information
about. (this is a rather huge list so you may want to save this into a text
file)<o:p></o:p>
> wmi.pl @<server name> [some other parameters]<o:p></o:p>
will cause the whole command to run on a remote system where <server
name> is the system name or ip address. To execute this successfully your current
logged on user id should have admin rights on the remote system.<o:p></o:p>
<o:p> </o:p>
Now for something interesting:<o:p></o:p>
wmi.pl �terminate()<o:p></o:p>
will terminate every process on your system (that you have rights to
terminate)
wmi.pl <classname> -<property name>=<value> <methodname>() @<system name>
will call the method on every instance of the specified class where
the given property have the given value on the system specified. For example:
<o:p></o:p>
�wmi.pl @machine01 �name=IEXPLORE.EXE �terminate()� will close all browser instances
on the remote system.
�wmi.pl @machine01 win32_operatingsystem �reboot()� will reboot the remote machine.
<o:p></o:p>
<o:p> </o:p>
I haven�t finished shaking my head at the power of this API that has been ignored to
obscurity, and my neck�s beginning to hurt. Try your own stuff and in the meanwhile I
will be adding to the script. <o:p></o:p>
<o:p> </o:p>
Cheers<o:p></o:p>
Spark.<o:p></o:p>
<o:p> </o:p>
<o:p>ps. the followup mail has the new code </o:p>
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]