How do I make this run on a list of computers from a text file?
Code:
Const ForAppending = 8
Dim objWMIService, objItem, colItems, strComputer
Dim strDriveType, strDiskSize, strDisk
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("\\path\status.txt", ForAppending, True)
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For Each objItem in colItems
Select Case objItem.DriveType
Case 1 strDriveType = "Drive could not be determined."
Case 2 strDriveType = "Removable Drive"
Case 3 strDriveType = "Local"
Case 4 strDriveType = "Network"
Case 5 strDriveType = "Compact"
Case 6 strDriveType = "RAM"
Case Else strDriveType = "Drive type Problem."
End Select
strDisk = strcomputer& objItem.Name & strDriveType
objTextFile.WriteLine(strDisk)
Next
objTextFile.Close