Posted on Leave a comment

Me perdi

Bueno estos dias he pensado en publicar esto o aquello pero nunca , la razon es que he estado fuera de forma con linux me he estado dedicando a cosas como averiguar servicetag equipo dell de la compañia me encontre este script en vbs.

  1. On Error Resume Next
  2. do while strcomputer = "" and a < 2
  3. strcomputer = Inputbox ("Introduce direccion IP o Nombre de Pc","Informacion Remota","IP")
  4. strcomputer = trim(strcomputer)
  5. a = a + 1
  6. loop
  7. if not strComputer <> "" then
  8. wscript.echo "No computer name entered, ending script"
  9. wscript.quit
  10. end if
  11. On Error Resume Next
  12. Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootCIMV2")
  13. if err.number <> 0 then
  14. if err.number = -2147217405 then
  15. wscript.echo "You do not have sufficient access rights to this computer"
  16. wscript.quit
  17. else
  18. wscript.echo "Could not locate computer" &vbcrlf& "Please check IP Address/Computer Name and try again"
  19. wscript.quit
  20. end if
  21. end if
  22. Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS")
  23. Set colItems1 = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
  24. Set colItems2 = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled = True")
  25. Set colitems3 = objWMIService.ExecQuery("SELECT * FROM Win32_computersystem")
  26. Set colitems4 = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkLoginProfile")
  27. Set colitems5 = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk Where DriveType = 3")
  28. Set objExplorer = CreateObject("InternetExplorer.Application")
  29. objExplorer.Navigate "about:blank"
  30. objExplorer.ToolBar = 0
  31. objExplorer.StatusBar = 0
  32. objExplorer.Width = 800
  33. objExplorer.Height = 600
  34. objExplorer.Left = 100
  35. objExplorer.Top = 100
  36. objExplorer.Visible = 1
  37. Do While (objExplorer.Busy)
  38. Loop
  39. Set objDocument = objExplorer.Document
  40. objDocument.Open
  41. objDocument.Writeln ""
  42. objDocument.Writeln ""
  43. ' Computer Detals
  44. For Each objItem In colItems
  45. serial = objitem.serialnumber
  46. next
  47. For Each objItem In colItems1
  48. hostname = objitem.caption
  49. make = objitem.manufacturer
  50. model = objitem.model
  51. next
  52. objDocument.Writeln "Computer Information For: " & Ucase(hostname) & "

    "
  53. objDocument.Writeln "Serial : " & Serial & "
    "
  54. objDocument.Writeln "Make : " & make & "
    "
  55. objDocument.Writeln "Model : " & Model & "
    "
  56. For Each objItem In colItems5
  57. driveletter = objitem.name
  58. capacity = ((objitem.size / 1024) / 1024) / 1024
  59. free = ((objitem.FreeSpace / 1024) / 1024) / 1024
  60. free = FormatNumber (free,2)
  61. capacity = FormatNumber (capacity,2)
  62. objDocument.Writeln "Capacity of " &driveletter& " - " & capacity & "GB
    "
  63. objDocument.Writeln "Free Space on " &driveletter& " - " & Free & "GB
    "
  64. next
  65. objDocument.Writeln "
    Please Wait, gathering more information...

    "
  66. ' User Details
  67. For Each objItem In colItems3
  68. loggedon = objitem.username
  69. next
  70. For Each objItem In colItems4
  71. cachedlog = objitem.name
  72. username = objitem.FullName
  73. passwordexpire = objitem.passwordexpires
  74. badpassword = objitem.badpasswordcount
  75. if loggedon = cachedlog then
  76. objDocument.Writeln "User Information For...
    "
  77. objDocument.Writeln "" & username & "

    "
  78. objDocument.Writeln " User Name :" & loggedon &"
    "
  79. objDocument.Writeln " Incorrect Password Attempts : " & badpassword &"
    "
  80. on error resume next
  81. Set objaccount = GetObject("WinNT://**********/" &objitem.caption & ",user")
  82. if Err.Number <> 0 Then
  83. objDocument.Writeln "unable to retrieve password expiration information
    "
  84. Else
  85. If objAccount.PasswordExpired = 1 Then
  86. objDocument.Writeln "Password has Expired!
    "
  87. Else
  88. objDocument.Writeln "Password Expires " & objAccount.PasswordExpirationDate & "

    "
  89. end if
  90. end if
  91. end if
  92. next
  93. ' Network Adapter Details
  94. For Each objItem In colItems2
  95. ipaddress = objitem.ipaddress(0)
  96. description = objitem.description
  97. DHCP = objitem.DHCPserver
  98. Domain = objitem.DNSdomain
  99. mac = objitem.MACaddress
  100. DNS = objitem.dnsserversearchorder(0)
  101. DNS1 = objitem.dnsserversearchorder(1)
  102. DNS2 = objitem.dnsserversearchorder(2)
  103. wins1 = objitem.winsprimaryserver
  104. wins2 = objitem.winssecondaryserver
  105. if not ipaddress = "0.0.0.0" then
  106. objDocument.Writeln "Network Adapter Details For...
    "
  107. objDocument.Writeln "" & description & "

    "
  108. objDocument.Writeln " IP Address :" & ipaddress &"
    "
  109. objDocument.Writeln " DHCP Server : " & DHCP &"
    "
  110. objDocument.Writeln " Domain Name : " & domain &"
    "
  111. objDocument.Writeln " MAC Address : " & mac &"
    "
  112. objDocument.Writeln " Primary DNS : " & DNS &"
    "
  113. objDocument.Writeln " Secondary DNS : " & DNS1 &"
    "
  114. objDocument.Writeln " Tertiary DNS : " & DNS2 &"
    "
  115. objDocument.Writeln " Primary WINS : " & wins1 &"
    "
  116. objDocument.Writeln " Secondary WINS : " & WINS2 &"

    "
  117. end if
  118. next
  119. objDocument.Writeln "Script Finished

    "

Te despliega en una ventana lo siguiente

Computer Information For: ES

Serial :

Make : Dell Inc.Model : OptiPlex

Capacity of C: –

Space on C:

Name :NETWORK

Incorrect Password Attempts : 0

Adapter Details For…Intel(R) 82566DM-2 Gigabit Network ConnectionIP Address :

Server :

Domain Name :

MAC Address :

DNS

DNS : Tertiary DNS : Primary WINS : Secondary WINS : Script Finished

Leave a Reply

Your email address will not be published. Required fields are marked *