Reporting on Network Drives
EnumNetworkDrives is a method that returns a collection of data, here named drives, about the network drives. Any collection has a Count property and an Items property. The Count property reports the number of items in the collection. Note that the above script divides this number by 2 since each drive is reported twice. (For example, as P: and as \\cisdept\public.) We could access the name of each drive as drives.Item(k), but drives(k) is a shorter way to access the same thing. (This is because Item is the default property for collections.) Note that each variable is declared in VBScript via a Dim statement. Msgbox is used to display a message in a dialog box. The & concatenation operator is used by our script to keep appending new information to the msg string until we are ready to display it in a dialog box. The vbCRLF constant is obviously a carriage return/line feed combination. Back to the Using WSH to Automate Tasks page |