Re: I can't get this to output how I want



Try using this connection string instead:

Const BYTES_IN_MEG = 1048576
Const MEGS_IN_GIG = 1024
Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator")
UserName = ""
Password = ""


arrComputers = Array("sally") '. works but remote computers don't :S
For Each strComputer In arrComputers
WScript.Echo
"=============================­==============================­======"

WScript.Echo "Information about Network Connections on: " &
strComputer
WScript.Echo
"=============================­==============================­======"


Set objWMIService =
SWBemlocator.ConnectServer(strComputer,"\root\CIMV2",UserName,Password)
Set colItems = objWMIService.ExecQuery("Select * from
Win32_LogicalDisk WHERE DriveType=4",,48)

For Each objItem In colItems
WScript.Echo "Description: " & objItem.Description
WScript.Echo "DeviceID: " & objItem.DeviceID
WScript.Echo "ProviderName: " & objItem.ProviderName
WScript.Echo "FileSystem: " & objItem.FileSystem
WScript.Echo "FreeSpace: " & BytesToGigs( objItem.FreeSpace ) & "G"
WScript.Echo
Next
Next


Function BytesToGigs( sizeInBytes )
BytesToGigs = Round( ((sizeInBytes / BYTES_IN_MEG) / MEGS_IN_GIG), 2 )

End Function

.



Relevant Pages

  • Problems with registering Dlls
    ... Const WbemAuthenticationLevelPktPrivacy = 6 ... (strComputer, strNamespace, strUser, strPassword) ... Const OverwriteExisting = TRUE ... Set colItems = objWMIService.ExecQuery _ ...
    (microsoft.public.scripting.vbscript)
  • Re: HELP! Shutdown / ping script
    ... Dim objFSO, objTS, strComputer ... >I want to continue using PSShutdown for now. ... >Const OpenAsASCII = 0 ...
    (microsoft.public.scripting.vbscript)
  • Re: help with this script
    ... You assign a value to strComputer outside of your loop, ... Const ForReading = 1 ... ' If log file does not exist ...
    (microsoft.public.windows.server.scripting)
  • Re: What is error 80041003, please?
    ... Set colItems = objWMIService.ExecQuery("Select IPAddress from ... ' Please provide the following details for your SMTP server ... Const USE_AUTHENTICATION = True ...
    (microsoft.public.windows.server.scripting)
  • Re: IP Config data
    ... >I want to put an array of computers insted of strcomputer. ... You could create an array of hard coded computer names, ... Const OpenAsDefault = -2 ... Set objFile = objFSO.OpenTextFile(strTempFile, ForReading, _ ...
    (microsoft.public.scripting.vbscript)

Loading