Connexion

Récupérer mon mot de passe

Qui est en ligne ?
Il y a en tout 1 utilisateur en ligne :: 0 Enregistré, 0 Invisible et 1 Invité

Aucun

Le record du nombre d'utilisateurs en ligne est de 21 le Jeu 17 Oct 2013, 13:40
Derniers sujets
Flux RSS



Flag Counter
Partenaires

[VBS] Obtenir informations sur le matériel et les logiciels

Voir le sujet précédent Voir le sujet suivant Aller en bas

[VBS] Obtenir informations sur le matériel et les logiciels

Message par Delmar Grande le Sam 15 Juin 2013, 04:03

hardware.vbs



Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
NomeComputador = objItem.Caption
Next


'----------------------------- Cria o arquivo

Dim fso, txtfile
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtfile = fso.CreateTextFile(NomeComputador & ".html", True)
txtfile.Write ("<strong>Relatório de Hardware:</strong><br><br>")
txtfile.WriteBlankLines(3)

'--------------- Software

strComputer = "."
strProperties = "*"'"CSName, Caption, OSType, Version, OSProductSuite, BuildNumber, ProductType, OSLanguage, CSDVersion, InstallDate, RegisteredUser, Organization, SerialNumber, WindowsDirectory, SystemDirectory"
objClass = "Win32_OperatingSystem"
strQuery = "SELECT " & strProperties & " FROM " & objClass
Set colOS = objWMIService.ExecQuery(strQuery, , wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem in colOS

txtfile.Write ("<inventario>")
'===================================================================================
txtfile.write ("<strong>Nome do Computador:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (objItem.CSName)
txtfile.WriteBlankLines(1)
txtfile.write ("<br><strong>Sistema Operacional:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (objItem.Caption)
txtfile.WriteBlankLines(1)

If SO_Type = 16 Then
SO_Name = "Microsoft Windows 95</strong><br>"
ElseIf SO_Type = 17 Then
SO_Name = "Microsoft Windows 98"
End If
If SO_ProdType = 1 Then
SO_ProdType = "Estação de Trabalho"
ElseIf SO_ProdType = 2 Then
SO_ProdType = "Controlador de Domínio"
ElseIf SO_ProdType = 3 Then
SO_ProdType = "Servidor"
End If
If SO_Language = 1033 Then
SO_Language = "Inglês - Estados Unidos"
ElseIf SO_Language = 1046 Then
SO_Language = "Português - Brasil"
Else
SO_Language = "Outro idioma"
End If
If SO_Suite = 1 Then
SO_Suite = "Small Business"
ElseIf SO_Suite = 2 Then
SO_Suite = "Enterprise"
ElseIf SO_Suite = 4 Then
SO_Suite = "Backoffice"
ElseIf SO_Suite = 8 Then
SO_Suite = "Communication Server"
ElseIf SO_Suite = 16 Then
SO_Suite = "Terminal Server"
ElseIf SO_Suite = 18 Then
SO_Suite = "Enterprise e Terminal Server"
ElseIf SO_Suite = 32 Then
SO_Suite = "Small Business (Restrito)"
ElseIf SO_Suite = 64 Then
SO_Suite = "Embedded NT"
ElseIf SO_Suite = 128 Then
SO_Suite = "Data Center"
ElseIf SO_Suite = 256 Then
SO_Suite = "Single User"
ElseIf SO_Suite = 512 Then
SO_Suite = "Personal"
ElseIf SO_Suite = 1024 Then
SO_Suite = "Blade"
End If
Next
'------------------------------------------------------ Usuario----
txtfile.WriteBlankLines(1)

txtfile.write ("<br><strong>Usuário:</strong>")
txtfile.WriteBlankLines(1)
objClass = "Win32_ComputerSystem"
strQuery = "SELECT " & strProperties & " FROM " & objClass
Set colSys = objWMIService.ExecQuery(strQuery, , wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem in colSys
txtfile.write (objItem.UserName)
txtfile.WriteBlankLines(1)
Next
'-------------------------------Processador3

txtfile.write("<br><strong>Processador:</strong>")
txtfile.WriteBlankLines(1)
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_Processor",,48)
For Each objItem in colItems
'------------------------------------------------- Nome do processador
txtfile.write (objItem.name)
txtfile.WriteBlankLines(1)
'------------------------------------------------- Clock

txtfile.write ("<br><strong>Clock:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (objItem.CurrentClockSpeed & " MHZ")
txtfile.WriteBlankLines(1)
Next
'----------------------------------Memoria
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_physicalmemory",,48)
For Each objItem in colItems
'------------------------------------------------- Nome do Banco

'------------------------------------------------- Capacidade

txtfile.write ("<br><strong>Memórias:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (objItem.capacity/1048576)
txtfile.WriteBlankLines(1)
Next
'---------------------------------- hd
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_diskdrive",,48)
For Each objItem in colItems
'------------------------------------------------- modelo do disco

txtfile.write ("<br><strong>Modelo do Disco:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (objItem.caption)
txtfile.WriteBlankLines(1)

'----------------------------------------------------- Tamanho
txtfile.write ("<br><strong>Tamanho:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (int(objItem.size/1073741824) & " GB")
txtfile.WriteBlankLines(1)
Next
'------------------------------------------------- Nome do adaptador
strComputer = "."
strProperties = "Description, MACAddress, IPAddress, IPSubnet, DefaultIPGateway, DNSServerSearchOrder, DNSDomain, DNSDomainSuffixSearchOrder, DHCPEnabled, DHCPServer, WINSPrimaryServer, WINSSecondaryServer, ServiceName"
objClass = "Win32_NetworkAdapterConfiguration"
strQuery = "SELECT " & strProperties & " FROM " & objClass & " WHERE IPEnabled = True AND ServiceName <> 'AsyncMac' AND ServiceName <> 'VMnetx' AND ServiceName <> 'VMnetadapter' AND ServiceName <> 'Rasl2tp' AND ServiceName <> 'PptpMiniport' AND ServiceName <> 'Raspti' AND ServiceName <> 'NDISWan' AND ServiceName <> 'RasPppoe' AND ServiceName <> 'NdisIP' AND ServiceName <> ''"
Set colAdapters = objWMIService.ExecQuery(strQuery, , wbemFlagReturnImmediately + wbemFlagForwardOnly)
'--------------------------------------------------------rede
For Each objItem in colAdapters
'For Each objItem in colItems
txtfile.write ("<br><strong>Adaptador:</strong>")
txtfile.WriteBlankLines(1)
txtfile.write (objItem.Description)
txtfile.WriteBlankLines(1)
'------------------------------------------------- IP
'txtfile.write ("<br><strong>Sistema Operacional:</strong>")
txtfile.write ("<br><strong>Endereco de IP:</strong>")
txtfile.WriteBlankLines(1)
IP_Address = objItem.IPAddress
txtfile.write (IP_Address(i))
txtfile.WriteBlankLines(1)
'===========================================================================

Next



software.vbs




Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
NomeComputador = objItem.Caption
Next


'----------------------------- Cria o arquivo

Dim fso, txtfile
Set fso = CreateObject("Scripting.FileSystemObject")
Set txtfile = fso.CreateTextFile(NomeComputador & ".html", True)
'txtfile.Write ("<inventarios>")
txtfile.WriteBlankLines(1)
'txtfile.write ("<Inventario>")
txtfile.WriteBlankLines(1)


'--------------- Software
txtfile.write ("<Softwares>")
txtfile.WriteLine("<strong>Programas:</strong><br>")

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

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

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys

Software = subkey

txtfile.writeline(Software )
txtfile.writeline("<br>")
txtfile.WriteBlankLines(1)
Next
'txtfile.write ("</Softwares>")
'txtfile.WriteBlankLines(1)
'txtfile.WriteLine("</Inventario>")
'txtfile.WriteBlankLines(1)

'txtfile.Write ("</inventarios>")

Obs; são dois vbs ta pessoal.



Observation Sont deux vbs.
avatar
Delmar Grande
EQUIPE BBAT
EQUIPE BBAT

Mensagens : 170
Data de inscrição : 14/06/2013
Localização : Devant le pc

http://dbatchscript.forumeiros.com/

Revenir en haut Aller en bas

Re: [VBS] Obtenir informations sur le matériel et les logiciels

Message par Hackoo le Sam 15 Juin 2013, 22:34

Merci pour le partage [Vous devez être inscrit et connecté pour voir cette image]
avatar
Hackoo
EQUIPE BBAT
EQUIPE BBAT

Mensagens : 135
Data de inscrição : 06/06/2013
Localização : Tunisie

Revenir en haut Aller en bas

Voir le sujet précédent Voir le sujet suivant Revenir en haut

- Sujets similaires

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum