Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I get information from another computer using vbscript?

Status
Not open for further replies.

SteveMe

MIS
Aug 30, 2002
83
US
CreateObject("WScript.NetWork")

The above gets the local machine. Please advise
 
What exactly do you want from the remote machine? Some things you can do and some you can't. What information do you need to get back?

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Amount of Disk space
amount of free disk space

for all drives c, d, e

computer name
 
For the disk information you can query WMI on the remote machine. Look at the .Size and .FreeSpace properties of the Win32_LogicalDisk class. To get the machine name if you know the ip address you can shell out to ping or nslookup either one.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
While you're at the MS link, download Script-O-Matic. You'll find it to be greate assisance in writing WMI scripts.

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Here is a sample script for getting freespace. Change the "." in strComputer to "computername" for remote system.

Const CONVERSION_FACTOR = 1048576
strComputer = "computername"
Set objWMIService = GetObject("winmgmts://" & strComputer)
Set colLogicalDisk = objWMIService.InstancesOf("Win32_LogicalDisk")
wscript.Echo strComputer
For Each objLogicalDisk In colLogicalDisk
FreeMegaBytes = objLogicalDisk.FreeSpace / CONVERSION_FACTOR
Wscript.Echo objLogicalDisk.DeviceID & " " & Int(FreeMegaBytes)
Next




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top