none
Inventário da rede

    Soru

  • Pessoal, 

    Sou novo no assunto estou precisando de um Script VBS que pegue algumas informações nas estações de SW e HW.

    O Script eu consegui aqui no fórum mesmo de uma outro amigo, sendo que estou precisando adicionar um campo para verificar a placa de vídeo do computador também que essa informações sejam salvas em um EXCEL.

     

    Preciso que o Excel fique tipo assim:

    --------------------------------------------------------------

    | USER | HOSTNAME | IP |PROGRAMA INSTALADO |

    | ROBERTO |  ADM-FINAN01 |  192.168.145.10 | Adobe Flash Player 10 ActiveX 10.0.45.2 | 

    | RAFAEL | TI-01 |192.168.145.11 | Microsoft Office 2010 |

    --------------------------------------------------------------------

    SCRIPT:

     

    On error resume Next

    Const ForReading = 1

    Const ForAppending = 8

    Dim strLogDir

    Dim strCompName

    Dim strUserName

    Dim site

    strComputer = "."

    '### Se for servidor aborta o script ###

    Set os = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")

    For Each obj In os

        Set prps = obj.Properties_

        OSLang = prps("OSLanguage").value

        BldNum = prps("BuildNumber").value

    Next

    Select Case BldNum

        Case "2600" OPERATINGSYSTEM = "WINDOWS-XP"

        Case "2195" OPERATINGSYSTEM = "WINDOWS-2000"

        Case "1381" OPERATINGSYSTEM = "WINDOWS-NT"

        Case "3790" OPERATINGSYSTEM = "Windows 2003"

    End Select

     

    If OPERATINGSYSTEM <> "WINDOWS-XP" Then  'Colocar o VISTA e WIN7

    wscript.quit()

    End If

     

    Set WshShell = WScript.CreateObject("WScript.Shell")

    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")

    Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")

    Set colProcessors = objWMIService.ExecQuery("Select * from Win32_Processor")

    Set colDiskDrives = objWMIService.ExecQuery ("Select * from Win32_DiskDrive")

    Set colOSes = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product")

    Set IPConfigSet = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

     

    '### Se estação já foi inventariada finaliza script ###

    regkey = "HKCU\Software\Inventario\HardWare\Executado"

    regval = -1

    regval = WshShell.RegRead(regkey)

    If regval = "Sim" then 

    'WScript.Echo "Já Foi Executado"

    wscript.quit()

    Else 

    '### WScript.Echo "Não Foi Executado ###

    '### Executa o Script ###

     

        strCompName = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

        strUserName  = WshShell.ExpandEnvironmentStrings("%USERNAME%")

     

        strLogDir = "c:" 'Local onde log será salvo.

     

    Set objFSO = CreateObject("Scripting.FileSystemObject")

        Set objTextFile = objFSO.CreateTextFile(strLogDir & "\" & strCompName & ".log", True)

     

        objTextFile.WriteLine "************ Inventário Iniciado em " & Date & " ************ "

    objTextFile.WriteLine ""

        objTextFile.WriteLine "Nome do Usuário: " & strUserName

        objTextFile.WriteLine "Nome do Computador: " & strCompName

    objTextFile.WriteLine ""

     

    'IP

        For Each IPConfig in IPConfigSet

            If Not IsNull(IPConfig.IPAddress) Then

                For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)

                    objTextFile.WriteLine "Endereço de IP: " &  IPConfig.IPAddress(i)

                Next

            End If

    Next

        'Modelo e fabricante

        For Each objItem In colItems

    objTextFile.WriteLine ""

            objTextFile.WriteLine "Fabricante do Computador: " & objItem.Manufacturer

            objTextFile.WriteLine "Modelo do Computador: " & objItem.Model

            objTextFile.WriteLine "Total Memória Fisica: " & objItem.TotalPhysicalMemory

            objTextFile.WriteLine "Numero de Processadores: " & objItem.NumberOfProcessors

       objTextFile.WriteLine "Dominio: " & objItem.Domain

        Next

        'Processador

        For Each objProcessor in colProcessors

    objTextFile.WriteLine ""

            objTextFile.WriteLine "Fabricante do Processador: " & objProcessor.Manufacturer

            objTextFile.WriteLine "Nome do Processador: " & Trim(objProcessor.Name)

            objTextFile.WriteLine "Descrição do Processador: " & objProcessor.Description

            'objTextFile.WriteLine "Address Width: " & objProcessor.AddressWidth

            'objTextFile.WriteLine "Data Width: " & objProcessor.DataWidth

        Next

        'Hard Disk

        For each objDiskDrive in colDiskDrives 

    objTextFile.WriteLine ""

            objTextFile.WriteLine "Nome do HD: "  &  objDiskDrive.Caption

            objTextFile.WriteLine "Tipo de Interface: "  & objDiskDrive.InterfaceType

            objTextFile.WriteLine "Modelo do HD: " &  objDiskDrive.Model

            objTextFile.WriteLine "Tamanho: " & vbTab &  objDiskDrive.Size    

        Next

        'Sistema Operacional

    DIM OSNome

    For Each objOS in colOSes

    objTextFile.WriteLine ""

            objTextFile.WriteLine "Sistema Operacional: " & objOS.Caption 'Name

    OSNome = objOS.Caption

            objTextFile.WriteLine "Versão: " & objOS.Version 'Version & build

            objTextFile.WriteLine "Service Pack: " & objOS.ServicePackMajorVersion & "." & objOS.ServicePackMinorVersion

        Next

     

     

     

    '#### Licenças do Windows ####

     

    objTextFile.WriteLine ""

    objTextFile.WriteLine "Licenças:"

     

    CONST HKEY_LOCAL_MACHINE = &H80000002

    CONST SEARCH_KEY = "DigitalProductID"

    Dim arrSubKeys(4,1)

    Dim foundKeys

    Dim iValues, arrDPID

    foundKeys = Array()

    iValues = Array()

    arrSubKeys(0,0) = OSNome

    arrSubKeys(0,1) = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"

    arrSubKeys(2,0) = "Microsoft Office XP"

    arrSubKeys(2,1) = "SOFTWARE\Microsoft\Office\10.0\Registration"

    arrSubKeys(1,0) = "Microsoft Office 2003"

    arrSubKeys(1,1) = "SOFTWARE\Microsoft\Office\11.0\Registration"

    arrSubKeys(3,0) = "Microsoft Office 2007"

    arrSubKeys(3,1) = "SOFTWARE\Microsoft\Office\12.0\Registration"

    arrSubKeys(4,0) = "Microsoft Exchange Product Key"

    arrSubKeys(4,1) = "SOFTWARE\Microsoft\Exchange\Setup"

     

    ' <--------------- Open Registry Key and populate binary data into an array -------------------------->

    strComputer = "."

    Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

     

    For x = LBound(arrSubKeys, 1) To UBound(arrSubKeys, 1)

    oReg.GetBinaryValue HKEY_LOCAL_MACHINE, arrSubKeys(x,1), SEARCH_KEY, arrDPIDBytes

    If Not IsNull(arrDPIDBytes) Then

     call decodeKey(arrDPIDBytes, arrSubKeys(x,0))

    Else

     oReg.EnumKey HKEY_LOCAL_MACHINE, arrSubKeys(x,1), arrGUIDKeys

     If Not IsNull(arrGUIDKeys) Then

      For Each GUIDKey In arrGUIDKeys

       oReg.GetBinaryValue HKEY_LOCAL_MACHINE, arrSubKeys(x,1) & "\" & GUIDKey, SEARCH_KEY, arrDPIDBytes

       If Not IsNull(arrDPIDBytes) Then

        call decodeKey(arrDPIDBytes, arrSubKeys(x,0))

       End If

      Next

     End If

    End If

    Next

    'MsgBox("Finished")

     

    ' <----------------------------------------- Return the Product Key --------------------------------------------------->

    Function decodeKey(iValues, strProduct)

     

    Dim arrDPID

    arrDPID = Array()

     

    ' <--------------- extract bytes 52-66 of the DPID -------------------------->

    For i = 52 to 66

     ReDim Preserve arrDPID( UBound(arrDPID) + 1 )

     arrDPID( UBound(arrDPID) ) = iValues(i)

    Next

     

    ' <--------------- Create an array to hold the valid characters for a microsoft Product Key -------------------------->

    Dim arrChars

    arrChars = Array("B","C","D","F","G","H","J","K","M","P","Q","R","T","V","W","X","Y","2","3","4","6","7","8","9")

     

    ' <--------------- The clever bit !!! (decode the base24 encoded binary data)-------------------------->

    For i = 24 To 0 Step -1

     k = 0

     For j = 14 To 0 Step -1

      k = k * 256 Xor arrDPID(j)

      arrDPID(j) = Int(k / 24)

      k = k Mod 24

     Next

     strProductKey = arrChars(k) & strProductKey

     If i Mod 5 = 0 And i <> 0 Then strProductKey = "-" & strProductKey

    Next

     

    ReDim Preserve foundKeys( UBound(foundKeys) + 1 )

    foundKeys( UBound(foundKeys) ) = strProductKey

    strKey = UBound(foundKeys)

     

    objTextFile.WriteLine strProduct & "  :  " & foundKeys(strKey) & vbNewLine

    End Function

     

    ' ####  FIM  ####

     

     

     'Softwares Instalados

     

    Set colSoftware = objWMIService.ExecQuery  ("Select * from Win32_Product")

    objTextFile.WriteLine ""

    objTextFile.WriteLine "SOFTWARES INSTALADOS:"

     

    For Each objSoftware in colSoftware

     

    Nome = objSoftware.Name

    Versao = objSoftware.Version

    Data =  MID(objSoftware.InstallDate,7,2) & "/" & MID(objSoftware.InstallDate,5,2) & "/" & MID(objSoftware.InstallDate,1,4)

        'Wscript.Echo data

     

        objTextFile.WriteLine("Name: " & Nome & "  :  Versão: " & versao & "  :  Data Instalação: " & Data)

    Next

     

     'Marca estação para não rodar novamente

    '    regkey = "HKCU\Software\Inventario\HardWare\Executado"

    '    regval = "Sim"

    '    WshShell.regWrite regkey, regval, "REG_SZ"

     

    objTextFile.WriteLine ""

        objTextFile.WriteLine "************ Inventário Finalizado em " & Date & " ************"

        objTextFile.Close

     

    End If

     

    MsgBox("Inventario Finalizado")

    WScript.Quit

     

     

     

     

     

     

    Desde já agradeço


    Att,
    Rafael Claro
    MCP + MCDST
    MSN: clarocoelho@hotmail.com
    27 Ocak 2011 Perşembe 03:18

Yanıtlar

  • Amigo, acho que isso pode ajudar..usei em uma grande instituiçao financeira..e foi muito positivo

     

    '
    'Descricao: Inventario automatizado de Servidor
    'Autor: Robson Franco	
    'Data : Abril/2010
    'Versão: V1.6
    '
    
    On Error Resume Next
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
        Set objNetwork = CreateObject("WScript.Network")
        STRcomputer =objNetwork.ComputerName
        STRTipoServer = "MS"
        'Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
        On Error Resume Next
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objtextfile = objFSO.deleteFile(STRcomputer & ".HTML")
        Set objtextfile = objFSO.CreateTextFile(STRcomputer & ".HTML", Forwritting)
        Objtextfile.writeline "<html>"
        Objtextfile.writeline "<!-----Inventario de Servidor----->"
        Objtextfile.writeline "<!-----Robson Franco----->"
        Objtextfile.writeline "<!-----2010----->"
        Objtextfile.writeline "<!-----Versão 1.5----->"
        Objtextfile.writeline "<TFOOT STYLE='font-weight:bold; color:#FFFFFF'>"
        Objtextfile.writeline "<TR>"
        Objtextfile.writeline "<TD COLSPAN=5 ALIGN='center'>"
        Objtextfile.writeline "</B>"
        Objtextfile.writeline "</TR>"
        Objtextfile.writeline "</TFOOT>"
    
        Lin_log = 4
        Set objNetwork = CreateObject("WScript.Network")
    
        objtextfile.WriteLine "<center><a name='#menu'></center></a>"
        objtextfile.WriteLine "<br>"
        objtextfile.WriteLine "<center><H1><b> Inventario de Servidor </b></h1></center>"
        objtextfile.WriteLine "<!WKS" & STRcomputer & "Fim_WKS>"
        objtextfile.WriteLine "<center><H1><b>" & STRcomputer & "</b></h1></center>"
       '
        Objtextfile.writeline "<Font face='arial'><ol>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#SO'>Sistema Operacional</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#proc'>Processadores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#bios'>Bios e Hardware</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#rede'>Configurações de Rede</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#tcp'>Configurações TCP/IP</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#discos'>Configurações de Discos</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#controladores'>Placas  Controladores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#backup'>Unidade de Backup</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#usuarios'>Usuarios Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#software'>Softwares Instalados</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#servicos'>Status dos Serviços</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#compartilhamentos'>Compartilhamentos  Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#impressora'>Impressoras Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#portas'>Portas de Impressora</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#event'>Event Viewer</a></li></h5>"
        Objtextfile.writeline "</ol></font>"
       '
        set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _
                      & STRcomputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
        objtextfile.WriteLine "<ul>"
          objtextfile.WriteLine "<li><b><h2><a name='#SO'> Sistema Operacional</a></h2></b>"
        For Each objItem In colItems
         dtmConvertedDate.Value = objItem.InstallDate
           dtmInstallDate = dtmConvertedDate.GetVarDate
         objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<!SO" & objItem.Caption & "Fim_SO>"
           objtextfile.WriteLine "<Font face='arial'><li><pre>" & objItem.Caption & "</font>"
               objtextfile.WriteLine "<Font face='arial'><li>Versão..............................: " &   objItem.Version & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Service Pack....................: " &   objItem.ServicePackMajorVersion & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Outras descrições...........: " & objItem.OtherTypeDescription & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Boot Device.....................: " & objItem.BootDevice & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Diretorio Instalação..........: " & objItem.WindowsDirectory & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Data de Instalação...........: " & dtmInstallDate & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Organização....................: " & objItem.Organization & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Usuario Registrado..........: " & objItem.RegisteredUser & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Serial Numbe...................: " & objItem.SerialNumber & "</font>"
       Next
       Set ZoneSet = GetObject("winmgmts:").InstancesOf ("Win32_TimeZone")
       for each System in ZoneSet
        objtextfile.WriteLine "<Font face='arial'><li>Time Zone........................:" & System.StandardName & "</font></pre>"
       next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</font></ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Processadores
       Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#proc'> Processadores</a></h2></b>"
    
       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<Font face='arial'><li>" & objItem.Description
         Objtextfile.writeline "<!Processador>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.Name
         Objtextfile.writeline "<!Fim_Proc>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.MaxClockSpeed & " MHZ"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Informações da BIOS
       Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><a name='#bios'>BIOS / Hardware</a></b>"
    
       For Each objbios In colBIOS
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<!Fabricante>"
         objtextfile.WriteLine "<li><pre>Fabricante  : " & objbios.Manufacturer
         objtextfile.WriteLine "<!Fim_Fabricante>"
         objtextfile.WriteLine "<!Serie>"
         objtextfile.WriteLine "<li>Serie         : " & objbios.SerialNumber
         objtextfile.WriteLine "<!Fim_Serie>"
         objtextfile.WriteLine "<li>" & objbios.Name
         objtextfile.WriteLine "<li>Release Date     : " & (Mid(objbios.ReleaseDate, 7, 2)) & "/" & (Mid(objbios.ReleaseDate, 5, 2)) & "/" & (Left(objbios.ReleaseDate, 4))
         objtextfile.WriteLine "<li>SMBIOS Version    : " & objbios.SMBIOSBIOSVersion
         objtextfile.WriteLine "<li>BIOS Version    : " & CStr(objbios.Version)
         objtextfile.WriteLine "</ul>"
       Next
    
       ' Coletando Modelo do Equipamento
       Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
       For Each objComputer In colSettings
         objtextfile.WriteLine "<ul><Font face='arial'>"
         objtextfile.WriteLine "<!Modelo>"
         objtextfile.WriteLine "<li><pre>Modelo Equipamento : " & objComputer.Model & "</pre>"
         objtextfile.WriteLine "<!Fim_Modelo>"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       objtextfile.WriteLine "</ul>"
       w_tipos = Array("Unknown", "Other", "DRAM,Synchronous DRAM", "Cache DRAM", "EDO,EDRAM", "VRAM", "SRAM", _
              "RAM", "ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", _
              "RDRAM", "DDR")
       totalslots = 0
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2> Memória</h2></b>"
    
       Set SlotMem = objWMIService.ExecQuery _
         ("Select * from Win32_PhysicalMemoryArray")
         For Each objItem In SlotMem
           totalslots = totalslots + objItem.MemoryDevices
         Next
       totalpentes = 0
       Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")
       cont_mem=0
       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li>" & objItem.Tag
         objtextfile.WriteLine " " & Int(objItem.Capacity / 1024 / 1024)
         objtextfile.WriteLine " " & w_tipos(objItem.MemoryType)
         objtextfile.WriteLine " " & objItem.BankLabel
         objtextfile.WriteLine " " & "Ativa"
         totalpentes = totalpentes + 1
         objtextfile.WriteLine "</ul>"
       cont_mem = cont_mem + objItem.Capacity
       Next
    
         objtextfile.WriteLine "<!Memoria" & Int(cont_mem / 1024 / 1024) & "Fim_Mem>"
    
       For i = totalpentes + 1 To totalslots
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li> Physical Memory "  & i - 1
         objtextfile.WriteLine " Vazio"
         objtextfile.WriteLine "</ul>"
       Next
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery( _
         "SELECT * FROM Win32_PageFileUsage",,48)
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<ul><br>"
       objtextfile.WriteLine "<Font face='arial'><b> Arquivo de Paginação</b><br>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>localização</center></td><td><center>Tamanho</center></td><td><center>Utilização Atual</center></td><td><center>" & _
       "Pico de Utilização</center></td></tr>"
       For Each objItem In colItems
         wlinha = " "
         wlinha = "<center><tr><td>"
         wlinha=wlinha & objItem.Description & "</td></center><td><center>"
         wlinha=wlinha & objItem.AllocatedBaseSize & "MB" & "</td></center><td><center>"
         wlinha=wlinha & objItem.CurrentUsage & "MB"& "</td></center><td><center>"
         wlinha=wlinha & objItem.PeakUsage & "MB" & "</td></center></tr>"
         objtextfile.WriteLine wlinha
       Next
       objtextfile.WriteLine "</table>"
       objtextfile.WriteLine "</ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Placas de Rede
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#rede'> Componentes de Rede</a></h2></b>"
    
       w_Status = Array("Device is working properly.", _
       "Device is not configured correctly.", _
       "Windows cannot load the driver for this device.", _
       "Driver for this device might be corrupted, or the system may be low on memory or other resources.", _
       "Device is not working properly. One of its drivers or the registry might be corrupted.", _
       "Driver for the device requires a resource that Windows cannot manage.", _
       "Boot configuration for the device conflicts with other devices.", _
       "Cannot filter.", "Driver loader for the device is missing.", _
       "Device is not working properly; the controlling firmware is incorrectly reporting the resources for the device.", _
       "Device cannot start.", "Device failed.", "Device cannot find enough free resources to use.", _
       "Windows cannot verify the device's resources.", "Device cannot work properly until the computer is restarted.", _
       "Device is not working properly due to a possible re-enumeration problem.", _
       "Windows cannot identify all of the resources that the device uses.", _
       "Device is requesting an unknown resource type.", "Device drivers need to be reinstalled.", _
       "Failure using the VxD loader.", "Registry might be corrupted.", _
       "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device.", _
       "Device is disabled.", "System failure. If changing the device driver is ineffective, see the hardware documentation.", _
       "Device is not present, not working properly", _
       "Windows is still setting up the device.", "Windows is still setting up the device.", _
       "Device does not have valid log configuration.", "Device drivers are not installed.", _
       "Device is disabled; the device firmware did not provide the required resources.", _
       "Device is using an IRQ resource that another device is using.", _
       "Device is not working properly; Windows cannot load the required device drivers.")
    
       w_statusinfo = Array("Disconnected", "Connecting", "Connected", "Disconnecting", _
                  "Hardware Not present", "Hardware disabled", "Hardware malfunction", _
                  "Media disconnected", "Authenticating", "Authentication succeeded", _
                  "Authentication failed", "Invalid Address", "Credentials required")
    
    
       Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter") '
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1100>"
       objtextfile.WriteLine "<tr><td><center>Tipo de Adaptador</center></td><td><center>Descriçao</center></td><td><center>Mac Address</center></td><td><center>" & _
       "Fabricante</center></td><td><center>Status</center></td><td><center>Nome da Conexao</center></td><td><center>Velocidade</center></td></tr>"
       For Each objItem In colItems2
         If IsNull(objItem.AdapterType) then
          wTipo = "-"
         else
          wTipo = objItem.AdapterType
         end if
         If IsNull(objItem.MACAddress) then
          wMac = "- "
         Else
          wMac = objItem.MACAddress
         end if
       '  If IsNull(objItem.StatusInfo) then
       '   wMac = "-"
       '  Else
       '   wMac = objItem.StatusInfo
       ' end if
         If IsNull(objItem.NetConnectionID) Then
          wconnection = "-"
         Else
          wconnection = objItem.NetConnectionID
         end if
         If IsNull(objItem.speed) Then
          wvelocidade = "-"
         Else
          wvelocidade = objItem.speed
         end if
    
         objtextfile.WriteLine "<Font face='arial'><tr><td>" & wTipo & "</td><td>" & objItem.Description & "</td><td>" & _
         wMac & "</td><td>" & objItem.Manufacturer & "</td><td >" & _
         w_Status(objItem.ConfigManagerErrorCode) & "</td><td>" & wconnection & "</td><td>" & wvelocidade & "</td></tr>"
    
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       objtextfile.writeline "<li><b><h2><a name='#tcp'> Endereços TCP/IP</a></h2></b>"
       Set colftp = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
       objtextfile.writeline "</ul>"
       'objtextfile.writeline "<table border=2 width=100%>"
       'objtextfile.writeline "<tr><td><center>Placa de rede</center></td><td><center>Endereco TCP/IP</center></td><td><center>Mascara</center></td><td><center>" & _
       '"Tipo IP</center></td><td><center>Default Gateway</center></td><td><center>DNS Server</center></td><td><center>Wins Server</center></td></tr>"
    
    
    'Nome placa
    For Each objftp In colftp
      wlinha = " "
      wlinha = "<table border=2 width=100% bgcolor=#666666>"
      wlinha = wlinha + "<tr><td width=15%><center><b><font color=#FFFFFF>Placa</b></center></font></td><td><center><b><font color=#FFFFFF><!Nome_Pl" & objftp.Description & "Fim_Pl>" + objftp.Description + "</td></b></center></font><td><center><b><font color=#FFFFFF>"
    
      'DHCP ou Estatico
      If objftp.dhcpenabled Then
        wlinha = wlinha + "IP Dinamico" + "</td></b></center></font><td>"
      Else
        wlinha = wlinha + "IP Estatico" + "</td></b></center></font><td>"
      End If
    
    wlinha = wlinha + "</table>"
    wlinha = wlinha + "<table border=1 width=100%>"
    
    'End_IP
      wlinha = wlinha + "<tr><td width=15%>IP</td><td>"
      strIP = 1
      For Each StrIPaddress In objftp.IPAddress
        wlinha = wlinha + "<!IP" & strIP & StrIPaddress & "Fim_IP" & strIP & ">" + StrIPaddress + "</td><td>"
        strIP = strIP + 1
        'objtextfile.writeline "<!End_IP" & StrIPaddress & "Fim_IP>"
      Next
    
    'Mascara
      wlinha = wlinha + "<tr><td width=15%>Mascara</td><td>"
      For Each strIPSubnet In objftp.IPSubnet
        wlinha = wlinha + strIPSubnet + "</td><td>"
      Next
    
    'Gateway
      wlinha = wlinha + "<tr><td width=15%>Gateway</td><td>"
      For Each strDefaultIPGatewaY In objftp.DefaultIPGateway
        If IsEmpty(strDefaultIPGatewaY) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDefaultIPGatewaY + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"
    
    'DNS
      wlinha = wlinha + "<tr><td width=15%>DNS</td><td>"
      For Each strDNSServer In objftp.DNSServerSearchOrder
        If IsEmpty(strDNSServer) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDNSServer + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"
    
    'Wins
      wlinha = wlinha + "<tr><td width=15%>Wins</td><td>"
      If IsNull(objftp.WINSPrimaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "<br>"
      Else
        wlinha = wlinha + objftp.WINSPrimaryServer + "<br>"
      End If
      If IsNull(objftp.WINSSecondaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "</td><td>"
      Else
        wlinha = wlinha + objftp.WINSSecondaryServer + "</td><td>"
      End If
    
    wlinha = wlinha + "</table>"
    objtextfile.writeline wlinha
    Next
    
       objtextfile.writeline "</table>"
       objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         objtextfile.WriteLine "<table border=2 width=400>"
         objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tipo</center></td></tr>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
          Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk")
          For Each objDisk in colDisks
             W_ID= objDisk.DeviceID
         Select Case objDisk.DriveType
           Case 1
             W_ID1 = "Tipo de Disco não Detectado"
           Case 2
             W_ID1 = "Disco removível ou Disquete"
           Case 3
             W_ID1 = "Disco Rígido Local"
           Case 4
             W_ID1 ="Drive de Rede"
           Case 5
             W_ID1 = "Unidade de CD"
           Case 6
             W_ID1 ="RAM disk."
           Case Else
             W_ID1 = "Tipo de Disco não Detectado"
         End Select
         objtextfile.WriteLine "<tr><td><center>" & W_ID & "</center></td><td><center>" & W_ID1 & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
    
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Detalhe dos Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colDiskDrives = objWMIService.ExecQuery ("Select * from Win32_DiskDrive")
         strDisk = 1
       For each objDiskDrive in colDiskDrives
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<li><pre><b>Caption:         </b>" & ltrim(objDiskDrive.Caption )
         objtextfile.WriteLine "<li><b>Device ID:        </b>" & ltrim(objDiskDrive.DeviceID )
         objtextfile.WriteLine "<li><b>Interface Type:     </b>" & ltrim(objDiskDrive.InterfaceType)
         objtextfile.WriteLine "<li><b>Manufacturer:      </b>" & ltrim(objDiskDrive.Manufacturer)
         objtextfile.WriteLine "<li><b>Model:          </b>" & ltrim(objDiskDrive.Model)
         objtextfile.WriteLine "<li><b>Name:          </b>" & ltrim(objDiskDrive.Name)
         objtextfile.WriteLine "<li><b>Partitions:       </b>" & ltrim(objDiskDrive.Partitions)
         objtextfile.WriteLine "<li><b>SCSI Bus:        </b>" & ltrim(objDiskDrive.SCSIBus)
         objtextfile.WriteLine "<li><b>SCSI Logical Unit:    </b>" & ltrim(objDiskDrive.SCSILogicalUnit)
         objtextfile.WriteLine "<li><b>SCSI Port:        </b>" & ltrim(objDiskDrive.SCSIPort)
         objtextfile.WriteLine "<li><b>SCSI TargetId:      </b>" & ltrim(objDiskDrive.SCSITargetId)
         objtextfile.WriteLine "<!Disco" & strDisk & int(objDiskDrive.Size/1024/1024) & "Fim_Disco" & strDisk & ">"
         objtextfile.WriteLine "<li><b>Size:          </b>" & int(objDiskDrive.Size/1024/1024) & "MB"
         objtextfile.WriteLine "<li><b>Status:         </b>" & ltrim(objDiskDrive.Status)
         objtextfile.WriteLine "</ul>"
    	 strDisk = strDisk+1
       Next
    
       '
       ' Discos lógicos
       Const HARD_DISK = 3
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Partições</a></h2></b>"
       Set colDiskDrives = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tamanho (MB)</center></td><td><center>Tipo Partiçao" & _
       "</td><td><center>Espaço Livre(MB)</center></td></tr>"
       For Each objdisk In colDiskDrives
         objtextfile.WriteLine "<tr><td><center>" & objdisk.DeviceID & "</center></td><td><center>" & " " _
         & Int(objdisk.Size / 1024 / 1024) & "</center></td><td><center>" & " " _
         & objdisk.FileSystem & "</center></td><td><center>" _
          & int(objDisk.FreeSpace/(1024*1024)) & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
    
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Unidade de CDROM</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
       For Each objItem in colItems
          objtextfile.WriteLine "<tr><td>" & objItem.Caption & "</td></td>"
       Next
    
    
       '
       'Controladoras de Disco"
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#controladoras'> Controladoras de Disco</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=600>"
       objtextfile.WriteLine "<tr><td><center>Controladora</center></td><td><center>Driver</center></td><td><center>Fabricante</center></td><td><center>Status</center></td></tr>"
       Set wplaca = objWMIService.ExecQuery("Select * from Win32_SCSIController")
       For Each objplaca In wplaca
       objtextfile.WriteLine "<tr><td>" & objplaca.Name & "</td><td>" & " " _
       & objplaca.DriverName & "</td><td>" & " " _
       & objplaca.Manufacturer & "</td><td>" & " " _
       & objplaca.Status & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#backup'> Unidade de Backup</a></h2></b></ul>"
       objtextfile.WriteLine "<table>"
       Set wfita = objWMIService.ExecQuery("Select * from Win32_TapeDrive")
       For Each objfita In wfita
         objtextfile.WriteLine "<tr><td>" & objfita.Caption & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta usuarios locais
       Set colAccounts = GetObject("WinNT://" & STRcomputer & "")
       Set colGroups = GetObject("WinNT://" & STRcomputer & "")
       colAccounts.Filter = Array("user")
       colGroups.Filter = Array("group")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#usuarios'> Usuarios Locais</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1000>"
        objtextfile.WriteLine "<tr><td><center>Login</center></td><td><center>Nome Completo</center></td><td><center>Descriçao</center>" & _
       "</td><td><center>Status</center></td><td><center>Grupos</center></td></tr>"
       For Each objUser In colAccounts
         Wgrupo = " "
         If objUser.AccountDisabled then
        wstatus = "Inativa"
         Else
        wstatus = "Ativa"
         End if
         For Each objGroup In colGroups
           For Each objuserMBR In objGroup.Members
             If objuserMBR.Name = objUser.Name Then
               Wgrupo = Wgrupo & objGroup.Name & "<br>"
             End If
           Next
         Next
         If Len(objUser.FullName) <= 1 Then
           wfulname = "-"
         Else
          wfulname = objUser.FullName
         End If
         If Len(objUser.Description) <= 1 then
        wdescricao = "-"
         else
        wdescricao = objUser.Description
         end if
         objtextfile.WriteLine "<tr><td>" & objUser.Name & "</td><td>" & " " _
         & wfulname & "</td><td>" _
         & wdescricao & "</td><td>" _
         & wstatus & "</td><td>" _
         & Wgrupo & "</td></tr> "
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Software
       Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
       strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
       strEntry1a = "DisplayName"
       strEntry1b = "QuietDisplayName"
       strEntry2 = "InstallDate"
       strEntry3 = "VersionMajor"
       strEntry4 = "VersionMinor"
       strEntry5 = "EstimatedSize"
    
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#software'> Softwares Instalados</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "<table border=2>"
        objtextfile.WriteLine "<tr><td>Software / Hotfix</td></tr>"
       Set objReg = GetObject("winmgmts://" & STRcomputer & _
        "/root/default:StdRegProv")
       objReg.EnumKey HKLM, strKey, arrSubkeys
       For Each strSubkey In arrSubkeys
       '  wlinha = "<tr><td>"
         wlinha=""
        intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
         strEntry1a, strValue1)
        If intRet1 <> 0 Then
         objReg.GetStringValue HKLM, strKey & strSubkey, _
          strEntry1b, strValue1
        End If
        If strValue1 <> "" Then
         wlinha = wlinha + strValue1 '+ "</td><td>"
        End If
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
        strEntry3, intValue3
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
         strEntry4, intValue4
        If intValue3 <> "" Then
          wlinha = wlinha + intValue3 + "." + intValue4 '"</td></tr>"
        End If
        If Len(wlinha) > 8 Then
         objtextfile.WriteLine wlinha + "<br>"
        End If
       Next
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Serviços
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
        Set colListOfServices = objWMIService.ExecQuery _
           ("Select * from Win32_Service")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#servicos'> Serviços</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=800>"
       objtextfile.WriteLine "<tr><td><b><center>Serviço</center></b></td><td><b><center>Startup</center></b></td><td><b>" & _
       "<center>Status</center></b></td><td><b><center>Usuario de Startup</center></b></b></td></tr>"
       For Each objService In colListOfServices
         if objService.State = "Stopped" then
        wfonte= "<font color=red>"
         else
        wfonte = "<font>"
         end if
         objtextfile.WriteLine "<tr><td><i>" & wfonte & objService.Caption & "</font></i></td><td><i>" & _
         wfonte & objService.StartMode & "</font></i></td><td><i>" & _
         wfonte & objService.State & "</font></i></td><td><i>" & _
         wfonte & objService.StartName & "</font></i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Tamanho dos Diretorios
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
    
       Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")
    
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#compartilhamentos'>Compartilhamentos</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Compartilhamento</center></b></td><td><b><center>" & _
       "Caminho</center></b></b></td></tr>"
    
       For Each objShare In colShares
         objtextfile.WriteLine "<tr><td><i>" & objShare.Name & "</i></td><td><i>" _
         & objShare.Path & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
       Set colInstalledPrinters = objWMIService.ExecQuery _
         ("Select * from Win32_PrinterDriver")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#impressora'> Drivers de Impressoras</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b>Impressora Local</b></b></td></tr>"
    
       For Each objPrinter In colInstalledPrinters
         objtextfile.WriteLine "<tr><td><i>" & objPrinter.Name & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta portas de impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
    
       Set colPorts = objWMIService.ExecQuery _
         ("Select * from Win32_TCPIPPrinterPort")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#portas'> Portas de Impressora</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Impressora Local</center></b></td><td><b><center>Endereco Host</center></b></td><td><b>" & _
       "<center>Porta</center></b></td><td><b><center>Protocolo</center></b></b></td></tr>"
       For Each objPort In colPorts
         objtextfile.WriteLine "<tr><td><i>" & objPort.Description & "</i></td><td><i>" & _
         objPort.HostAddress & "</i></td><td><i>" & _
         objPort.Name & "</i></td><td><i>" & _
         objPort.PortNumber & "</i></td><td><i>" & _
         objPort.Protocol & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#event'> Event Viewer</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=100>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate,(Security)}!\\" & _
           strComputer & "\root\cimv2")
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='Security'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Security </i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='application'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Application</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='system'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>System</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       Objtextfile.writeline "</html>"
    
    
    wscript.echo "FIM"
    

    28 Ocak 2011 Cuma 15:33
  • Boa Tarde Washington Alves,

    Não sei quem realmente é o autor desse script, mas segue script que salva na rede (deixarei em negrito onde você deve alterar conforme sua demanda de salvar na rede. (Só copiar e colar, o autor ja coloquei o seu nome.)



    On Error Resume Next

    Set objFSO = CreateObject("Scripting.FileSystemObject")

        Set objNetwork = CreateObject("WScript.Network")
        STRcomputer =objNetwork.ComputerName
        STRusername =objNetwork.UserName
        STRdomain  =objNetwork.UserDomain
        STRTipoServer = "MS"
        'Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
        On Error Resume Next
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objtextfile = objFSO.deleteFile(STRcomputer & ".HTML")
        Set objtextfile = objFSO.CreateTextFile("\\155.155.101.151\publico$\" & STRcomputer & ".HTML", Forwritting)
        Objtextfile.writeline "<html>"
        Objtextfile.writeline "<!-----Inventario----->"
        Objtextfile.writeline "<!-----Washington Alves----->"
        Objtextfile.writeline "<!-----2012----->"
        Objtextfile.writeline "<!-----Versão 1.6----->"
        Objtextfile.writeline "<TFOOT STYLE='font-weight:bold; color:#FFFFFF'>"
        Objtextfile.writeline "<TR>"
        Objtextfile.writeline "<TD COLSPAN=5 ALIGN='center'>"
        Objtextfile.writeline "</B>"
        Objtextfile.writeline "</TR>"
        Objtextfile.writeline "</TFOOT>"

        Lin_log = 4
        Set objNetwork = CreateObject("WScript.Network")

        objtextfile.WriteLine "<center><a name='#menu'></center></a>"
        objtextfile.WriteLine "<br>"
        objtextfile.WriteLine "<center><H1><b> Inventario de Servidor </b></h1></center>"
        objtextfile.WriteLine "<!WKS" & STRcomputer & "Fim_WKS>"
        objtextfile.WriteLine "<center>Gerado por:<H1><b>" & STRdomain & "\" & STRusername & "</b></h1></center>"
        objtextfile.WriteLine "<center><H1><b>" & STRcomputer & "</b></h1></center>"
       '
        Objtextfile.writeline "<Font face='arial'><ol>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#SO'>Sistema Operacional</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#proc'>Processadores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#bios'>Bios e Hardware</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#rede'>Configurações de Rede</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#tcp'>Configurações TCP/IP</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#discos'>Configurações de Discos</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#controladores'>Placas  Controladores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#backup'>Unidade de Backup</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#usuarios'>Usuarios Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#software'>Softwares Instalados</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#servicos'>Status dos Serviços</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#compartilhamentos'>Compartilhamentos  Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#impressora'>Impressoras Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#portas'>Portas de Impressora</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#event'>Event Viewer</a></li></h5>"
        Objtextfile.writeline "</ol></font>"
       '
        set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _
                      & STRcomputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
        objtextfile.WriteLine "<ul>"
          objtextfile.WriteLine "<li><b><h2><a name='#SO'> Sistema Operacional</a></h2></b>"
        For Each objItem In colItems
         dtmConvertedDate.Value = objItem.InstallDate
           dtmInstallDate = dtmConvertedDate.GetVarDate
         objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<!SO" & objItem.Caption & "Fim_SO>"
           objtextfile.WriteLine "<Font face='arial'><li><pre>" & objItem.Caption & "</font>"
               objtextfile.WriteLine "<Font face='arial'><li>Versão..............................: " &   objItem.Version & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Service Pack....................: " &   objItem.ServicePackMajorVersion & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Outras descrições...........: " & objItem.OtherTypeDescription & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Boot Device.....................: " & objItem.BootDevice & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Diretorio Instalação..........: " & objItem.WindowsDirectory & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Data de Instalação...........: " & dtmInstallDate & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Organização....................: " & objItem.Organization & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Usuario Registrado..........: " & objItem.RegisteredUser & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Serial Numbe...................: " & objItem.SerialNumber & "</font>"
       Next
       Set ZoneSet = GetObject("winmgmts:").InstancesOf ("Win32_TimeZone")
       for each System in ZoneSet
        objtextfile.WriteLine "<Font face='arial'><li>Time Zone........................:" & System.StandardName & "</font></pre>"
       next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</font></ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Processadores
       Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#proc'> Processadores</a></h2></b>"

       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<Font face='arial'><li>" & objItem.Description
         Objtextfile.writeline "<!Processador>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.Name
         Objtextfile.writeline "<!Fim_Proc>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.MaxClockSpeed & " MHZ"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Informações da BIOS
       Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><a name='#bios'>BIOS / Hardware</a></b>"

       For Each objbios In colBIOS
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<!Fabricante>"
         objtextfile.WriteLine "<li><pre>Fabricante  : " & objbios.Manufacturer
         objtextfile.WriteLine "<!Fim_Fabricante>"
         objtextfile.WriteLine "<!Serie>"
         objtextfile.WriteLine "<li>Serie         : " & objbios.SerialNumber
         objtextfile.WriteLine "<!Fim_Serie>"
         objtextfile.WriteLine "<li>" & objbios.Name
         objtextfile.WriteLine "<li>Release Date     : " & (Mid(objbios.ReleaseDate, 7, 2)) & "/" & (Mid(objbios.ReleaseDate, 5, 2)) & "/" & (Left(objbios.ReleaseDate, 4))
         objtextfile.WriteLine "<li>SMBIOS Version    : " & objbios.SMBIOSBIOSVersion
         objtextfile.WriteLine "<li>BIOS Version    : " & CStr(objbios.Version)
         objtextfile.WriteLine "</ul>"
       Next

       ' Coletando Modelo do Equipamento
       Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
       For Each objComputer In colSettings
         objtextfile.WriteLine "<ul><Font face='arial'>"
         objtextfile.WriteLine "<!Modelo>"
         objtextfile.WriteLine "<li><pre>Modelo Equipamento : " & objComputer.Model & "</pre>"
         objtextfile.WriteLine "<!Fim_Modelo>"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       objtextfile.WriteLine "</ul>"
       w_tipos = Array("Unknown", "Other", "DRAM,Synchronous DRAM", "Cache DRAM", "EDO,EDRAM", "VRAM", "SRAM", _
              "RAM", "ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", _
              "RDRAM", "DDR")
       totalslots = 0
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2> Memória</h2></b>"

       Set SlotMem = objWMIService.ExecQuery _
         ("Select * from Win32_PhysicalMemoryArray")
         For Each objItem In SlotMem
           totalslots = totalslots + objItem.MemoryDevices
         Next
       totalpentes = 0
       Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")
       cont_mem=0
       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li>" & objItem.Tag
         objtextfile.WriteLine " " & Int(objItem.Capacity / 1024 / 1024)
         objtextfile.WriteLine " " & w_tipos(objItem.MemoryType)
         objtextfile.WriteLine " " & objItem.BankLabel
         objtextfile.WriteLine " " & "Ativa"
         totalpentes = totalpentes + 1
         objtextfile.WriteLine "</ul>"
       cont_mem = cont_mem + objItem.Capacity
       Next

         objtextfile.WriteLine "<!Memoria" & Int(cont_mem / 1024 / 1024) & "Fim_Mem>"

       For i = totalpentes + 1 To totalslots
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li> Physical Memory "  & i - 1
         objtextfile.WriteLine " Vazio"
         objtextfile.WriteLine "</ul>"
       Next
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery( _
         "SELECT * FROM Win32_PageFileUsage",,48)
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<ul><br>"
       objtextfile.WriteLine "<Font face='arial'><b> Arquivo de Paginação</b><br>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>localização</center></td><td><center>Tamanho</center></td><td><center>Utilização Atual</center></td><td><center>" & _
       "Pico de Utilização</center></td></tr>"
       For Each objItem In colItems
         wlinha = " "
         wlinha = "<center><tr><td>"
         wlinha=wlinha & objItem.Description & "</td></center><td><center>"
         wlinha=wlinha & objItem.AllocatedBaseSize & "MB" & "</td></center><td><center>"
         wlinha=wlinha & objItem.CurrentUsage & "MB"& "</td></center><td><center>"
         wlinha=wlinha & objItem.PeakUsage & "MB" & "</td></center></tr>"
         objtextfile.WriteLine wlinha
       Next
       objtextfile.WriteLine "</table>"
       objtextfile.WriteLine "</ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Placas de Rede
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#rede'> Componentes de Rede</a></h2></b>"

       w_Status = Array("Device is working properly.", _
       "Device is not configured correctly.", _
       "Windows cannot load the driver for this device.", _
       "Driver for this device might be corrupted, or the system may be low on memory or other resources.", _
       "Device is not working properly. One of its drivers or the registry might be corrupted.", _
       "Driver for the device requires a resource that Windows cannot manage.", _
       "Boot configuration for the device conflicts with other devices.", _
       "Cannot filter.", "Driver loader for the device is missing.", _
       "Device is not working properly; the controlling firmware is incorrectly reporting the resources for the device.", _
       "Device cannot start.", "Device failed.", "Device cannot find enough free resources to use.", _
       "Windows cannot verify the device's resources.", "Device cannot work properly until the computer is restarted.", _
       "Device is not working properly due to a possible re-enumeration problem.", _
       "Windows cannot identify all of the resources that the device uses.", _
       "Device is requesting an unknown resource type.", "Device drivers need to be reinstalled.", _
       "Failure using the VxD loader.", "Registry might be corrupted.", _
       "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device.", _
       "Device is disabled.", "System failure. If changing the device driver is ineffective, see the hardware documentation.", _
       "Device is not present, not working properly", _
       "Windows is still setting up the device.", "Windows is still setting up the device.", _
       "Device does not have valid log configuration.", "Device drivers are not installed.", _
       "Device is disabled; the device firmware did not provide the required resources.", _
       "Device is using an IRQ resource that another device is using.", _
       "Device is not working properly; Windows cannot load the required device drivers.")

       w_statusinfo = Array("Disconnected", "Connecting", "Connected", "Disconnecting", _
                  "Hardware Not present", "Hardware disabled", "Hardware malfunction", _
                  "Media disconnected", "Authenticating", "Authentication succeeded", _
                  "Authentication failed", "Invalid Address", "Credentials required")


       Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter") '
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1100>"
       objtextfile.WriteLine "<tr><td><center>Tipo de Adaptador</center></td><td><center>Descriçao</center></td><td><center>Mac Address</center></td><td><center>" & _
       "Fabricante</center></td><td><center>Status</center></td><td><center>Nome da Conexao</center></td><td><center>Velocidade</center></td></tr>"
       For Each objItem In colItems2
         If IsNull(objItem.AdapterType) then
          wTipo = "-"
         else
          wTipo = objItem.AdapterType
         end if
         If IsNull(objItem.MACAddress) then
          wMac = "- "
         Else
          wMac = objItem.MACAddress
         end if
       '  If IsNull(objItem.StatusInfo) then
       '   wMac = "-"
       '  Else
       '   wMac = objItem.StatusInfo
       ' end if
         If IsNull(objItem.NetConnectionID) Then
          wconnection = "-"
         Else
          wconnection = objItem.NetConnectionID
         end if
         If IsNull(objItem.speed) Then
          wvelocidade = "-"
         Else
          wvelocidade = objItem.speed
         end if

         objtextfile.WriteLine "<Font face='arial'><tr><td>" & wTipo & "</td><td>" & objItem.Description & "</td><td>" & _
         wMac & "</td><td>" & objItem.Manufacturer & "</td><td >" & _
         w_Status(objItem.ConfigManagerErrorCode) & "</td><td>" & wconnection & "</td><td>" & wvelocidade & "</td></tr>"

       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       objtextfile.writeline "<li><b><h2><a name='#tcp'> Endereços TCP/IP</a></h2></b>"
       Set colftp = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
       objtextfile.writeline "</ul>"
       'objtextfile.writeline "<table border=2 width=100%>"
       'objtextfile.writeline "<tr><td><center>Placa de rede</center></td><td><center>Endereco TCP/IP</center></td><td><center>Mascara</center></td><td><center>" & _
       '"Tipo IP</center></td><td><center>Default Gateway</center></td><td><center>DNS Server</center></td><td><center>Wins Server</center></td></tr>"


    'Nome placa
    For Each objftp In colftp
      wlinha = " "
      wlinha = "<table border=2 width=100% bgcolor=#666666>"
      wlinha = wlinha + "<tr><td width=15%><center><b><font color=#FFFFFF>Placa</b></center></font></td><td><center><b><font color=#FFFFFF><!Nome_Pl" & objftp.Description & "Fim_Pl>" + objftp.Description + "</td></b></center></font><td><center><b><font color=#FFFFFF>"

      'DHCP ou Estatico
      If objftp.dhcpenabled Then
        wlinha = wlinha + "IP Dinamico" + "</td></b></center></font><td>"
      Else
        wlinha = wlinha + "IP Estatico" + "</td></b></center></font><td>"
      End If

    wlinha = wlinha + "</table>"
    wlinha = wlinha + "<table border=1 width=100%>"

    'End_IP
      wlinha = wlinha + "<tr><td width=15%>IP</td><td>"
      strIP = 1
      For Each StrIPaddress In objftp.IPAddress
        wlinha = wlinha + "<!IP" & strIP & StrIPaddress & "Fim_IP" & strIP & ">" + StrIPaddress + "</td><td>"
        strIP = strIP + 1
        'objtextfile.writeline "<!End_IP" & StrIPaddress & "Fim_IP>"
      Next

    'Mascara
      wlinha = wlinha + "<tr><td width=15%>Mascara</td><td>"
      For Each strIPSubnet In objftp.IPSubnet
        wlinha = wlinha + strIPSubnet + "</td><td>"
      Next

    'Gateway
      wlinha = wlinha + "<tr><td width=15%>Gateway</td><td>"
      For Each strDefaultIPGatewaY In objftp.DefaultIPGateway
        If IsEmpty(strDefaultIPGatewaY) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDefaultIPGatewaY + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"

    'DNS
      wlinha = wlinha + "<tr><td width=15%>DNS</td><td>"
      For Each strDNSServer In objftp.DNSServerSearchOrder
        If IsEmpty(strDNSServer) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDNSServer + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"

    'Wins
      wlinha = wlinha + "<tr><td width=15%>Wins</td><td>"
      If IsNull(objftp.WINSPrimaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "<br>"
      Else
        wlinha = wlinha + objftp.WINSPrimaryServer + "<br>"
      End If
      If IsNull(objftp.WINSSecondaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "</td><td>"
      Else
        wlinha = wlinha + objftp.WINSSecondaryServer + "</td><td>"
      End If

    wlinha = wlinha + "</table>"
    objtextfile.writeline wlinha
    Next

       objtextfile.writeline "</table>"
       objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         objtextfile.WriteLine "<table border=2 width=400>"
         objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tipo</center></td></tr>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
          Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk")
          For Each objDisk in colDisks
             W_ID= objDisk.DeviceID
         Select Case objDisk.DriveType
           Case 1
             W_ID1 = "Tipo de Disco não Detectado"
           Case 2
             W_ID1 = "Disco removível ou Disquete"
           Case 3
             W_ID1 = "Disco Rígido Local"
           Case 4
             W_ID1 ="Drive de Rede"
           Case 5
             W_ID1 = "Unidade de CD"
           Case 6
             W_ID1 ="RAM disk."
           Case Else
             W_ID1 = "Tipo de Disco não Detectado"
         End Select
         objtextfile.WriteLine "<tr><td><center>" & W_ID & "</center></td><td><center>" & W_ID1 & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"

       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Detalhe dos Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colDiskDrives = objWMIService.ExecQuery ("Select * from Win32_DiskDrive")
         strDisk = 1
       For each objDiskDrive in colDiskDrives
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<li><pre><b>Caption:         </b>" & ltrim(objDiskDrive.Caption )
         objtextfile.WriteLine "<li><b>Device ID:        </b>" & ltrim(objDiskDrive.DeviceID )
         objtextfile.WriteLine "<li><b>Interface Type:     </b>" & ltrim(objDiskDrive.InterfaceType)
         objtextfile.WriteLine "<li><b>Manufacturer:      </b>" & ltrim(objDiskDrive.Manufacturer)
         objtextfile.WriteLine "<li><b>Model:          </b>" & ltrim(objDiskDrive.Model)
         objtextfile.WriteLine "<li><b>Name:          </b>" & ltrim(objDiskDrive.Name)
         objtextfile.WriteLine "<li><b>Partitions:       </b>" & ltrim(objDiskDrive.Partitions)
         objtextfile.WriteLine "<li><b>SCSI Bus:        </b>" & ltrim(objDiskDrive.SCSIBus)
         objtextfile.WriteLine "<li><b>SCSI Logical Unit:    </b>" & ltrim(objDiskDrive.SCSILogicalUnit)
         objtextfile.WriteLine "<li><b>SCSI Port:        </b>" & ltrim(objDiskDrive.SCSIPort)
         objtextfile.WriteLine "<li><b>SCSI TargetId:      </b>" & ltrim(objDiskDrive.SCSITargetId)
         objtextfile.WriteLine "<!Disco" & strDisk & int(objDiskDrive.Size/1024/1024) & "Fim_Disco" & strDisk & ">"
         objtextfile.WriteLine "<li><b>Size:          </b>" & int(objDiskDrive.Size/1024/1024) & "MB"
         objtextfile.WriteLine "<li><b>Status:         </b>" & ltrim(objDiskDrive.Status)
         objtextfile.WriteLine "</ul>"
      strDisk = strDisk+1
       Next

       '
       ' Discos lógicos
       Const HARD_DISK = 3
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Partições</a></h2></b>"
       Set colDiskDrives = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tamanho (MB)</center></td><td><center>Tipo Partiçao" & _
       "</td><td><center>Espaço Livre(MB)</center></td></tr>"
       For Each objdisk In colDiskDrives
         objtextfile.WriteLine "<tr><td><center>" & objdisk.DeviceID & "</center></td><td><center>" & " " _
         & Int(objdisk.Size / 1024 / 1024) & "</center></td><td><center>" & " " _
         & objdisk.FileSystem & "</center></td><td><center>" _
          & int(objDisk.FreeSpace/(1024*1024)) & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"

       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Unidade de CDROM</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
       For Each objItem in colItems
          objtextfile.WriteLine "<tr><td>" & objItem.Caption & "</td></td>"
       Next


       '
       'Controladoras de Disco"
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#controladoras'> Controladoras de Disco</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=600>"
       objtextfile.WriteLine "<tr><td><center>Controladora</center></td><td><center>Driver</center></td><td><center>Fabricante</center></td><td><center>Status</center></td></tr>"
       Set wplaca = objWMIService.ExecQuery("Select * from Win32_SCSIController")
       For Each objplaca In wplaca
       objtextfile.WriteLine "<tr><td>" & objplaca.Name & "</td><td>" & " " _
       & objplaca.DriverName & "</td><td>" & " " _
       & objplaca.Manufacturer & "</td><td>" & " " _
       & objplaca.Status & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#backup'> Unidade de Backup</a></h2></b></ul>"
       objtextfile.WriteLine "<table>"
       Set wfita = objWMIService.ExecQuery("Select * from Win32_TapeDrive")
       For Each objfita In wfita
         objtextfile.WriteLine "<tr><td>" & objfita.Caption & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta usuarios locais
       Set colAccounts = GetObject("WinNT://" & STRcomputer & "")
       Set colGroups = GetObject("WinNT://" & STRcomputer & "")
       colAccounts.Filter = Array("user")
       colGroups.Filter = Array("group")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#usuarios'> Usuarios Locais</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1000>"
        objtextfile.WriteLine "<tr><td><center>Login</center></td><td><center>Nome Completo</center></td><td><center>Descriçao</center>" & _
       "</td><td><center>Status</center></td><td><center>Grupos</center></td></tr>"
       For Each objUser In colAccounts
         Wgrupo = " "
         If objUser.AccountDisabled then
        wstatus = "Inativa"
         Else
        wstatus = "Ativa"
         End if
         For Each objGroup In colGroups
           For Each objuserMBR In objGroup.Members
             If objuserMBR.Name = objUser.Name Then
               Wgrupo = Wgrupo & objGroup.Name & "<br>"
             End If
           Next
         Next
         If Len(objUser.FullName) <= 1 Then
           wfulname = "-"
         Else
          wfulname = objUser.FullName
         End If
         If Len(objUser.Description) <= 1 then
        wdescricao = "-"
         else
        wdescricao = objUser.Description
         end if
         objtextfile.WriteLine "<tr><td>" & objUser.Name & "</td><td>" & " " _
         & wfulname & "</td><td>" _
         & wdescricao & "</td><td>" _
         & wstatus & "</td><td>" _
         & Wgrupo & "</td></tr> "
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Software
       Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
       strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
       strEntry1a = "DisplayName"
       strEntry1b = "QuietDisplayName"
       strEntry2 = "InstallDate"
       strEntry3 = "VersionMajor"
       strEntry4 = "VersionMinor"
       strEntry5 = "EstimatedSize"

       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#software'> Softwares Instalados</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "<table border=2>"
        objtextfile.WriteLine "<tr><td>Software / Hotfix</td></tr>"
       Set objReg = GetObject("winmgmts://" & STRcomputer & _
        "/root/default:StdRegProv")
       objReg.EnumKey HKLM, strKey, arrSubkeys
       For Each strSubkey In arrSubkeys
       '  wlinha = "<tr><td>"
         wlinha=""
        intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
         strEntry1a, strValue1)
        If intRet1 <> 0 Then
         objReg.GetStringValue HKLM, strKey & strSubkey, _
          strEntry1b, strValue1
        End If
        If strValue1 <> "" Then
         wlinha = wlinha + strValue1 '+ "</td><td>"
        End If
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
        strEntry3, intValue3
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
         strEntry4, intValue4
        If intValue3 <> "" Then
          wlinha = wlinha + intValue3 + "." + intValue4 '"</td></tr>"
        End If
        If Len(wlinha) > 8 Then
         objtextfile.WriteLine wlinha + "<br>"
        End If
       Next
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Serviços
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
        Set colListOfServices = objWMIService.ExecQuery _
           ("Select * from Win32_Service")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#servicos'> Serviços</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=800>"
       objtextfile.WriteLine "<tr><td><b><center>Serviço</center></b></td><td><b><center>Startup</center></b></td><td><b>" & _
       "<center>Status</center></b></td><td><b><center>Usuario de Startup</center></b></b></td></tr>"
       For Each objService In colListOfServices
         if objService.State = "Stopped" then
        wfonte= "<font color=red>"
         else
        wfonte = "<font>"
         end if
         objtextfile.WriteLine "<tr><td><i>" & wfonte & objService.Caption & "</font></i></td><td><i>" & _
         wfonte & objService.StartMode & "</font></i></td><td><i>" & _
         wfonte & objService.State & "</font></i></td><td><i>" & _
         wfonte & objService.StartName & "</font></i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Tamanho dos Diretorios
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")

       Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")

       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#compartilhamentos'>Compartilhamentos</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Compartilhamento</center></b></td><td><b><center>" & _
       "Caminho</center></b></b></td></tr>"

       For Each objShare In colShares
         objtextfile.WriteLine "<tr><td><i>" & objShare.Name & "</i></td><td><i>" _
         & objShare.Path & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
       Set colInstalledPrinters = objWMIService.ExecQuery _
         ("Select * from Win32_PrinterDriver")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#impressora'> Drivers de Impressoras</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b>Impressora Local</b></b></td></tr>"

       For Each objPrinter In colInstalledPrinters
         objtextfile.WriteLine "<tr><td><i>" & objPrinter.Name & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta portas de impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")

       Set colPorts = objWMIService.ExecQuery _
         ("Select * from Win32_TCPIPPrinterPort")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#portas'> Portas de Impressora</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Impressora Local</center></b></td><td><b><center>Endereco Host</center></b></td><td><b>" & _
       "<center>Porta</center></b></td><td><b><center>Protocolo</center></b></b></td></tr>"
       For Each objPort In colPorts
         objtextfile.WriteLine "<tr><td><i>" & objPort.Description & "</i></td><td><i>" & _
         objPort.HostAddress & "</i></td><td><i>" & _
         objPort.Name & "</i></td><td><i>" & _
         objPort.PortNumber & "</i></td><td><i>" & _
         objPort.Protocol & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#event'> Event Viewer</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=100>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate,(Security)}!\\" & _
           strComputer & "\root\cimv2")
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='Security'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Security </i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='application'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Application</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='system'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>System</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       Objtextfile.writeline "</html>"


    wscript.echo "INVENTARIADO"


    Rafael S. AMARAL
    23 Ocak 2012 Pazartesi 19:06
  • Afinal pq vcs não usam o OCS-Inventory? 
    É uma otima ferramenta, instala agente remotamente dá logs sempre a não ser que queiram algo "agentless".
    Warley
    02 Şubat 2012 Perşembe 17:32

Tüm Yanıtlar

  • Amigo, acho que isso pode ajudar..usei em uma grande instituiçao financeira..e foi muito positivo

     

    '
    'Descricao: Inventario automatizado de Servidor
    'Autor: Robson Franco	
    'Data : Abril/2010
    'Versão: V1.6
    '
    
    On Error Resume Next
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
        Set objNetwork = CreateObject("WScript.Network")
        STRcomputer =objNetwork.ComputerName
        STRTipoServer = "MS"
        'Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
        On Error Resume Next
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objtextfile = objFSO.deleteFile(STRcomputer & ".HTML")
        Set objtextfile = objFSO.CreateTextFile(STRcomputer & ".HTML", Forwritting)
        Objtextfile.writeline "<html>"
        Objtextfile.writeline "<!-----Inventario de Servidor----->"
        Objtextfile.writeline "<!-----Robson Franco----->"
        Objtextfile.writeline "<!-----2010----->"
        Objtextfile.writeline "<!-----Versão 1.5----->"
        Objtextfile.writeline "<TFOOT STYLE='font-weight:bold; color:#FFFFFF'>"
        Objtextfile.writeline "<TR>"
        Objtextfile.writeline "<TD COLSPAN=5 ALIGN='center'>"
        Objtextfile.writeline "</B>"
        Objtextfile.writeline "</TR>"
        Objtextfile.writeline "</TFOOT>"
    
        Lin_log = 4
        Set objNetwork = CreateObject("WScript.Network")
    
        objtextfile.WriteLine "<center><a name='#menu'></center></a>"
        objtextfile.WriteLine "<br>"
        objtextfile.WriteLine "<center><H1><b> Inventario de Servidor </b></h1></center>"
        objtextfile.WriteLine "<!WKS" & STRcomputer & "Fim_WKS>"
        objtextfile.WriteLine "<center><H1><b>" & STRcomputer & "</b></h1></center>"
       '
        Objtextfile.writeline "<Font face='arial'><ol>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#SO'>Sistema Operacional</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#proc'>Processadores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#bios'>Bios e Hardware</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#rede'>Configurações de Rede</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#tcp'>Configurações TCP/IP</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#discos'>Configurações de Discos</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#controladores'>Placas  Controladores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#backup'>Unidade de Backup</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#usuarios'>Usuarios Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#software'>Softwares Instalados</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#servicos'>Status dos Serviços</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#compartilhamentos'>Compartilhamentos  Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#impressora'>Impressoras Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#portas'>Portas de Impressora</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#event'>Event Viewer</a></li></h5>"
        Objtextfile.writeline "</ol></font>"
       '
        set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _
                      & STRcomputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
        objtextfile.WriteLine "<ul>"
          objtextfile.WriteLine "<li><b><h2><a name='#SO'> Sistema Operacional</a></h2></b>"
        For Each objItem In colItems
         dtmConvertedDate.Value = objItem.InstallDate
           dtmInstallDate = dtmConvertedDate.GetVarDate
         objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<!SO" & objItem.Caption & "Fim_SO>"
           objtextfile.WriteLine "<Font face='arial'><li><pre>" & objItem.Caption & "</font>"
               objtextfile.WriteLine "<Font face='arial'><li>Versão..............................: " &   objItem.Version & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Service Pack....................: " &   objItem.ServicePackMajorVersion & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Outras descrições...........: " & objItem.OtherTypeDescription & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Boot Device.....................: " & objItem.BootDevice & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Diretorio Instalação..........: " & objItem.WindowsDirectory & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Data de Instalação...........: " & dtmInstallDate & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Organização....................: " & objItem.Organization & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Usuario Registrado..........: " & objItem.RegisteredUser & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Serial Numbe...................: " & objItem.SerialNumber & "</font>"
       Next
       Set ZoneSet = GetObject("winmgmts:").InstancesOf ("Win32_TimeZone")
       for each System in ZoneSet
        objtextfile.WriteLine "<Font face='arial'><li>Time Zone........................:" & System.StandardName & "</font></pre>"
       next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</font></ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Processadores
       Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#proc'> Processadores</a></h2></b>"
    
       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<Font face='arial'><li>" & objItem.Description
         Objtextfile.writeline "<!Processador>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.Name
         Objtextfile.writeline "<!Fim_Proc>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.MaxClockSpeed & " MHZ"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Informações da BIOS
       Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><a name='#bios'>BIOS / Hardware</a></b>"
    
       For Each objbios In colBIOS
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<!Fabricante>"
         objtextfile.WriteLine "<li><pre>Fabricante  : " & objbios.Manufacturer
         objtextfile.WriteLine "<!Fim_Fabricante>"
         objtextfile.WriteLine "<!Serie>"
         objtextfile.WriteLine "<li>Serie         : " & objbios.SerialNumber
         objtextfile.WriteLine "<!Fim_Serie>"
         objtextfile.WriteLine "<li>" & objbios.Name
         objtextfile.WriteLine "<li>Release Date     : " & (Mid(objbios.ReleaseDate, 7, 2)) & "/" & (Mid(objbios.ReleaseDate, 5, 2)) & "/" & (Left(objbios.ReleaseDate, 4))
         objtextfile.WriteLine "<li>SMBIOS Version    : " & objbios.SMBIOSBIOSVersion
         objtextfile.WriteLine "<li>BIOS Version    : " & CStr(objbios.Version)
         objtextfile.WriteLine "</ul>"
       Next
    
       ' Coletando Modelo do Equipamento
       Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
       For Each objComputer In colSettings
         objtextfile.WriteLine "<ul><Font face='arial'>"
         objtextfile.WriteLine "<!Modelo>"
         objtextfile.WriteLine "<li><pre>Modelo Equipamento : " & objComputer.Model & "</pre>"
         objtextfile.WriteLine "<!Fim_Modelo>"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       objtextfile.WriteLine "</ul>"
       w_tipos = Array("Unknown", "Other", "DRAM,Synchronous DRAM", "Cache DRAM", "EDO,EDRAM", "VRAM", "SRAM", _
              "RAM", "ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", _
              "RDRAM", "DDR")
       totalslots = 0
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2> Memória</h2></b>"
    
       Set SlotMem = objWMIService.ExecQuery _
         ("Select * from Win32_PhysicalMemoryArray")
         For Each objItem In SlotMem
           totalslots = totalslots + objItem.MemoryDevices
         Next
       totalpentes = 0
       Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")
       cont_mem=0
       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li>" & objItem.Tag
         objtextfile.WriteLine " " & Int(objItem.Capacity / 1024 / 1024)
         objtextfile.WriteLine " " & w_tipos(objItem.MemoryType)
         objtextfile.WriteLine " " & objItem.BankLabel
         objtextfile.WriteLine " " & "Ativa"
         totalpentes = totalpentes + 1
         objtextfile.WriteLine "</ul>"
       cont_mem = cont_mem + objItem.Capacity
       Next
    
         objtextfile.WriteLine "<!Memoria" & Int(cont_mem / 1024 / 1024) & "Fim_Mem>"
    
       For i = totalpentes + 1 To totalslots
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li> Physical Memory "  & i - 1
         objtextfile.WriteLine " Vazio"
         objtextfile.WriteLine "</ul>"
       Next
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery( _
         "SELECT * FROM Win32_PageFileUsage",,48)
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<ul><br>"
       objtextfile.WriteLine "<Font face='arial'><b> Arquivo de Paginação</b><br>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>localização</center></td><td><center>Tamanho</center></td><td><center>Utilização Atual</center></td><td><center>" & _
       "Pico de Utilização</center></td></tr>"
       For Each objItem In colItems
         wlinha = " "
         wlinha = "<center><tr><td>"
         wlinha=wlinha & objItem.Description & "</td></center><td><center>"
         wlinha=wlinha & objItem.AllocatedBaseSize & "MB" & "</td></center><td><center>"
         wlinha=wlinha & objItem.CurrentUsage & "MB"& "</td></center><td><center>"
         wlinha=wlinha & objItem.PeakUsage & "MB" & "</td></center></tr>"
         objtextfile.WriteLine wlinha
       Next
       objtextfile.WriteLine "</table>"
       objtextfile.WriteLine "</ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Placas de Rede
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#rede'> Componentes de Rede</a></h2></b>"
    
       w_Status = Array("Device is working properly.", _
       "Device is not configured correctly.", _
       "Windows cannot load the driver for this device.", _
       "Driver for this device might be corrupted, or the system may be low on memory or other resources.", _
       "Device is not working properly. One of its drivers or the registry might be corrupted.", _
       "Driver for the device requires a resource that Windows cannot manage.", _
       "Boot configuration for the device conflicts with other devices.", _
       "Cannot filter.", "Driver loader for the device is missing.", _
       "Device is not working properly; the controlling firmware is incorrectly reporting the resources for the device.", _
       "Device cannot start.", "Device failed.", "Device cannot find enough free resources to use.", _
       "Windows cannot verify the device's resources.", "Device cannot work properly until the computer is restarted.", _
       "Device is not working properly due to a possible re-enumeration problem.", _
       "Windows cannot identify all of the resources that the device uses.", _
       "Device is requesting an unknown resource type.", "Device drivers need to be reinstalled.", _
       "Failure using the VxD loader.", "Registry might be corrupted.", _
       "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device.", _
       "Device is disabled.", "System failure. If changing the device driver is ineffective, see the hardware documentation.", _
       "Device is not present, not working properly", _
       "Windows is still setting up the device.", "Windows is still setting up the device.", _
       "Device does not have valid log configuration.", "Device drivers are not installed.", _
       "Device is disabled; the device firmware did not provide the required resources.", _
       "Device is using an IRQ resource that another device is using.", _
       "Device is not working properly; Windows cannot load the required device drivers.")
    
       w_statusinfo = Array("Disconnected", "Connecting", "Connected", "Disconnecting", _
                  "Hardware Not present", "Hardware disabled", "Hardware malfunction", _
                  "Media disconnected", "Authenticating", "Authentication succeeded", _
                  "Authentication failed", "Invalid Address", "Credentials required")
    
    
       Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter") '
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1100>"
       objtextfile.WriteLine "<tr><td><center>Tipo de Adaptador</center></td><td><center>Descriçao</center></td><td><center>Mac Address</center></td><td><center>" & _
       "Fabricante</center></td><td><center>Status</center></td><td><center>Nome da Conexao</center></td><td><center>Velocidade</center></td></tr>"
       For Each objItem In colItems2
         If IsNull(objItem.AdapterType) then
          wTipo = "-"
         else
          wTipo = objItem.AdapterType
         end if
         If IsNull(objItem.MACAddress) then
          wMac = "- "
         Else
          wMac = objItem.MACAddress
         end if
       '  If IsNull(objItem.StatusInfo) then
       '   wMac = "-"
       '  Else
       '   wMac = objItem.StatusInfo
       ' end if
         If IsNull(objItem.NetConnectionID) Then
          wconnection = "-"
         Else
          wconnection = objItem.NetConnectionID
         end if
         If IsNull(objItem.speed) Then
          wvelocidade = "-"
         Else
          wvelocidade = objItem.speed
         end if
    
         objtextfile.WriteLine "<Font face='arial'><tr><td>" & wTipo & "</td><td>" & objItem.Description & "</td><td>" & _
         wMac & "</td><td>" & objItem.Manufacturer & "</td><td >" & _
         w_Status(objItem.ConfigManagerErrorCode) & "</td><td>" & wconnection & "</td><td>" & wvelocidade & "</td></tr>"
    
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       objtextfile.writeline "<li><b><h2><a name='#tcp'> Endereços TCP/IP</a></h2></b>"
       Set colftp = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
       objtextfile.writeline "</ul>"
       'objtextfile.writeline "<table border=2 width=100%>"
       'objtextfile.writeline "<tr><td><center>Placa de rede</center></td><td><center>Endereco TCP/IP</center></td><td><center>Mascara</center></td><td><center>" & _
       '"Tipo IP</center></td><td><center>Default Gateway</center></td><td><center>DNS Server</center></td><td><center>Wins Server</center></td></tr>"
    
    
    'Nome placa
    For Each objftp In colftp
      wlinha = " "
      wlinha = "<table border=2 width=100% bgcolor=#666666>"
      wlinha = wlinha + "<tr><td width=15%><center><b><font color=#FFFFFF>Placa</b></center></font></td><td><center><b><font color=#FFFFFF><!Nome_Pl" & objftp.Description & "Fim_Pl>" + objftp.Description + "</td></b></center></font><td><center><b><font color=#FFFFFF>"
    
      'DHCP ou Estatico
      If objftp.dhcpenabled Then
        wlinha = wlinha + "IP Dinamico" + "</td></b></center></font><td>"
      Else
        wlinha = wlinha + "IP Estatico" + "</td></b></center></font><td>"
      End If
    
    wlinha = wlinha + "</table>"
    wlinha = wlinha + "<table border=1 width=100%>"
    
    'End_IP
      wlinha = wlinha + "<tr><td width=15%>IP</td><td>"
      strIP = 1
      For Each StrIPaddress In objftp.IPAddress
        wlinha = wlinha + "<!IP" & strIP & StrIPaddress & "Fim_IP" & strIP & ">" + StrIPaddress + "</td><td>"
        strIP = strIP + 1
        'objtextfile.writeline "<!End_IP" & StrIPaddress & "Fim_IP>"
      Next
    
    'Mascara
      wlinha = wlinha + "<tr><td width=15%>Mascara</td><td>"
      For Each strIPSubnet In objftp.IPSubnet
        wlinha = wlinha + strIPSubnet + "</td><td>"
      Next
    
    'Gateway
      wlinha = wlinha + "<tr><td width=15%>Gateway</td><td>"
      For Each strDefaultIPGatewaY In objftp.DefaultIPGateway
        If IsEmpty(strDefaultIPGatewaY) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDefaultIPGatewaY + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"
    
    'DNS
      wlinha = wlinha + "<tr><td width=15%>DNS</td><td>"
      For Each strDNSServer In objftp.DNSServerSearchOrder
        If IsEmpty(strDNSServer) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDNSServer + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"
    
    'Wins
      wlinha = wlinha + "<tr><td width=15%>Wins</td><td>"
      If IsNull(objftp.WINSPrimaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "<br>"
      Else
        wlinha = wlinha + objftp.WINSPrimaryServer + "<br>"
      End If
      If IsNull(objftp.WINSSecondaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "</td><td>"
      Else
        wlinha = wlinha + objftp.WINSSecondaryServer + "</td><td>"
      End If
    
    wlinha = wlinha + "</table>"
    objtextfile.writeline wlinha
    Next
    
       objtextfile.writeline "</table>"
       objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         objtextfile.WriteLine "<table border=2 width=400>"
         objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tipo</center></td></tr>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
          Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk")
          For Each objDisk in colDisks
             W_ID= objDisk.DeviceID
         Select Case objDisk.DriveType
           Case 1
             W_ID1 = "Tipo de Disco não Detectado"
           Case 2
             W_ID1 = "Disco removível ou Disquete"
           Case 3
             W_ID1 = "Disco Rígido Local"
           Case 4
             W_ID1 ="Drive de Rede"
           Case 5
             W_ID1 = "Unidade de CD"
           Case 6
             W_ID1 ="RAM disk."
           Case Else
             W_ID1 = "Tipo de Disco não Detectado"
         End Select
         objtextfile.WriteLine "<tr><td><center>" & W_ID & "</center></td><td><center>" & W_ID1 & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
    
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Detalhe dos Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colDiskDrives = objWMIService.ExecQuery ("Select * from Win32_DiskDrive")
         strDisk = 1
       For each objDiskDrive in colDiskDrives
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<li><pre><b>Caption:         </b>" & ltrim(objDiskDrive.Caption )
         objtextfile.WriteLine "<li><b>Device ID:        </b>" & ltrim(objDiskDrive.DeviceID )
         objtextfile.WriteLine "<li><b>Interface Type:     </b>" & ltrim(objDiskDrive.InterfaceType)
         objtextfile.WriteLine "<li><b>Manufacturer:      </b>" & ltrim(objDiskDrive.Manufacturer)
         objtextfile.WriteLine "<li><b>Model:          </b>" & ltrim(objDiskDrive.Model)
         objtextfile.WriteLine "<li><b>Name:          </b>" & ltrim(objDiskDrive.Name)
         objtextfile.WriteLine "<li><b>Partitions:       </b>" & ltrim(objDiskDrive.Partitions)
         objtextfile.WriteLine "<li><b>SCSI Bus:        </b>" & ltrim(objDiskDrive.SCSIBus)
         objtextfile.WriteLine "<li><b>SCSI Logical Unit:    </b>" & ltrim(objDiskDrive.SCSILogicalUnit)
         objtextfile.WriteLine "<li><b>SCSI Port:        </b>" & ltrim(objDiskDrive.SCSIPort)
         objtextfile.WriteLine "<li><b>SCSI TargetId:      </b>" & ltrim(objDiskDrive.SCSITargetId)
         objtextfile.WriteLine "<!Disco" & strDisk & int(objDiskDrive.Size/1024/1024) & "Fim_Disco" & strDisk & ">"
         objtextfile.WriteLine "<li><b>Size:          </b>" & int(objDiskDrive.Size/1024/1024) & "MB"
         objtextfile.WriteLine "<li><b>Status:         </b>" & ltrim(objDiskDrive.Status)
         objtextfile.WriteLine "</ul>"
    	 strDisk = strDisk+1
       Next
    
       '
       ' Discos lógicos
       Const HARD_DISK = 3
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Partições</a></h2></b>"
       Set colDiskDrives = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tamanho (MB)</center></td><td><center>Tipo Partiçao" & _
       "</td><td><center>Espaço Livre(MB)</center></td></tr>"
       For Each objdisk In colDiskDrives
         objtextfile.WriteLine "<tr><td><center>" & objdisk.DeviceID & "</center></td><td><center>" & " " _
         & Int(objdisk.Size / 1024 / 1024) & "</center></td><td><center>" & " " _
         & objdisk.FileSystem & "</center></td><td><center>" _
          & int(objDisk.FreeSpace/(1024*1024)) & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
    
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Unidade de CDROM</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
       For Each objItem in colItems
          objtextfile.WriteLine "<tr><td>" & objItem.Caption & "</td></td>"
       Next
    
    
       '
       'Controladoras de Disco"
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#controladoras'> Controladoras de Disco</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=600>"
       objtextfile.WriteLine "<tr><td><center>Controladora</center></td><td><center>Driver</center></td><td><center>Fabricante</center></td><td><center>Status</center></td></tr>"
       Set wplaca = objWMIService.ExecQuery("Select * from Win32_SCSIController")
       For Each objplaca In wplaca
       objtextfile.WriteLine "<tr><td>" & objplaca.Name & "</td><td>" & " " _
       & objplaca.DriverName & "</td><td>" & " " _
       & objplaca.Manufacturer & "</td><td>" & " " _
       & objplaca.Status & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#backup'> Unidade de Backup</a></h2></b></ul>"
       objtextfile.WriteLine "<table>"
       Set wfita = objWMIService.ExecQuery("Select * from Win32_TapeDrive")
       For Each objfita In wfita
         objtextfile.WriteLine "<tr><td>" & objfita.Caption & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta usuarios locais
       Set colAccounts = GetObject("WinNT://" & STRcomputer & "")
       Set colGroups = GetObject("WinNT://" & STRcomputer & "")
       colAccounts.Filter = Array("user")
       colGroups.Filter = Array("group")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#usuarios'> Usuarios Locais</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1000>"
        objtextfile.WriteLine "<tr><td><center>Login</center></td><td><center>Nome Completo</center></td><td><center>Descriçao</center>" & _
       "</td><td><center>Status</center></td><td><center>Grupos</center></td></tr>"
       For Each objUser In colAccounts
         Wgrupo = " "
         If objUser.AccountDisabled then
        wstatus = "Inativa"
         Else
        wstatus = "Ativa"
         End if
         For Each objGroup In colGroups
           For Each objuserMBR In objGroup.Members
             If objuserMBR.Name = objUser.Name Then
               Wgrupo = Wgrupo & objGroup.Name & "<br>"
             End If
           Next
         Next
         If Len(objUser.FullName) <= 1 Then
           wfulname = "-"
         Else
          wfulname = objUser.FullName
         End If
         If Len(objUser.Description) <= 1 then
        wdescricao = "-"
         else
        wdescricao = objUser.Description
         end if
         objtextfile.WriteLine "<tr><td>" & objUser.Name & "</td><td>" & " " _
         & wfulname & "</td><td>" _
         & wdescricao & "</td><td>" _
         & wstatus & "</td><td>" _
         & Wgrupo & "</td></tr> "
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Software
       Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
       strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
       strEntry1a = "DisplayName"
       strEntry1b = "QuietDisplayName"
       strEntry2 = "InstallDate"
       strEntry3 = "VersionMajor"
       strEntry4 = "VersionMinor"
       strEntry5 = "EstimatedSize"
    
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#software'> Softwares Instalados</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "<table border=2>"
        objtextfile.WriteLine "<tr><td>Software / Hotfix</td></tr>"
       Set objReg = GetObject("winmgmts://" & STRcomputer & _
        "/root/default:StdRegProv")
       objReg.EnumKey HKLM, strKey, arrSubkeys
       For Each strSubkey In arrSubkeys
       '  wlinha = "<tr><td>"
         wlinha=""
        intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
         strEntry1a, strValue1)
        If intRet1 <> 0 Then
         objReg.GetStringValue HKLM, strKey & strSubkey, _
          strEntry1b, strValue1
        End If
        If strValue1 <> "" Then
         wlinha = wlinha + strValue1 '+ "</td><td>"
        End If
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
        strEntry3, intValue3
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
         strEntry4, intValue4
        If intValue3 <> "" Then
          wlinha = wlinha + intValue3 + "." + intValue4 '"</td></tr>"
        End If
        If Len(wlinha) > 8 Then
         objtextfile.WriteLine wlinha + "<br>"
        End If
       Next
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Serviços
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
        Set colListOfServices = objWMIService.ExecQuery _
           ("Select * from Win32_Service")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#servicos'> Serviços</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=800>"
       objtextfile.WriteLine "<tr><td><b><center>Serviço</center></b></td><td><b><center>Startup</center></b></td><td><b>" & _
       "<center>Status</center></b></td><td><b><center>Usuario de Startup</center></b></b></td></tr>"
       For Each objService In colListOfServices
         if objService.State = "Stopped" then
        wfonte= "<font color=red>"
         else
        wfonte = "<font>"
         end if
         objtextfile.WriteLine "<tr><td><i>" & wfonte & objService.Caption & "</font></i></td><td><i>" & _
         wfonte & objService.StartMode & "</font></i></td><td><i>" & _
         wfonte & objService.State & "</font></i></td><td><i>" & _
         wfonte & objService.StartName & "</font></i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Tamanho dos Diretorios
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
    
       Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")
    
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#compartilhamentos'>Compartilhamentos</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Compartilhamento</center></b></td><td><b><center>" & _
       "Caminho</center></b></b></td></tr>"
    
       For Each objShare In colShares
         objtextfile.WriteLine "<tr><td><i>" & objShare.Name & "</i></td><td><i>" _
         & objShare.Path & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
       Set colInstalledPrinters = objWMIService.ExecQuery _
         ("Select * from Win32_PrinterDriver")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#impressora'> Drivers de Impressoras</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b>Impressora Local</b></b></td></tr>"
    
       For Each objPrinter In colInstalledPrinters
         objtextfile.WriteLine "<tr><td><i>" & objPrinter.Name & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta portas de impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
    
       Set colPorts = objWMIService.ExecQuery _
         ("Select * from Win32_TCPIPPrinterPort")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#portas'> Portas de Impressora</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Impressora Local</center></b></td><td><b><center>Endereco Host</center></b></td><td><b>" & _
       "<center>Porta</center></b></td><td><b><center>Protocolo</center></b></b></td></tr>"
       For Each objPort In colPorts
         objtextfile.WriteLine "<tr><td><i>" & objPort.Description & "</i></td><td><i>" & _
         objPort.HostAddress & "</i></td><td><i>" & _
         objPort.Name & "</i></td><td><i>" & _
         objPort.PortNumber & "</i></td><td><i>" & _
         objPort.Protocol & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#event'> Event Viewer</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=100>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate,(Security)}!\\" & _
           strComputer & "\root\cimv2")
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='Security'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Security </i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='application'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Application</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='system'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>System</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       Objtextfile.writeline "</html>"
    
    
    wscript.echo "FIM"
    

    28 Ocak 2011 Cuma 15:33
  • Ah,..esqci..ele gera um html no desktop da maquina..
    28 Ocak 2011 Cuma 15:42
  • O seu script sem sombra de dúvida ficou exelente e completo.

    Sendo que preciso que ele salve as informações em um banco de dados access ou até mesmo em um excel, pois são varias estações e as informações devem ser centralizadas em um único arquivo e eu possa fazer um filtro para olhar informações rápidas como ex: quem tem o MSN instalado.

     


    Att,
    Rafael Claro
    MCP + MCDST
    MSN: clarocoelho@hotmail.com
    31 Ocak 2011 Pazartesi 16:57
  • Ola Rafael,

    O Script ficou otimo, consegui fazer jogar numa pasta de rede. Coloquei ele no bat de logon e ficou otimo.

    Porem preciso fazer a mesma coisa que voce, para triar certas informações num local so, seja um banco de dados ou um Excell até pra ficar mais simples.

    Voce conseguiu fazer isso?

    Obrigado

    Att,

    Bruno Cipullo
    bruno.cipullo@gmail.com

    • Yanıt Olarak Öneren GMalagoli 13 Ocak 2012 Cuma 17:26
    • Yanıt Önerisini Geri Alan GMalagoli 13 Ocak 2012 Cuma 17:26
    • Yanıt Olarak Öneren GMalagoli 13 Ocak 2012 Cuma 17:27
    • Yanıt Önerisini Geri Alan Fábio JrModerator 23 Ocak 2012 Pazartesi 19:21
    13 Temmuz 2011 Çarşamba 18:22
  • Olá Bruno , gostaria de saber como você fez para jogar nesta pasta de rede, e se já consegui juntar em um único arquivo, sou novo em script..hehehehe

    Obrigado.

    Att

    Washington A.Silva

    washingtonalvesdasilva@yahoo.com.br

    20 Ocak 2012 Cuma 18:47
  • Boa Tarde Washington Alves,

    Não sei quem realmente é o autor desse script, mas segue script que salva na rede (deixarei em negrito onde você deve alterar conforme sua demanda de salvar na rede. (Só copiar e colar, o autor ja coloquei o seu nome.)



    On Error Resume Next

    Set objFSO = CreateObject("Scripting.FileSystemObject")

        Set objNetwork = CreateObject("WScript.Network")
        STRcomputer =objNetwork.ComputerName
        STRusername =objNetwork.UserName
        STRdomain  =objNetwork.UserDomain
        STRTipoServer = "MS"
        'Set dtmConvertedDate = CreateObject("WbemScripting.SWbemDateTime")
        On Error Resume Next
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objtextfile = objFSO.deleteFile(STRcomputer & ".HTML")
        Set objtextfile = objFSO.CreateTextFile("\\155.155.101.151\publico$\" & STRcomputer & ".HTML", Forwritting)
        Objtextfile.writeline "<html>"
        Objtextfile.writeline "<!-----Inventario----->"
        Objtextfile.writeline "<!-----Washington Alves----->"
        Objtextfile.writeline "<!-----2012----->"
        Objtextfile.writeline "<!-----Versão 1.6----->"
        Objtextfile.writeline "<TFOOT STYLE='font-weight:bold; color:#FFFFFF'>"
        Objtextfile.writeline "<TR>"
        Objtextfile.writeline "<TD COLSPAN=5 ALIGN='center'>"
        Objtextfile.writeline "</B>"
        Objtextfile.writeline "</TR>"
        Objtextfile.writeline "</TFOOT>"

        Lin_log = 4
        Set objNetwork = CreateObject("WScript.Network")

        objtextfile.WriteLine "<center><a name='#menu'></center></a>"
        objtextfile.WriteLine "<br>"
        objtextfile.WriteLine "<center><H1><b> Inventario de Servidor </b></h1></center>"
        objtextfile.WriteLine "<!WKS" & STRcomputer & "Fim_WKS>"
        objtextfile.WriteLine "<center>Gerado por:<H1><b>" & STRdomain & "\" & STRusername & "</b></h1></center>"
        objtextfile.WriteLine "<center><H1><b>" & STRcomputer & "</b></h1></center>"
       '
        Objtextfile.writeline "<Font face='arial'><ol>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#SO'>Sistema Operacional</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#proc'>Processadores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#bios'>Bios e Hardware</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#rede'>Configurações de Rede</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#tcp'>Configurações TCP/IP</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#discos'>Configurações de Discos</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#controladores'>Placas  Controladores</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#backup'>Unidade de Backup</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#usuarios'>Usuarios Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#software'>Softwares Instalados</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#servicos'>Status dos Serviços</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#compartilhamentos'>Compartilhamentos  Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#impressora'>Impressoras Locais</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#portas'>Portas de Impressora</a></li></h5>"
        Objtextfile.writeline "<Font face='arial'><h5><li><a href='#event'>Event Viewer</a></li></h5>"
        Objtextfile.writeline "</ol></font>"
       '
        set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _
                      & STRcomputer & "\root\cimv2")
        Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
        objtextfile.WriteLine "<ul>"
          objtextfile.WriteLine "<li><b><h2><a name='#SO'> Sistema Operacional</a></h2></b>"
        For Each objItem In colItems
         dtmConvertedDate.Value = objItem.InstallDate
           dtmInstallDate = dtmConvertedDate.GetVarDate
         objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<!SO" & objItem.Caption & "Fim_SO>"
           objtextfile.WriteLine "<Font face='arial'><li><pre>" & objItem.Caption & "</font>"
               objtextfile.WriteLine "<Font face='arial'><li>Versão..............................: " &   objItem.Version & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Service Pack....................: " &   objItem.ServicePackMajorVersion & "</font>"
           objtextfile.WriteLine "<Font face='arial'><li>Outras descrições...........: " & objItem.OtherTypeDescription & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Boot Device.....................: " & objItem.BootDevice & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Diretorio Instalação..........: " & objItem.WindowsDirectory & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Data de Instalação...........: " & dtmInstallDate & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Organização....................: " & objItem.Organization & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Usuario Registrado..........: " & objItem.RegisteredUser & "</font>"
         objtextfile.WriteLine "<Font face='arial'><li>Serial Numbe...................: " & objItem.SerialNumber & "</font>"
       Next
       Set ZoneSet = GetObject("winmgmts:").InstancesOf ("Win32_TimeZone")
       for each System in ZoneSet
        objtextfile.WriteLine "<Font face='arial'><li>Time Zone........................:" & System.StandardName & "</font></pre>"
       next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</font></ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Processadores
       Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#proc'> Processadores</a></h2></b>"

       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<Font face='arial'><li>" & objItem.Description
         Objtextfile.writeline "<!Processador>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.Name
         Objtextfile.writeline "<!Fim_Proc>"
         objtextfile.WriteLine "<Font face='arial'>" & objItem.MaxClockSpeed & " MHZ"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Informações da BIOS
       Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS")
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><a name='#bios'>BIOS / Hardware</a></b>"

       For Each objbios In colBIOS
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<!Fabricante>"
         objtextfile.WriteLine "<li><pre>Fabricante  : " & objbios.Manufacturer
         objtextfile.WriteLine "<!Fim_Fabricante>"
         objtextfile.WriteLine "<!Serie>"
         objtextfile.WriteLine "<li>Serie         : " & objbios.SerialNumber
         objtextfile.WriteLine "<!Fim_Serie>"
         objtextfile.WriteLine "<li>" & objbios.Name
         objtextfile.WriteLine "<li>Release Date     : " & (Mid(objbios.ReleaseDate, 7, 2)) & "/" & (Mid(objbios.ReleaseDate, 5, 2)) & "/" & (Left(objbios.ReleaseDate, 4))
         objtextfile.WriteLine "<li>SMBIOS Version    : " & objbios.SMBIOSBIOSVersion
         objtextfile.WriteLine "<li>BIOS Version    : " & CStr(objbios.Version)
         objtextfile.WriteLine "</ul>"
       Next

       ' Coletando Modelo do Equipamento
       Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
       For Each objComputer In colSettings
         objtextfile.WriteLine "<ul><Font face='arial'>"
         objtextfile.WriteLine "<!Modelo>"
         objtextfile.WriteLine "<li><pre>Modelo Equipamento : " & objComputer.Model & "</pre>"
         objtextfile.WriteLine "<!Fim_Modelo>"
         objtextfile.WriteLine "</ul>"
       Next
       objtextfile.WriteLine "</ul></font>"
       objtextfile.WriteLine "</ul>"
       w_tipos = Array("Unknown", "Other", "DRAM,Synchronous DRAM", "Cache DRAM", "EDO,EDRAM", "VRAM", "SRAM", _
              "RAM", "ROM", "Flash", "EEPROM", "FEPROM", "EPROM", "CDRAM", "3DRAM", "SDRAM", "SGRAM", _
              "RDRAM", "DDR")
       totalslots = 0
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2> Memória</h2></b>"

       Set SlotMem = objWMIService.ExecQuery _
         ("Select * from Win32_PhysicalMemoryArray")
         For Each objItem In SlotMem
           totalslots = totalslots + objItem.MemoryDevices
         Next
       totalpentes = 0
       Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")
       cont_mem=0
       For Each objItem In colItems
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li>" & objItem.Tag
         objtextfile.WriteLine " " & Int(objItem.Capacity / 1024 / 1024)
         objtextfile.WriteLine " " & w_tipos(objItem.MemoryType)
         objtextfile.WriteLine " " & objItem.BankLabel
         objtextfile.WriteLine " " & "Ativa"
         totalpentes = totalpentes + 1
         objtextfile.WriteLine "</ul>"
       cont_mem = cont_mem + objItem.Capacity
       Next

         objtextfile.WriteLine "<!Memoria" & Int(cont_mem / 1024 / 1024) & "Fim_Mem>"

       For i = totalpentes + 1 To totalslots
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine " <li> Physical Memory "  & i - 1
         objtextfile.WriteLine " Vazio"
         objtextfile.WriteLine "</ul>"
       Next
       Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
       Set colItems = objWMIService.ExecQuery( _
         "SELECT * FROM Win32_PageFileUsage",,48)
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<ul><br>"
       objtextfile.WriteLine "<Font face='arial'><b> Arquivo de Paginação</b><br>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>localização</center></td><td><center>Tamanho</center></td><td><center>Utilização Atual</center></td><td><center>" & _
       "Pico de Utilização</center></td></tr>"
       For Each objItem In colItems
         wlinha = " "
         wlinha = "<center><tr><td>"
         wlinha=wlinha & objItem.Description & "</td></center><td><center>"
         wlinha=wlinha & objItem.AllocatedBaseSize & "MB" & "</td></center><td><center>"
         wlinha=wlinha & objItem.CurrentUsage & "MB"& "</td></center><td><center>"
         wlinha=wlinha & objItem.PeakUsage & "MB" & "</td></center></tr>"
         objtextfile.WriteLine wlinha
       Next
       objtextfile.WriteLine "</table>"
       objtextfile.WriteLine "</ul>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       ' Coletando Placas de Rede
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#rede'> Componentes de Rede</a></h2></b>"

       w_Status = Array("Device is working properly.", _
       "Device is not configured correctly.", _
       "Windows cannot load the driver for this device.", _
       "Driver for this device might be corrupted, or the system may be low on memory or other resources.", _
       "Device is not working properly. One of its drivers or the registry might be corrupted.", _
       "Driver for the device requires a resource that Windows cannot manage.", _
       "Boot configuration for the device conflicts with other devices.", _
       "Cannot filter.", "Driver loader for the device is missing.", _
       "Device is not working properly; the controlling firmware is incorrectly reporting the resources for the device.", _
       "Device cannot start.", "Device failed.", "Device cannot find enough free resources to use.", _
       "Windows cannot verify the device's resources.", "Device cannot work properly until the computer is restarted.", _
       "Device is not working properly due to a possible re-enumeration problem.", _
       "Windows cannot identify all of the resources that the device uses.", _
       "Device is requesting an unknown resource type.", "Device drivers need to be reinstalled.", _
       "Failure using the VxD loader.", "Registry might be corrupted.", _
       "System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device.", _
       "Device is disabled.", "System failure. If changing the device driver is ineffective, see the hardware documentation.", _
       "Device is not present, not working properly", _
       "Windows is still setting up the device.", "Windows is still setting up the device.", _
       "Device does not have valid log configuration.", "Device drivers are not installed.", _
       "Device is disabled; the device firmware did not provide the required resources.", _
       "Device is using an IRQ resource that another device is using.", _
       "Device is not working properly; Windows cannot load the required device drivers.")

       w_statusinfo = Array("Disconnected", "Connecting", "Connected", "Disconnecting", _
                  "Hardware Not present", "Hardware disabled", "Hardware malfunction", _
                  "Media disconnected", "Authenticating", "Authentication succeeded", _
                  "Authentication failed", "Invalid Address", "Credentials required")


       Set colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter") '
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1100>"
       objtextfile.WriteLine "<tr><td><center>Tipo de Adaptador</center></td><td><center>Descriçao</center></td><td><center>Mac Address</center></td><td><center>" & _
       "Fabricante</center></td><td><center>Status</center></td><td><center>Nome da Conexao</center></td><td><center>Velocidade</center></td></tr>"
       For Each objItem In colItems2
         If IsNull(objItem.AdapterType) then
          wTipo = "-"
         else
          wTipo = objItem.AdapterType
         end if
         If IsNull(objItem.MACAddress) then
          wMac = "- "
         Else
          wMac = objItem.MACAddress
         end if
       '  If IsNull(objItem.StatusInfo) then
       '   wMac = "-"
       '  Else
       '   wMac = objItem.StatusInfo
       ' end if
         If IsNull(objItem.NetConnectionID) Then
          wconnection = "-"
         Else
          wconnection = objItem.NetConnectionID
         end if
         If IsNull(objItem.speed) Then
          wvelocidade = "-"
         Else
          wvelocidade = objItem.speed
         end if

         objtextfile.WriteLine "<Font face='arial'><tr><td>" & wTipo & "</td><td>" & objItem.Description & "</td><td>" & _
         wMac & "</td><td>" & objItem.Manufacturer & "</td><td >" & _
         w_Status(objItem.ConfigManagerErrorCode) & "</td><td>" & wconnection & "</td><td>" & wvelocidade & "</td></tr>"

       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       objtextfile.writeline "<li><b><h2><a name='#tcp'> Endereços TCP/IP</a></h2></b>"
       Set colftp = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
       objtextfile.writeline "</ul>"
       'objtextfile.writeline "<table border=2 width=100%>"
       'objtextfile.writeline "<tr><td><center>Placa de rede</center></td><td><center>Endereco TCP/IP</center></td><td><center>Mascara</center></td><td><center>" & _
       '"Tipo IP</center></td><td><center>Default Gateway</center></td><td><center>DNS Server</center></td><td><center>Wins Server</center></td></tr>"


    'Nome placa
    For Each objftp In colftp
      wlinha = " "
      wlinha = "<table border=2 width=100% bgcolor=#666666>"
      wlinha = wlinha + "<tr><td width=15%><center><b><font color=#FFFFFF>Placa</b></center></font></td><td><center><b><font color=#FFFFFF><!Nome_Pl" & objftp.Description & "Fim_Pl>" + objftp.Description + "</td></b></center></font><td><center><b><font color=#FFFFFF>"

      'DHCP ou Estatico
      If objftp.dhcpenabled Then
        wlinha = wlinha + "IP Dinamico" + "</td></b></center></font><td>"
      Else
        wlinha = wlinha + "IP Estatico" + "</td></b></center></font><td>"
      End If

    wlinha = wlinha + "</table>"
    wlinha = wlinha + "<table border=1 width=100%>"

    'End_IP
      wlinha = wlinha + "<tr><td width=15%>IP</td><td>"
      strIP = 1
      For Each StrIPaddress In objftp.IPAddress
        wlinha = wlinha + "<!IP" & strIP & StrIPaddress & "Fim_IP" & strIP & ">" + StrIPaddress + "</td><td>"
        strIP = strIP + 1
        'objtextfile.writeline "<!End_IP" & StrIPaddress & "Fim_IP>"
      Next

    'Mascara
      wlinha = wlinha + "<tr><td width=15%>Mascara</td><td>"
      For Each strIPSubnet In objftp.IPSubnet
        wlinha = wlinha + strIPSubnet + "</td><td>"
      Next

    'Gateway
      wlinha = wlinha + "<tr><td width=15%>Gateway</td><td>"
      For Each strDefaultIPGatewaY In objftp.DefaultIPGateway
        If IsEmpty(strDefaultIPGatewaY) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDefaultIPGatewaY + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"

    'DNS
      wlinha = wlinha + "<tr><td width=15%>DNS</td><td>"
      For Each strDNSServer In objftp.DNSServerSearchOrder
        If IsEmpty(strDNSServer) Then
          wlinha = wlinha + "0.0.0.0" + "<br>"
        Else
          wlinha = wlinha + strDNSServer + "<br>"
        End If
      Next
      wlinha = wlinha + "</td><td>"

    'Wins
      wlinha = wlinha + "<tr><td width=15%>Wins</td><td>"
      If IsNull(objftp.WINSPrimaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "<br>"
      Else
        wlinha = wlinha + objftp.WINSPrimaryServer + "<br>"
      End If
      If IsNull(objftp.WINSSecondaryServer) Then
        wlinha = wlinha + "0.0.0.0" + "</td><td>"
      Else
        wlinha = wlinha + objftp.WINSSecondaryServer + "</td><td>"
      End If

    wlinha = wlinha + "</table>"
    objtextfile.writeline wlinha
    Next

       objtextfile.writeline "</table>"
       objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         objtextfile.WriteLine "<table border=2 width=400>"
         objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tipo</center></td></tr>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
          Set colDisks = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk")
          For Each objDisk in colDisks
             W_ID= objDisk.DeviceID
         Select Case objDisk.DriveType
           Case 1
             W_ID1 = "Tipo de Disco não Detectado"
           Case 2
             W_ID1 = "Disco removível ou Disquete"
           Case 3
             W_ID1 = "Disco Rígido Local"
           Case 4
             W_ID1 ="Drive de Rede"
           Case 5
             W_ID1 = "Unidade de CD"
           Case 6
             W_ID1 ="RAM disk."
           Case Else
             W_ID1 = "Tipo de Disco não Detectado"
         End Select
         objtextfile.WriteLine "<tr><td><center>" & W_ID & "</center></td><td><center>" & W_ID1 & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"

       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Detalhe dos Discos Locais</a></h2></b>"
         objtextfile.WriteLine "</ul>"
         Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colDiskDrives = objWMIService.ExecQuery ("Select * from Win32_DiskDrive")
         strDisk = 1
       For each objDiskDrive in colDiskDrives
         objtextfile.WriteLine "<Font face='arial'><ul>"
         objtextfile.WriteLine "<li><pre><b>Caption:         </b>" & ltrim(objDiskDrive.Caption )
         objtextfile.WriteLine "<li><b>Device ID:        </b>" & ltrim(objDiskDrive.DeviceID )
         objtextfile.WriteLine "<li><b>Interface Type:     </b>" & ltrim(objDiskDrive.InterfaceType)
         objtextfile.WriteLine "<li><b>Manufacturer:      </b>" & ltrim(objDiskDrive.Manufacturer)
         objtextfile.WriteLine "<li><b>Model:          </b>" & ltrim(objDiskDrive.Model)
         objtextfile.WriteLine "<li><b>Name:          </b>" & ltrim(objDiskDrive.Name)
         objtextfile.WriteLine "<li><b>Partitions:       </b>" & ltrim(objDiskDrive.Partitions)
         objtextfile.WriteLine "<li><b>SCSI Bus:        </b>" & ltrim(objDiskDrive.SCSIBus)
         objtextfile.WriteLine "<li><b>SCSI Logical Unit:    </b>" & ltrim(objDiskDrive.SCSILogicalUnit)
         objtextfile.WriteLine "<li><b>SCSI Port:        </b>" & ltrim(objDiskDrive.SCSIPort)
         objtextfile.WriteLine "<li><b>SCSI TargetId:      </b>" & ltrim(objDiskDrive.SCSITargetId)
         objtextfile.WriteLine "<!Disco" & strDisk & int(objDiskDrive.Size/1024/1024) & "Fim_Disco" & strDisk & ">"
         objtextfile.WriteLine "<li><b>Size:          </b>" & int(objDiskDrive.Size/1024/1024) & "MB"
         objtextfile.WriteLine "<li><b>Status:         </b>" & ltrim(objDiskDrive.Status)
         objtextfile.WriteLine "</ul>"
      strDisk = strDisk+1
       Next

       '
       ' Discos lógicos
       Const HARD_DISK = 3
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Partições</a></h2></b>"
       Set colDiskDrives = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "")
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=500>"
       objtextfile.WriteLine "<tr><td><center>Unidade</center></td><td><center>Tamanho (MB)</center></td><td><center>Tipo Partiçao" & _
       "</td><td><center>Espaço Livre(MB)</center></td></tr>"
       For Each objdisk In colDiskDrives
         objtextfile.WriteLine "<tr><td><center>" & objdisk.DeviceID & "</center></td><td><center>" & " " _
         & Int(objdisk.Size / 1024 / 1024) & "</center></td><td><center>" & " " _
         & objdisk.FileSystem & "</center></td><td><center>" _
          & int(objDisk.FreeSpace/(1024*1024)) & "</center></td></tr>"
       Next
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"

       '
       objtextfile.WriteLine "<ul>"
         objtextfile.WriteLine "<li><b><h2><a name='#discos'> Unidade de CDROM</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
       Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
       For Each objItem in colItems
          objtextfile.WriteLine "<tr><td>" & objItem.Caption & "</td></td>"
       Next


       '
       'Controladoras de Disco"
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#controladoras'> Controladoras de Disco</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=600>"
       objtextfile.WriteLine "<tr><td><center>Controladora</center></td><td><center>Driver</center></td><td><center>Fabricante</center></td><td><center>Status</center></td></tr>"
       Set wplaca = objWMIService.ExecQuery("Select * from Win32_SCSIController")
       For Each objplaca In wplaca
       objtextfile.WriteLine "<tr><td>" & objplaca.Name & "</td><td>" & " " _
       & objplaca.DriverName & "</td><td>" & " " _
       & objplaca.Manufacturer & "</td><td>" & " " _
       & objplaca.Status & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#backup'> Unidade de Backup</a></h2></b></ul>"
       objtextfile.WriteLine "<table>"
       Set wfita = objWMIService.ExecQuery("Select * from Win32_TapeDrive")
       For Each objfita In wfita
         objtextfile.WriteLine "<tr><td>" & objfita.Caption & "</td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta usuarios locais
       Set colAccounts = GetObject("WinNT://" & STRcomputer & "")
       Set colGroups = GetObject("WinNT://" & STRcomputer & "")
       colAccounts.Filter = Array("user")
       colGroups.Filter = Array("group")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#usuarios'> Usuarios Locais</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=1000>"
        objtextfile.WriteLine "<tr><td><center>Login</center></td><td><center>Nome Completo</center></td><td><center>Descriçao</center>" & _
       "</td><td><center>Status</center></td><td><center>Grupos</center></td></tr>"
       For Each objUser In colAccounts
         Wgrupo = " "
         If objUser.AccountDisabled then
        wstatus = "Inativa"
         Else
        wstatus = "Ativa"
         End if
         For Each objGroup In colGroups
           For Each objuserMBR In objGroup.Members
             If objuserMBR.Name = objUser.Name Then
               Wgrupo = Wgrupo & objGroup.Name & "<br>"
             End If
           Next
         Next
         If Len(objUser.FullName) <= 1 Then
           wfulname = "-"
         Else
          wfulname = objUser.FullName
         End If
         If Len(objUser.Description) <= 1 then
        wdescricao = "-"
         else
        wdescricao = objUser.Description
         end if
         objtextfile.WriteLine "<tr><td>" & objUser.Name & "</td><td>" & " " _
         & wfulname & "</td><td>" _
         & wdescricao & "</td><td>" _
         & wstatus & "</td><td>" _
         & Wgrupo & "</td></tr> "
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Software
       Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
       strKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
       strEntry1a = "DisplayName"
       strEntry1b = "QuietDisplayName"
       strEntry2 = "InstallDate"
       strEntry3 = "VersionMajor"
       strEntry4 = "VersionMinor"
       strEntry5 = "EstimatedSize"

       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#software'> Softwares Instalados</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "<table border=2>"
        objtextfile.WriteLine "<tr><td>Software / Hotfix</td></tr>"
       Set objReg = GetObject("winmgmts://" & STRcomputer & _
        "/root/default:StdRegProv")
       objReg.EnumKey HKLM, strKey, arrSubkeys
       For Each strSubkey In arrSubkeys
       '  wlinha = "<tr><td>"
         wlinha=""
        intRet1 = objReg.GetStringValue(HKLM, strKey & strSubkey, _
         strEntry1a, strValue1)
        If intRet1 <> 0 Then
         objReg.GetStringValue HKLM, strKey & strSubkey, _
          strEntry1b, strValue1
        End If
        If strValue1 <> "" Then
         wlinha = wlinha + strValue1 '+ "</td><td>"
        End If
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
        strEntry3, intValue3
        objReg.GetDWORDValue HKLM, strKey & strSubkey, _
         strEntry4, intValue4
        If intValue3 <> "" Then
          wlinha = wlinha + intValue3 + "." + intValue4 '"</td></tr>"
        End If
        If Len(wlinha) > 8 Then
         objtextfile.WriteLine wlinha + "<br>"
        End If
       Next
       objtextfile.WriteLine "</ul>"
       'objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Serviços
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
        Set colListOfServices = objWMIService.ExecQuery _
           ("Select * from Win32_Service")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#servicos'> Serviços</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=800>"
       objtextfile.WriteLine "<tr><td><b><center>Serviço</center></b></td><td><b><center>Startup</center></b></td><td><b>" & _
       "<center>Status</center></b></td><td><b><center>Usuario de Startup</center></b></b></td></tr>"
       For Each objService In colListOfServices
         if objService.State = "Stopped" then
        wfonte= "<font color=red>"
         else
        wfonte = "<font>"
         end if
         objtextfile.WriteLine "<tr><td><i>" & wfonte & objService.Caption & "</font></i></td><td><i>" & _
         wfonte & objService.StartMode & "</font></i></td><td><i>" & _
         wfonte & objService.State & "</font></i></td><td><i>" & _
         wfonte & objService.StartName & "</font></i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Tamanho dos Diretorios
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")

       Set colShares = objWMIService.ExecQuery("Select * from Win32_Share")

       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#compartilhamentos'>Compartilhamentos</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Compartilhamento</center></b></td><td><b><center>" & _
       "Caminho</center></b></b></td></tr>"

       For Each objShare In colShares
         objtextfile.WriteLine "<tr><td><i>" & objShare.Name & "</i></td><td><i>" _
         & objShare.Path & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta Impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")
       Set colInstalledPrinters = objWMIService.ExecQuery _
         ("Select * from Win32_PrinterDriver")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#impressora'> Drivers de Impressoras</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b>Impressora Local</b></b></td></tr>"

       For Each objPrinter In colInstalledPrinters
         objtextfile.WriteLine "<tr><td><i>" & objPrinter.Name & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       'Coleta portas de impressora
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate}!\\" & STRcomputer & "\root\cimv2")

       Set colPorts = objWMIService.ExecQuery _
         ("Select * from Win32_TCPIPPrinterPort")
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#portas'> Portas de Impressora</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2>"
       objtextfile.WriteLine "<tr><td><b><center>Impressora Local</center></b></td><td><b><center>Endereco Host</center></b></td><td><b>" & _
       "<center>Porta</center></b></td><td><b><center>Protocolo</center></b></b></td></tr>"
       For Each objPort In colPorts
         objtextfile.WriteLine "<tr><td><i>" & objPort.Description & "</i></td><td><i>" & _
         objPort.HostAddress & "</i></td><td><i>" & _
         objPort.Name & "</i></td><td><i>" & _
         objPort.PortNumber & "</i></td><td><i>" & _
         objPort.Protocol & "</i></td></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       '
       objtextfile.WriteLine "<ul>"
       objtextfile.WriteLine "<li><b><h2><a name='#event'> Event Viewer</a></h2></b>"
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "<table border=2 width=100>"
       Set objWMIService = GetObject("winmgmts:" _
         & "{impersonationLevel=impersonate,(Security)}!\\" & _
           strComputer & "\root\cimv2")
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='Security'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Security </i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='application'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>Application</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i>"
       Next
       Set colLogFiles = objWMIService.ExecQuery _
         ("Select * from Win32_NTEventLogFile " _
           & "Where LogFileName='system'")
       For Each objLogFile in colLogFiles
        objtextfile.WriteLine "<tr><td><i>System</i></td><td><i>" & int(objLogfile.MaxFileSize/1024) & "MB" & "</i></td><td><i></tr>"
       Next
       objtextfile.WriteLine "</ul>"
       objtextfile.WriteLine "</table>"
       Objtextfile.writeline "<font size=1 face='Helvetica' color=blue><a href='#menu'>Menu</a></font>"
       Objtextfile.writeline "</html>"


    wscript.echo "INVENTARIADO"


    Rafael S. AMARAL
    23 Ocak 2012 Pazartesi 19:06
  • espetacular esse script.

    28 Ocak 2012 Cumartesi 21:18
  • Boa Tarde

    Onde será gerado arquivo html? é necessário executar em cada estação o script vbs? Aguardo retorno

    02 Şubat 2012 Perşembe 16:23
  • cara o arquivo será gerado na mesma pasta que vc executou e sim vc precisa executar em cada estação.
    Warley
    02 Şubat 2012 Perşembe 16:56
  • Afinal pq vcs não usam o OCS-Inventory? 
    É uma otima ferramenta, instala agente remotamente dá logs sempre a não ser que queiram algo "agentless".
    Warley
    02 Şubat 2012 Perşembe 17:32
  • concordo as vezes pessoal tenta reinventar a roda... script acredito eu devem ser utilizados para efetuar coisas que as ferramentas convencionais nao facam ou automatizar processos...
    Meu Blog: http://howtoserver.com Minhas Ceritificações: 73-642,73-640
    02 Şubat 2012 Perşembe 17:47