开发者

Running a Command that will run on every computer

I have this code which gives me all of the information I need r开发者_StackOverflow社区egarding tasks, information etc. I have it all shelled into a VB program and I want to be able to run this from one computer and have it return the data from all computers on the domain.

I am lost as to what to add next.

      Dim sCommand As String
      'all processes here, ipconfig, java info, etc etc
      sCommand = "java.exe -version2 > C:\Info.txt && ipconfig >> C:\INfo.txt"         
      Shell("cmd.exe /c" & sCommand)

I have script that will list all users on the domain, can I implement that or is there an easier way?

Edit: If I could search the entire domain for a specific file that would work too.

At the moment I just need all the data returned to a text file, I am not worried about it being sorted, or how long a process like this would take.

thanks a bunch


You could do one of two things.

1) You could use WMI to get both the network config off the remote machines and execute a process on the remote machine.

Or

2) You could use PsExec to kick off a command on a remote machine and pipe that out. I personally wouldn't use shell to execute a command as it's pretty poor really. If I was going to kick off a process locally I'd use this, and use StdOut to grab the output from the shell, parse it to give you something you can work with instead of piping the output to a file locally and then reading it later.

EDIT So you want to do all this from one central location? If you don't want to use PSExec, you'll have to use WMI to create a process on a remote machine to run the java.exe, but you can't redirect the output, you'll have to pipe to a file and read the file in another step.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜