Remote command

B

Brion Keagle

First, I admit I know very little about WMI. I can barely spell it. ;-)

But I understand I may be able to run a remote command using WMIC?

All I want to do is to run netstat against a remote computer. Can I do
this? Can someone please provide me an example of how?

Thanks in advance,
-Brion
 
T

Torgeir Bakken \(MVP\)

Brion said:
First, I admit I know very little about WMI. I can barely spell it. ;-)

But I understand I may be able to run a remote command using WMIC?

All I want to do is to run netstat against a remote computer. Can I do
this? Can someone please provide me an example of how?
Hi

A couple of non-WMI solutions (in addition to the one
mentioned by Sean):


PsExec.exe in the free PsTools suite, found at
http://www.sysinternals.com

PsExec can even automatically copy a file over to the remote computer
before it starts it.


Another freeware program with similar merits to PsExec is Beyondexec.
http://www.beyondlogic.org/consulting/remoteprocess/BeyondExec.htm

Beyondexec also have multiple computer functionality.
 
B

Brion Keagle

Thanks guys, for the links, but I'd rather do this using native Microsoft
controls. You see I want to script or compile this app once it's built. I
see all these suggestions throughout the WMI Help files which suggest that I
should be able to run tools like netstat against a remote machine. Yet I
can't find any specific help on how exactly to do it. If anyone has any
hints, I'd sure appreciate it.

Thanks!
-Brion
 
R

Rick Krause [MSFT]

You can use the Win32_Process to run an app, but on a remote machine it won't have a UI. That may not be an issue if the app is a console app and you can redirect the
output to a file.

Another limitation with Win32_Process comes into play if the target computer is part of an Active Directory. You won't be able to access the network from that computer
unless your network admins have enabled delegation for that machine.

One way to deal with those limitations is to use the Win32_ScheduledJob class to start the process instead of Win32_Process. You'll have to ensure that the AT Service
Account on the target system is logged on with an account that has network access if you need it.

Finally, if the tool you want to use allows you to specify the target computer, you can run the process on your local machine using any of the various scripting or win32
methods available. (For example, WSH's WshShell.Exec() or WshShell.Run() methods.)

--------------------
Thanks guys, for the links, but I'd rather do this using native Microsoft
controls. You see I want to script or compile this app once it's built. I
see all these suggestions throughout the WMI Help files which suggest that I
should be able to run tools like netstat against a remote machine. Yet I
can't find any specific help on how exactly to do it. If anyone has any
hints, I'd sure appreciate it.

Thanks!
-Brion
--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top