&& Information sur les comptes d'utilisateurs d'un ordinateur
LOCAL objWMI,colClass,objClass,strComputer
CREATE CURSOR accounts (Caption c(50),description c(50),name c(50),;
LocalAccount l,SID c(50),SIDType n(10),Domain c(50),status c(10),InstallDate d NULL)
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_Account",,48)
For Each objClass in colClass
INSERT INTO accounts (caption,description,name,localAccount,SID,;
SIDType,Domain,Status,InstallDate) VALUES (objClass.Caption,;
objClass.Description,objClass.name,objClass.LocalAccount,;
objClass.SID,objClass.SIDType,ObjClass.Domain,objClass.Status,;
objClass.InstallDate)
Next
BROWSE NORMAL
&& Information sur le BIOS
LOCAL objWMI,colClass,objClass,strComputer
CREATE CURSOR bios (BuildNumber c(10) null,Caption c(30),CurrentLanguage c(15),;
description c(20),identificationCode c(20) NULL,Manufacturer c(20),serialnumber c(20),Version c(20))
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_BIOS",,48)
For Each objClass in colClass
INSERT INTO bios (buildnumber,caption,CurrentLanguage,description,;
identificationCode,Manufacturer,serialNumber,Version) VALUES (objClass.BuildNumber,;
objClass.Caption,objClass.CurrentLanguage,objClass.description,;
objClass.IdentificationCode,objClass.Manufacturer,objClass.SerialNumber,ObjClass.Version)
NEXT
BROWSE NORMAL
&& Information sur le secteur Boot
LOCAL objWMI,colClass,objClass,strComputer
CREATE CURSOR bootconfig (Bootdirectory c(20),caption c(30),configurationPath c(20),;
description c(30),LastDrive c(10),Name c(20),TempDirectory c(100))
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_BootConfiguration",,48)
For Each objClass in colClass
INSERT INTO bootconfig (BootDirectory,caption,;
configurationPath,description,LastDrive,Name,TempDirectory) VALUES (objClass.BootDirectory,objClass.Caption,;
objClass.ConfigurationPath,objClass.Description,ObjClass.LastDrive,objClass.Name,objClass.TempDirectory)
Next
BROWSE normal
&& Le temps courant (GMT 0 et ajusté)
LOCAL objWMI,colClass,objClass,strComputer
CREATE CURSOR currenttime (DAY n(2),dayOfTheWeek n(1),;
hour n(4),milliseconds c(3) NULL,minute n(3),month n(2),quarter n(1),;
second n(2),weekinMonth n(1),year n(4))
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_CurrentTime",,48)
For Each objClass in colClass
INSERT INTO currenttime (day,DayOfTheWeek,Hour,milliseconds,minute,;
month,quarter,second,weekinmonth,year) VALUES ;
(objClass.day,objClass.DayOfWeek,objClass.Hour,objClass.Milliseconds,objClass.minute,;
objClass.Month,objClass.Quarter,objClass.second,objClass.weekinmonth,objClass.year)
Next
BROWSE NORMAL
&& Numéro de serie permenant d'un disque dur
LOCAL objWMI,colClass,objClass,strComputer
CREATE CURSOR PhysicalMedia (serialnumber c(100))
strComputer = "."
objWMI = GetObject("winmgmts:\\" +strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_PhysicalMedia",,48)
For Each objClass in colClass
INSERT INTO PhysicalMedia (serialnumber) VALUES (objclass.serialnumber)
Next
BROWSE normal
&& Information sur les adapteurs de réseau (cartes)
Local objWMI,colClass,objClass
CLEAR
Local strComputer
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_NetworkAdapter",,48)
For Each objClass in colClass
? "Adapter type: " + TRANSFORM(objClass.AdapterType)
? "Adapter type ID: " + TRANSFORM(objClass.AdapterTypeID)
? "Auto Sense: "+ TRANSFORM(objClass.Autosense)
? "Caption: "+objClass.Caption
? "Description: " +objClass.description
? "Manufacturer: " +objClass.Manufacturer
? "MAC Address: " +objClass.MACAddress
? "System Name: " +objClass.SystemName
?
Next
&& Information sur les imprimantes
clear
Local objWMI
Local colClass
Local objClass
Local strComputer
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_Printer",,48)
For Each objClass in colClass
? "Caption: " +objClass.Caption
? "Port Name: " + objClass.PortName
? "Status: " +objClass.Status
?
Next
&& Information sur l;a base de registre
CLEAR
Local objWMI
Local colClass
Local objClass
Local strComputer
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_Registry",,48)
For Each objClass in colClass
? "Caption: " + objClass.Caption
? "Current size : "+TRANSFORM(objClass.CurrentSize)
? "Proposed Size: " +TRANSFORM(objClass.ProposedSize)
? "Description: " +objClass.Description
Next
&& Informations sur les services.
CLEAR
CREATE CURSOR services (caption c(50),description M NULL,DisplayName c(50),serviceType c(20),;
ProcessId n(10),status c(10))
Local objWMI
Local colClass
Local objClass
Local strComputer
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_Service",,48)
For Each objClass in colClass
INSERT INTO services (caption,description,DisplayName,;
serviceType,ProcessId,Status) VALUES (objClass.Caption,objClass.Description,objClass.DisplayName,;
objClass.ServiceType,objClass.ProcessId,objClass.Status)
Next
BROWSE normal
&& Informations sur les processes
CLEAR
CREATE CURSOR processes (caption c(20),CommandLine c(50) NULL,Handle c(10),WindowsVersion c(10))
Local objWMI
Local colClass
Local objClass
Local strComputer
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_Process",,48)
For Each objClass in colClass
INSERT INTO processes (caption,CommandLine,Handle,WindowsVersion) values;
(objClass.Caption,objClass.CommandLine,objClass.Handle,objClass.WindowsVersion)
Next
BROWSE Normal
&& Informations sur le clavier
Local objWMI
Local colClass
Local objClass
Local strComputer
strComputer = "."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_Keyboard",,48)
For Each objClass in colClass
? "Caption: " + objClass.Caption
? "NumberOfFunctionKeys: " + TRANSFORM(objClass.NumberOfFunctionKeys)
? "Status: " + TRANSFORM(objClass.status)
? "Description: "+objClass.Description
? "Layout: " + TRANSFORM(objClass.Layout)
?
Next
&& Infomations sur le lecteur de disquette
CLEAR
Local objWMI
Local colClass
Local objClass
Local strComputer
strComputer="."
objWMI = GetObject("winmgmts:\\" + strComputer + "\root\cimv2")
colClass = objWMI.ExecQuery("Select * from Win32_FloppyDrive",,48)
For Each objClass in colClass
? "Caption: " + objClass.Caption
? "DeviceID: " + objClass.DeviceID
? "Manufacturer: " + objClass.Manufacturer
? "Status: " + objClass.Status
Next
|
euh ...
Comment fait-on pour savoir si WMI est installé ?
L'Ignare de service !