'Option ExplicitLe fichier pc.txt ressemble à ceci :
On Error Resume Next
Dim Wsh, VersSeven, NumVersionLabEx, NumVersion,Tmp, UserName, ComputerName,Active,objWMIService
Dim strComputer,colItems, objItem
Const BuildLab="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BuildLab"
Const BuildLabEx="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\BuildLabEx"
Const VersionSeven="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName"
Set Wsh = CreateObject("WScript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From SoftwareLicensingProduct Where PartialProductKey<>Null ")
For Each objItem in colItems
if objItem.LicenseStatus=1 then
Active="Windows Activé : " &vbtab & ConvertToKey(Wsh.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
else
Active="Windows non activé ----" &objItem.LicenseStatus
End if
Next
NumVersion = wsh.RegRead(BuildLab)
NumVersionLabEx=wsh.RegRead(BuildLabEx)
VersSeven=wsh.RegRead(VersionSeven)
UserName=Wsh.ExpandEnvironmentStrings("%USERNAME%")
ComputerName=Wsh.ExpandEnvironmentStrings("%COMPUTERNAME%")
'Tmp=MsgBox ("Nom de la machine : " &ComputerName &vbcrlf _
' & "Utilisateur connecté : " &UserName &vbcrlf _
' & "------------------------------------------" &vbcrlf _
' & "Systeme d'exploit. : " &vbtab &VersSeven &vbcrlf _
' & "Build : " &vbtab &vbtab &NumVersion &vbcrlf _
' & "BuildLabEx : " &vbtab &NumVersionLabEx _
' & vbcrlf &vbcrlf &ucase(Active) , vbInformation , "Informations")
set fsomain=createobject("scripting.filesystemobject")
Set Fichier=fsomain.opentextfile("./pc.txt",8,true)
fichier.Writeline "-------------------------------------------------------------------------------------------"
fichier.Writeline "Nom de la machine : " &ComputerName
fichier.Writeline "Utilisateur connecté : " &UserName
fichier.Writeline "Systeme d'exploit. : " &vbtab &VersSeven
fichier.Writeline "Build : " &vbtab &vbtab &NumVersion
fichier.Writeline "BuildLabEx : " &vbtab &NumVersionLabEx
fichier.Writeline "-------------Activation----------------"
fichier.Writeline ucase(Active)
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystemProduct",,48)
fichier.Writeline "-------------ComputerSystemProduct----------------"
For Each objItem in colItems
fichier.Writeline "Vendor: " & objItem.Vendor
fichier.writeline "Name: " & objItem.Name
fichier.writeline "IdentifyingNumber: " & objItem.IdentifyingNumber
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
fichier.Writeline "-------------BIOS----------------"
For Each objItem in colItems
fichier.writeline "Manufacturer: " & objItem.Manufacturer
fichier.writeline "Name: " & objItem.Name
fichier.writeline "ReleaseDate: " & objItem.ReleaseDate
fichier.writeline "SerialNumber: " & objItem.SerialNumber
fichier.writeline "SMBIOSBIOSVersion: " & objItem.SMBIOSBIOSVersion
Next
fichier.Writeline "-------------------------------------------------------------------------------------------"
fichier.close
wscript.Quit
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
Cur = Cur * 256
Cur = Key(x + KeyOffset) + Cur
Key(x + KeyOffset) = (Cur \ 24) And 255
Cur = Cur Mod 24
x = x -1
Loop While x >= 0
i = i -1
KeyOutput = Mid(Chars, Cur + 1, 1) & KeyOutput
If (((29 - i) Mod 6) = 0) And (i <> -1) Then
i = i -1
KeyOutput = "-" & KeyOutput
End If
Loop While i >= 0
ConvertToKey = KeyOutput
End Function
"
-------------------------------------------------------------------------------------------
Nom de la machine : DELL
Utilisateur connecté : YO
Systeme d'exploit. : Windows 7 Ultimate
Build : 7600.win7_ldr.091021-1509
BuildLabEx : 7600.20555.x86fre.win7_ldr.091021-1509
-------------Activation----------------
WINDOWS ACTIVÉ : 342DG-6YJR8-X92GV-V7DCV-P4K27
-------------ComputerSystemProduct----------------
Vendor: Dell Inc.
Name: OptiPlex XXXXXXX
IdentifyingNumber: XXXXXXXXX
-------------BIOS----------------
Manufacturer: Dell Inc.
Name: Phoenix ROM BIOS PLUS Version 1.10 2.6.2
ReleaseDate: 20080812000000.000000+000
SerialNumber: XXXXXXXXXXX
SMBIOSBIOSVersion: 2.6.2
x
0 commentaires :
Enregistrer un commentaire