SHARE
TWEET

Untitled

a guest Jan 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. const strReport = "d:\Resultado.txt"
  4. const sFile = "d:\ListadoDeEquipos.txt"
  5.  
  6. Dim objWMIService, objItem, colItems
  7. Dim strDriveType, strDiskSize, txt
  8.  
  9. Dim oFSO, oFile, sText,strComputer
  10. Set oFSO = CreateObject("Scripting.FileSystemObject")
  11.  
  12. Dim objFSO,objTextFile
  13. Set objFSO = createobject("Scripting.FileSystemObject")
  14. Set objTextFile = objFSO.CreateTextFile(strReport)
  15.  
  16.  
  17. If oFSO.FileExists(sFile) Then
  18. Set oFile = oFSO.OpenTextFile(sFile, 1)
  19.  Do While Not oFile.AtEndOfStream
  20.   sText = oFile.ReadLine
  21.    If Trim(sText) <> "" Then
  22.           strComputer=sText
  23.               Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
  24.               Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType=3")
  25.              txt = sText & vbtab & "Drive" & vbtab & "Size" & vbtab & "Used" & vbtab & "Free" & vbtab & "Free(%)" & vbcrlf
  26.         For Each objItem in colItems
  27.  
  28.              DIM pctFreeSpace,strFreeSpace,strusedSpace
  29.  
  30.              pctFreeSpace = INT((objItem.FreeSpace / objItem.Size) * 1000)/10
  31.        strDiskSize = Int(objItem.Size /1073741824) & "Gb"
  32.        strFreeSpace = Int(objItem.FreeSpace /1073741824) & "Gb"
  33.        strUsedSpace = Int((objItem.Size-objItem.FreeSpace)/1073741824) & "Gb"
  34.        txt = txt & vbtab & vbtab & objItem.Name & vbtab & strDiskSize & vbtab & strUsedSpace & vbTab & strFreeSpace & vbtab & pctFreeSpace & vbcrlf
  35.  
  36.         Next
  37.      
  38.      
  39.      objTextFile.Write(txt)
  40.      
  41.      
  42.      
  43.  
  44.  End If
  45.  Loop
  46.  objTextFile.Close
  47. oFile.Close
  48. Else
  49. WScript.Echo "No se encuentra el archivo."
  50. End If
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top