Inventaire postes

Soyez le premier à donner votre avis sur cette source.

Snippet vu 4 434 fois - Téléchargée 110 fois

Contenu du snippet

                                • Bonjour, merci de bien vouloir supprimer mon compte, source et zip définitivement *************************************
                                            • Vous remerciant par avance *******************************************

Source / Exemple :


FUNCTION Num_Ligne(increment)
Num_Ligne = increment +1
End Function

FUNCTION lance_uti (strComputer,strUser,strPassword)
DIM OS_InstallDate, BIOS_Date, Network_InitDate,f ,increment, numlig

On error resume Next
Const intMin = 3600
Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")
'strComputer = env.Item("Computername")
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & ".\root\default:StdRegProv")
'+-+-+-+-+-+-+-+
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\CIMV2",strUser,strPassword)
objWMIService.Security_.ImpersonationLevel =3

'**************************************
Set colSettings = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objOperatingSystem in colSettings
        report = report & "******************************************" & vbCrLf
        report = report & " - Inventaire de l'ordinateur " & objOperatingSystem.CSName & " - " & vbCrLf
        report = report & "******************************************" & vbCrLf
	'Serial Number and ASSET Tag of computer
        report = report & "********************" & vbCrLf
        report = report & "T1"&" - Boîtier " & vbCrLf
        report = report & "********************" & vbCrLf	
	znompc = objOperatingSystem.CSName
	Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure",,48)
	For Each objSMBIOS in colSMBIOS
	    For Each objChassis in objSMBIOS.ChassisTypes
                numlig=Num_Ligne(increment)
	        increment = numlig
   	        Select Case  objChassis
	        Case 1
	                report = report & "A"&numlig&"- Chassis: Other" & vbCrLf
	        Case 2
	                report = report & "A"&numlig&"- Unknown" & vbCrLf
	        Case 3
	                report = report & "A"&numlig&"- Chassis: Desktop" & vbCrLf
	        Case 4
	                report = report & "A"&numlig&"- Chassis: Low Profile Desktop" & vbCrLf
	        Case 5
	                report = report & "A"&numlig&"- Chassis: Pizza Box" & vbCrLf
	        Case 6
	                report = report & "A"&numlig&"- Chassis: Mini Tower" & vbCrLf
	        Case 7
	                report = report & "A"&numlig&"- Chassis: Tower" & vbCrLf
	        Case 8
	                report = report & "A"&numlig&"- Chassis: Portable " & vbCrLf
	        Case 9
	                report = report & "A"&numlig&"- Chassis: Laptop" & vbCrLf
	        Case 10
	                report = report & "A"&numlig&"- Chassis: Notebook " & vbCrLf
	        Case 11
	               report = report & "A"&numlig&"- Chassis: Hand Held" & vbCrLf
	        Case 12
	                report = report & "A"&numlig&"- Chassis: Docking Station " & vbCrLf
	        Case 13
	                report = report & "A"&numlig&"- Chassis: All in One" & vbCrLf
	        Case 14
	                report = report & "A"&numlig&"- Chassis: Sub Notebook" & vbCrLf
	        Case 15
	                report = report & "A"&numlig&"- Chassis: Space-Saving" & vbCrLf
	        Case 16
	                report = report & "A"&numlig&"- Chassis: Lunch Box" & vbCrLf
	        Case 17
	                report = report & "A"&numlig&"- Chassis: Main System Chassis" & vbCrLf
	        Case 18
	                report = report & "A"&numlig&"- Chassis: Expansion Chassis" & vbCrLf
	        Case 19
	                report = report & "A"&numlig&"- Chassis: SubChassis" & vbCrLf
	        Case 20
	                report = report & "A"&numlig&"- Chassis: Bus Expansion Chassis" & vbCrLf
	        Case 21
	                report = report & "A"&numlig&"- Chassis: Peripheral Chassis" & vbCrLf
	        Case 22
	                report = report & "A"&numlig&"- Chassis: Storage Chassis" & vbCrLf
	        Case 23
	                report = report & "A"&numlig&"- Chassis: ack Mount Chassis" & vbCrLf
	        Case 24
	                report = report & "A"&numlig&"- Chassis: Sealed-Case PC" & vbCrLf
	        Case Else
	           report = report & "A"&numlig&"- Chassis: Other" & vbCrLf
	        End Select
	  Next
	       numlig= Num_ligne(increment)
	       increment = numlig
	        report = report & "A"&numlig&"- Nom:" & objSMBIOS.name & vbCrLf
	       numlig= Num_ligne(increment)
	       increment = numlig
	        report = report & "A"&numlig&"- Modéle:" & objSMBIOS.model & vbCrLf
 	       numlig= Num_ligne(increment)
	       increment = numlig
	        report = report & "A"&numlig&"- Part Number: " & objSMBIOS.PartNumber  & vbCrLf
 	       numlig= Num_ligne(increment)
	       increment = numlig
	        report = report & "A"&numlig&"- Serial Number: " & objSMBIOS.SerialNumber & vbCrLf
 	       numlig= Num_ligne(increment)
	       increment = numlig
	        report = report & "A"&numlig&"- Asset Tag: " & objSMBIOS.SMBIOSAssetTag & vbCrLf
Next
'Windows
        report = report & "******************************************" & vbCrLf
        report = report & "T2- Informations sur Windows" & vbCrLf & "******************************************" & vbCrLf
         numlig= Num_ligne(increment)
	 increment = numlig
        report = report & "A"&numlig& "- Nom du poste: " & objOperatingSystem.CSName  & vbCrLf
         numlig= Num_ligne(increment)
	       increment = numlig
        report = report & "A"&numlig& "- Description de l'ordinateur: " & objOperatingSystem.Description & vbCrLf
         numlig= Num_ligne(increment)
	       increment = numlig
        report = report & "A"&numlig& "- Utilisateur possédant la licence Windows: " & objOperatingSystem.RegisteredUser & vbCrLf
         numlig= Num_ligne(increment)
	       increment = numlig
        report = report & "A"&numlig& "- Organisation possédant la licence Windows: " & objOperatingSystem.Organization & vbCrLf
        report = report & "******************************************" & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &  "A"&numlig&"- Nom du système d'exploitation: " & objOperatingSystem.Caption & vbCrLf
 If (objOperatingSystem.OSProductSuite <> "")Then
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Système d'exploitation de la suite " & objOperatingSystem.OSProductSuite & vbCrLf
End If
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Version: " & objOperatingSystem.Version & vbCrLf
        OS_InstallDate =  objOperatingSystem.InstallDate
        numlig=Num_Ligne(increment)
        increment = numlig
	report = report &  "A"&numlig&"- Date de son installation: " & Mid(OS_InstallDate,5,2)&"/"& Mid(OS_InstallDate,7,2)&"/"& Left(OS_InstallDate,4)  & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &  "A"&numlig&"- Numéro de série de " & objOperatingSystem.Caption & ": " & objOperatingSystem.SerialNumber & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report & "T3- Détails techniques sur Windows"& vbCrlf
        report = report & "******************************************" & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Numéro du dernier Service Pack majeur installé: "
        report = report & objOperatingSystem.ServicePackMajorVersion & vbCrLf
    If (objOperatingSystem.ServicePackMinorVersion<>0) AND (objOperatingSystem.ServicePackMinorVersion<>"") Then
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Numéro du dernier Service Pack mineur installé: " & objOperatingSystem.ServicePackMinorVersion & vbCrLf
    End If
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &  "A"&numlig&"- Emplacements du système d'exploitation sur l'ordinateur: " & objOperatingSystem.Name & vbCrLf
       numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Répertoire où Windows est installé: " & objOperatingSystem.WindowsDirectory & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &  "A"&numlig&"- Niveau d'encryption des données: " & objOperatingSystem.EncryptionLevel & " bits" & vbCrLf
    If (objOperatingSystem.MaxNumberOfProcesses="-1") Then
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Maximum de processus pouvant être ouvert: Aucune limite fixée" & vbCrLf
    Else
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig& "- Maximum de processus pouvant être ouvert: " & objOperatingSystem.MaxNumberOfProcesses & vbCrLf
    End If
Next
 'CARTE MERE
        report = report & "******************************************" & vbCrLf
        report = report & "T4- Détails techniques sur la carte mère      "& vbCrlf
        report = report & "******************************************" & vbCrLf
Set colBaseBoards =  objWMIService.ExecQuery ("Select * from Win32_BaseBoard")
        report = report & vbCrLf & "******************************************" & vbCrLf
        report = report & "- Carte-mère" & vbCrLf & "******************************************" & vbCrLf
For Each objBaseBoard in colBaseBoards
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom: " & objBaseBoard.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &"A"&numlig& "- Modèle: " & objBaseBoard.Model & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Manufacturier: " & objBaseBoard.Manufacturer & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &"A"&numlig& "- Numéro de série: " & objBaseBoard.SerialNumber & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Numéro d'inventaire (SKU): " & objBaseBoard.SKU & vbCrLf

Next
 ' COMPOSANT DE LA CARTE MERE
  Set colOnBoardDevices =  objWMIService.ExecQuery("Select * from Win32_OnBoardDevice")
        report = report & "******************************************" & vbCrLf
        report = report & "T5- Périphériques inclus sur la carte-mère (OnBoard)" & vbCrLf & "******************************************" & vbCrLf
        For Each objOnBoardDevice in colOnBoardDevices
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &"A"&numlig& "- Nom du périphérique: " & objOnBoardDevice.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom secondaire du périphérique: " & objOnBoardDevice.Caption & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    Select Case objOnBoardDevice.DeviceType
        Case 1
            report = report & "A"&numlig&"- Autre" & vbCrLf
        Case 2
          report = report & "A"&numlig&"- Inconnu" & vbCrLf	
        Case 3
            report = report & "A"&numlig&"- Video" & vbCrLf	
        Case 4
           report = report &"A"&numlig& "- Controleur SCSI" & vbCrLf	
        Case 5
           report = report & "A"&numlig&"- Ethernet" & vbCrLf	
        Case 6
            report = report & "A"&numlig&"- Token Ring" & vbCrLf	
        Case 7
            report = report & "A"&numlig&"- Son" & vbCrLf
    End Select
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Modèle: " & objOnBoardDevice.Model & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Manufacturier: " & objOnBoardDevice.Manufacturer & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &"A"&numlig& "- Numéro de série: " & objOnBoardDevice.SerialNumber & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Numéro d'inventaire (SKU): " & objOnBoardDevice.SKU & vbCrLf
Next

' Info BIOS
Set colBIOS =  objWMIService.ExecQuery ("Select * from Win32_BIOS")
        report = report & "******************************************" & vbCrLf
        report = report & "T6- BIOS - Utilitaire de détection des disques et" & vbCrLf
        report = report & " de gestion des composantes internes" & vbCrLf & "******************************************" & vbCrLf
For Each objBIOS in colBIOS
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom: " & objBIOS.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Code d'identification: " & objBIOS.IdentificationCode & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Manufacturier: " & objBIOS.Manufacturer & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- BIOS primaire: " & objBIOS.PrimaryBIOS & vbCrLf
        BIOS_Date =  objBIOS.ReleaseDate
        numlig=Num_Ligne(increment)
        increment = numlig
	report = report & "A"&numlig& "- Date de création: " & Mid(BIOS_Date,5,2)&"/"& Mid(Bios_Date,7,2)&"/"& Left(BIOS_Date,4)  & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Numéro de série: " & objBIOS.SerialNumber & vbCrLf
         numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Version: " & objBIOS.Version & vbCrLf
         numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Version (SMBIOS): " & objBIOS.SMBIOSBIOSVersion & vbCrLf

Next
 ' MEMOIRE PHYSIQUE
        report = report & "******************************************" & vbCrLf
        report = report & "T7- Mémoire Physique                          " & vbCrLf
        report = report & "******************************************" & vbCrLf
Set colSettings = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")
        report = report & "******************************************" & vbCrLf
        report = report & "Mémoire vive (RAM) et processeur" & vbCrLf & "******************************************" & vbCrLf
For Each objComputer in colSettings
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Taille: " & objComputer.TotalPhysicalMemory /1024\1024+1 & " Mo." & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
 	report = report & "A"&numlig& "- Utilisateur du poste :" & objComputer.UserName & vbCrLf	
Next

'CDROM DRIVE
        report = report & "******************************************" & vbCrLf
        report = report & "T8- Info Lecteur CD ROM                       " & vbCrLf
        report = report & "******************************************" & vbCrLf
Set colItems = objWMIService.ExecQuery("Select * from Win32_CDROMDrive")
For Each objOperatingSystem in colItems
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Device ID: " & objOperatingSystem.DeviceID  & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &"A"&numlig&"- Description: " & objOperatingSystem.Description  & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Name: " & objOperatingSystem.Name  & vbCrLf
Next

' COMPUTER SYSTEM: Number of processor
        report = report & "******************************************" & vbCrLf
        report = report & "T9- Info Processeur                           " & vbCrLf
        report = report & "******************************************" & vbCrLf
Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- System Name: " & objComputer.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nombre de processeur: " & objComputer.NumberOfProcessors & vbCrLf
Next
Set colSettings = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objProcessor in colSettings
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Type de processeur: "
        If objProcessor.Architecture = 0 Then
                report = report &"x86" & vbCrLf
        ElseIf objProcessor.Architecture = 1 Then
                report = report & "MIPS" & vbCrLf
        ElseIf objProcessor.Architecture = 2 Then
                report = report & "Alpha" & vbCrLf
        ElseIf objProcessor.Architecture = 3 Then
                report = report & "PowerPC" & vbCrLf
        ElseIf objProcessor.Architecture = 6 Then
                report = report & "ia64" & vbCrLf
        Else
                report = report & "inconnu" & vbCrLf
        End If
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom du processeur: " & objProcessor.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Description du processeur: " & objProcessor.Description & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Vitesse actuelle du processeur: " & objProcessor.CurrentClockSpeed & " Mhz" & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Vitesse maximale du processeur: " & objProcessor.MaxClockSpeed & " Mhz" & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
 Next

'PCMCIA Present or not
        report = report & "******************************************" & vbCrLf
        report = report & "T10- Info Port PCMCIA                          " & vbCrLf
        report = report & "******************************************" & vbCrLf
        Set colItems = objWMIService.ExecQuery("Select * from Win32_PCMCIAController")
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Number of PCMCIA slots: " & colItems.Count & vbCrLf
 'Device not working
        report = report & "******************************************" & vbCrLf
        report = report & "T11- Info Périphérique ne fonctionnant pas     " & vbCrLf
        report = report & "******************************************" & vbCrLf
        Set colItems = objWMIService.ExecQuery ("Select * from Win32_PnPEntity " & "WHERE ConfigManagerErrorCode <> 0")
        For Each objOperatingSystem in colItems
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report & "A"&numlig&"- Class GUID: " & objOperatingSystem.ClassGuid & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report &"A"&numlig& "- Description: " & objOperatingSystem.Description & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report &"A"&numlig&"- Device ID: " & objOperatingSystem.DeviceID & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report &"A"&numlig& "- Manufacturer: " & objOperatingSystem.Manufacturer & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report & "A"&numlig&"- Name: " & objOperatingSystem.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report &"A"&numlig& "- PNP Device ID: " & objOperatingSystem.PNPDeviceID & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
    report = report & "A"&numlig&"- Service: " & objOperatingSystem.Service & vbCrLf
Next
  '********************************************************************************
        report = report & "******************************************" & vbCrLf
        report = report & "T12- Disque(s) dur(s) et autres lecteurs actuellement " & vbCrLf
        report = report & "en usage" & vbCrLf & "******************************************" & vbCrLf

Set colDrive = objWMIService.ExecQuery ("Select * from Win32_LogicalDisk")
For Each objDrive in colDrive
        numlig=Num_Ligne(increment)
        increment = numlig
    Select Case objDrive.DriveType
        Case 1
            report = report &"A"&numlig& "- No root directory. " _
                & "Disque non déterminé " & vbCrLf
        Case 2
          report = report & "A"&numlig&"- DeviceID= "& _
                objDrive.DeviceID & _
                "  DriveType = Disque Amovible"	& vbCrLf
        Case 3
            report = report &"A"&numlig&"- DeviceID= "&  _
                objDrive.DeviceID & _
                "  DriveType = Disque dur local" & vbCrLf
        Case 4
           report = report & "A"&numlig&"- DeviceID= "&  _
                objDrive.DeviceID & _
                "  DriveType = Disque réseau" & vbCrLf	
        Case 5
           report = report & "A"&numlig& "- DeviceID= "&  _
                objDrive.DeviceID & _
                "  DriveType = CDROM / DVDROM" & vbCrLf	
        Case 6
            report = report & "A"&numlig&"- DeviceID= "&  _
                objDrive.DeviceID & _
                "  DriveType = RAM disk" & vbCrLf	
        Case Else
            report = report & "A"&numlig&"- Drive type could not be determined." & vbCrLf
    End Select
        numlig=Num_Ligne(increment)
        increment = numlig
    Select Case objDrive.MediaType
    Case 0
        report = report & "A"&numlig&"- Type de media: Media inconnu" & vbCrLf
    Case 1
        report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 1.2 MB - 512 bytes/sector" & vbCrLf
    Case 2
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 1.44 MB -512 bytes/sector" & vbCrLf
    Case 3
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 2.88 MB - 512 bytes/sector" & vbCrLf
    Case 4
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 20.8 MB - 512 bytes/sector" & vbCrLf
    Case 5
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 720 KB - 512 bytes/sector " & vbCrLf
    Case 6
        report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 360 KB - 512 bytes/sector " & vbCrLf
    Case 7
        report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 320 KB - 512 bytes/sector " & vbCrLf
    Case 8
    report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 320 KB - 1024 bytes/sector" & vbCrLf
    Case 9
        report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 180 KB - 512 bytes/sector" & vbCrLf
    Case 10
        report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 160 KB - 512 bytes/sector" & vbCrLf
    Case 11
        report = report & "A"&numlig&"- Type de media: Removable media other than floppy" & vbCrLf
    Case 12
        report = report & "A"&numlig&"- Type de media: Fixed hard disk media" & vbCrLf
    Case 13
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 120 MB - 512 bytes/sector" & vbCrLf
    Case 14
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 640 KB - 512 bytes/sector" & vbCrLf
    Case 15
    report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 640 KB - 512 bytes/sector" & vbCrLf
    Case 16
        report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 720 KB - 512 bytes/sector " & vbCrLf
    Case 17
    report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 1.2 MB - 512 bytes/sector " & vbCrLf
    Case 18
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 1.23 MB - 1024 bytes/sector" & vbCrLf
    Case 19
    report = report & "A"&numlig&"- Type de media: 5 1/4-Inch Floppy Disk - 1.23 MB - 1024 bytes/sector" & vbCrLf
    Case 20
        report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 128 MB - 512 bytes/sector" & vbCrLf
    Case 21
         report = report & "A"&numlig&"- Type de media: 3 1/2-Inch Floppy Disk - 230 MB - 512 bytes/sector" & vbCrLf
    Case 22
        report = report & "A"&numlig&"- Type de media: 8-Inch Floppy Disk - 256 KB - 128 bytes/sector" & vbCrLf
    Case Else
        report = report & "A"&numlig&"- Type de media: Media inconnu" & vbCrLf
    End Select
        numlig=Num_Ligne(increment)
        increment = numlig
       report = report & "A"&numlig&"- Description :" & objDrive.Caption & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       report = report & "A"&numlig&"- Taille: " & objDrive.Size /1024\1024+1 & "Mo" & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       report = report & "A"&numlig&"- Etat du disque :" & objDrive.Status & vbCrLf
  Next

' Péripheriques physiques
        report = report & "******************************************" & vbCrLf
        report = report & "T13- Périphériques Physique en usage" & vbCrLf & "******************************************" & vbCrLf

Set colDrivePhysical = objWMIService.ExecQuery ("Select * from Win32_PhysicalMedia")
For Each objDrivePhysical in colDrivePhysical
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & " - description:" & objDrivePhysical.MediaDescription &vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        SELECT CASE objDrivePhysical.MediaType
        Case 0
        report = report & "A"&numlig&"- Type: Unknown" & vbCrLf
        Case 1
        report = report & "A"&numlig&"- Type: Other" & vbCrLf
        Case 2
        report = report & "A"&numlig&"- Type: Tape Cartridge" & vbCrLf
        Case 3
        report = report & "A"&numlig&"- Type: QIC Cartridge" & vbCrLf
        Case 4
        report = report & "A"&numlig&"- Type: AIT Cartridge" & vbCrLf
        Case 5
        report = report & "A"&numlig&"- Type: DTF Cartridge" & vbCrLf
        Case 6
        report = report & "A"&numlig&"- Type: DAT Cartridge" & vbCrLf
        Case 7
        report = report & "A"&numlig&"- Type: 8mm Tape Cartridge" & vbCrLf
        Case 8
        report = report & "A"&numlig&"- Type: 19mm Tape Cartridge" & vbCrLf
        Case 9
        report = report & "A"&numlig&"- Type: DLT Cartridge" & vbCrLf
        Case 10
        report = report & "A"&numlig&"- Type: Half-Inch Magnetic Tape Cartridge" & vbCrLf
        Case 11
        report = report & "A"&numlig&"- Type: Cartridge Disk" & vbCrLf
        Case 12
        report = report & "A"&numlig&"- Type: JAZ Disk" & vbCrLf
        Case 13
        report = report & "A"&numlig&"- Type: ZIP Disk" & vbCrLf
        Case 14
        report = report & "A"&numlig&"- Type: SyQuest Disk " & vbCrLf
        Case 15
        report = report & "A"&numlig&"- Type: Winchester Removable Disk " & vbCrLf
        Case 16
        report = report & "A"&numlig&"- Type: CD ROM " & vbCrLf
        Case 17
        report = report & "A"&numlig&"- Type: CD ROM/XA" & vbCrLf
        Case 18
        report = report & "A"&numlig&"- Type: CD-I" & vbCrLf
        Case 19
        report = report & "A"&numlig&"- Type: CD Recordable " & vbCrLf
        Case 20
        report = report & "A"&numlig&"- Type: WORM " & vbCrLf
        Case 21
        report = report & "A"&numlig&"- Type: Magneto-Optical " & vbCrLf
        Case 22
        report = report & "A"&numlig&"- Type: DVD " & vbCrLf
        Case 23
        report = report & "A"&numlig&"- Type: DVD+RW " & vbCrLf
        Case 24
        report = report & "A"&numlig&"- Type: DVD-RAM " & vbCrLf
        Case 25
        report = report & "A"&numlig&"- Type: DVD-ROM " & vbCrLf
        Case 26
        report = report & "A"&numlig&"- Type: DVD-Video " & vbCrLf
        Case 27
        report = report & "A"&numlig&"- Type: Divx " & vbCrLf
        Case 28
        report = report & "A"&numlig&"- Type: Floppy/Diskette " & vbCrLf
        Case 29
        report = report & "A"&numlig&"- Type: Hard Disk " & vbCrLf
        Case 30
        report = report & "A"&numlig&"- Type: Memory Card " & vbCrLf
        Case 31
        report = report & "A"&numlig&"- Type: Hard Copy " & vbCrLf
        Case 32
        report = report & "A"&numlig&"- Type: Clik Disk " & vbCrLf
        Case 33
        report = report & "A"&numlig& "- Type: CD-RW" &vbCrLf
        Case 34
        report = report & "A"&numlig&"- Type: CD-DA" & vbCrLf
        Case 35
        report = report & "A"&numlig&"- Type: CD+ " & vbCrLf
        Case 36
        report = report & "A"&numlig&"- Type: DVD Recordable" & vbCrLf
        Case 37
        report = report & "A"&numlig&"- Type: DVD-RW " & vbCrLf
        Case 38
        report = report & "A"&numlig&"- Type: DVD-Audio " & vbCrLf
        Case 39
        report = report & "A"&numlig&"- Type: DVD-5 " & vbCrLf
        Case 40
        report = report & "A"&numlig&"- Type: DVD-9 " & vbCrLf
        Case 41
        report = report & "A"&numlig&"- Type: DVD-10 " & vbCrLf
        Case 42
        report = report & "A"&numlig&"- Type: DVD-18 " & vbCrLf
        Case 43
        report = report & "A"&numlig&"- Type: Magneto-Optical Rewriteable " & vbCrLf
        Case 44
        report = report & "A"&numlig&"- Type: Magneto-Optical Write Once " & vbCrLf
        Case 45
        report = report & "A"&numlig&"- Type: Magneto-Optical Rewriteable (LIMDOW)" & vbCrLf
        Case 46
        report = report & "A"&numlig&"- Type: Phase Change Write Once" & vbCrLf
        Case 47
        report = report & "A"&numlig&"- Type: Phase Change Rewriteable " & vbCrLf
        Case 48
        report = report & "A"&numlig&"- Type: Phase Change Dual Rewriteable " & vbCrLf
        Case 49
        report = report & "A"&numlig&"- Type: Ablative Write Once" & vbCrLf
        Case 50
        report = report & "A"&numlig&"- Type: Near Field Recording " & vbCrLf
        Case 51
        report = report & "A"&numlig&"- Type: MiniQic " & vbCrLf
        Case 52
        report = report & "A"&numlig&"- Type: Travan" & vbCrLf
        Case 53
        report = report & "A"&numlig&"- Type: 8mm Metal Particle " & vbCrLf
        Case 54
        report = report & "A"&numlig&"- Type: 8mm Advanced Metal Evaporate " & vbCrLf
        Case 55
        report = report & "A"&numlig&"- Type: NCTP " & vbCrLf
        Case 56
        report = report & "A"&numlig&"- Type: LTO Ultrium " & vbCrLf
        Case 57
        report = report & "A"&numlig&"- Type: LTO Accelis " & vbCrLf
        Case 58
        report = report & "A"&numlig&"- Type: 9 Track Tape" & vbCrLf
        Case 59
        report = report & "A"&numlig&"- Type: 18 Track Tape " & vbCrLf
        Case 60
        report = report & "A"&numlig&"- Type: 36 Track Tape" & vbCrLf
        Case 61
        report = report & "A"&numlig&"- Type: Magstar 3590 " & vbCrLf
        Case 62
        report = report & "A"&numlig&"- Type: Magstar MP " & vbCrLf
        Case 63
        report = report & "A"&numlig&"- Type: D2 Tape " & vbCrLf
        Case 64
        report = report & "A"&numlig&"- Type: Tape - DST Small" & vbCrLf
        Case 65
        report = report & "A"&numlig&"- Type: Tape - DST Medium " & vbCrLf
        Case 66
        report = report & "A"&numlig&"- Type: Tape - DST Large " & vbCrLf
        Case Else
        End Select
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Modéle: "& objDrivePhysical.Model & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- S/N "& objDrivePhysical.SerialNumber & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report &"A"&numlig& "- Status: "& objDrivePhysical.Status & vbCrLf
Next

'Carte Video

Set colCartesVideo = objWMIService.ExecQuery ("Select Description From Win32_VideoController")
        report = report & "******************************************" & vbCrLf
        report = report & "T14- Carte(s) vidéo" & vbCrLf & "******************************************" & vbCrLf
For Each objCarteVideo in colCartesVideo
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom de la carte: " & objCarteVideo.Description & vbcrlf

Next

'Carte Son

Set colSoundDevices =  objWMIService.ExecQuery ("Select * from Win32_SoundDevice")
        report = report & "******************************************" & vbCrLf
        report = report & "T15- Carte(s) de son" & vbCrLf & "******************************************" & vbCrLf
For Each objSoundDevice in colSoundDevices
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom de la carte: " & objSoundDevice.Description & vbCrLf

Next

'Imprimantes
Set colInstalledPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer")
report = report & "******************************************" & vbCrLf
report = report & "T16- Imprimante(s) installée(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objPrinter in colInstalledPrinters
         numlig=Num_Ligne(increment)
        increment = numlig
        If objPrinter.Default = "True" Then
                report = report &"A"&numlig& "- Nom de l'imprimante (par défaut): " & objPrinter.Name & vbCrLf
        Else
                report = report & "A"&numlig&"- Nom de l'imprimante: " & objPrinter.Name & vbCrLf
        End If

Next

'Cartes réseaux
Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter")
        report = report & "******************************************" & vbCrLf
        report = report & "T17- Carte(s) réseau(x)" & vbCrLf & "******************************************" & vbCrLf
For Each objAdapter in colAdapters
        If (objAdapter.Manufacturer<>"Microsoft") Then
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report &"A"&numlig& "- Nom de la carte/adapteur (Caption): " & objAdapter.Caption & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Nom de la carte/adapteur: " & objAdapter.Name & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Type de la carte/adapteur: " & objAdapter.AdapterType & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report &"A"&numlig& "- État actuel: " & objAdapter.Availability & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Description: " & objAdapter.Description & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Adresse MAC: " & objAdapter.MACAddress & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Adresse réseau de la carte: " & objAdapter.NetworkAddresses & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report &"A"&numlig& "- Adresse préprogrammée: " & objAdapter.PermanentAddress & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report &"A"&numlig& "- Nom du fabricant: " & objAdapter.Manufacturer & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Nom du produit: " & objAdapter.ProductName & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report & "A"&numlig&"- Nom de service: " & objAdapter.ServiceName & vbcrlf
        numlig=Num_Ligne(increment)
        increment = numlig
                report = report &"A"&numlig& "- Vitesse maximale: " & objAdapter.MaxSpeed & vbcrlf
                Network_InitDate =  objAdapter.TimeOfLastReset
        numlig=Num_Ligne(increment)
        increment = numlig
	        report = report &  "A"&numlig&"- Date de la dernière réinitialisation: " & Mid(Network_InitDate,5,2)&"/"& Mid(Network_InitDate,7,2)&"/"& Left(Network_InitDate,4)  & vbCrLf

                Set colAdaptersConf = objWMIService.ExecQuery ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
                For Each objAdapterConf in colAdaptersConf

                        If (objAdapter.Manufacturer<>"Microsoft") AND (objAdapter.Caption = objAdapterConf.Caption) Then
                                report = report & "==> Configurations de la carte réseau <==" & vbcrlf
                                    IPdebut = LBound(objAdapterConf.IPAddress)
                                    IPfin = UBound(objAdapterConf.IPAddress)
                                    If (objAdapterConf.IPAddress(IPdebut) <> "") then
                                        For i = IPdebut To IPfin
                                                numlig=Num_Ligne(increment)
                                                increment = numlig
                                               report = report & "A"&numlig&"Adresse IP " & objAdapterConf.IPAddress(i) & vbCrLf
                                        Next
                                    End If

                                zIPSubdebut = LBound(objAdapterConf.IPSubnet)
                                zIPSubfin = UBound(objAdapterConf.IPSubnet)
                                 If (objAdapterConf.IPSubnet(IPSubdebut) <> "") then
                                        For i = zIPSubdebut To zIPSubfin
                                        numlig=Num_Ligne(increment)
                                        increment = numlig
                                         report = Report & "A"&numlig&"- Masque de sous-réseau: " & objAdapterConf.IPSubnet(i) & vbCrLf
                                         Next
                                End If
                                numlig=Num_Ligne(increment)
                                increment = numlig
                                report = report & "A"&numlig&"- Le DHCP (Attribution automatique d'une adresse IP par un serveur DHCP) est-il activé:" & objAdapterConf.DHCPEnabled & vbCrLf
                                numlig=Num_Ligne(increment)
                                increment = numlig
                                report = report & "A"&numlig&"- Serveur DHCP: " & objAdapterConf.DHCPServer & vbcrlf
                                'For Each objDns in objAdapterConf.DNSServerSearchOrder
                                '        report = report & "- Serveur(s) DNS: " & objDns & vbcrlf
                                'Next

                       End If
                 Next
         End If
 Next

 ' Modem
Set colPOTSModems =  objWMIService.ExecQuery ("Select * from Win32_POTSModem")
report = report & "******************************************" & vbCrLf
report = report & "T18- Modem(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objPOTSModem in colPOTSModems
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom du modem: " & objPOTSModem.Description & vbCrLf

Next

'ecran
Set colEcrans =  objWMIService.ExecQuery ("Select * from Win32_DesktopMonitor")
report = report & "******************************************" & vbCrLf
report = report & "T19- Écran(s)" & vbCrLf & "******************************************" & vbCrLf
For Each objEcran in colEcrans
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom de l'écran: " & objEcran.Name & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Type d'écran: " & objEcran.MonitorType & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Nom du fabricant: " & objEcran.MonitorManufacturer & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Hauteur: " & objEcran.ScreenHeight & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
        report = report & "A"&numlig&"- Largeur: " & objEcran.ScreenWidth & vbCrLf

Next

' Program installed
software = software & "******************************************" & vbCrLf
software = software & "T20- Info Programmes installés                 " & vbCrLf
software = software & "******************************************" & vbCrLf
Set colSoftware = objWMIService.ExecQuery ("Select * from Win32_Product")
For Each objSoftware in colSoftware
        numlig=Num_Ligne(increment)
        increment = numlig
       software = software & "A"&numlig&"- Name: " & objSoftware.Name  & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       software= software & "B"&numlig&"- Version: " & objSoftware.Version  & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       software= software &"B"&numlig& "- Serial Number: " & objSoftware.IdentifyingNumber & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       software= software & "B"&numlig&"- Product ID: " & objSoftware.ProductID & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       software = software & "B"&numlig&"- Registered Owner: " & objSoftware.RegOwner & vbCrLf
        numlig=Num_Ligne(increment)
        increment = numlig
       software = software & vbCrLf
Next
' ////////////////////////////////////

Set fso = CreateObject("Scripting.FileSystemObject")
'Détermine si le fichier texte existe déjà ou s'il doit le créer
If Not fso.FileExists("C:\RESULTAT_INV\"&znompc&".txt") Then
        set ts = fso.CreateTextFile("C:\RESULTAT_INV\"& znompc & ".txt")
End If

ts.write report
ts.write software
 lance_uti = "OK"
end function
 '///////////////////////////////////////
 '

Dim  computername, report1,  Newstation,zadresse_ip
Const ForWriting = 2
' Compte de connexion domaine\utilisateur
' un passage par paramètres  d'un programme externe peut se faire aussi au lieu de modifier le VBS
strUtil ="DOMAINE\administrateur"
' Mot de passe du compte
' un passage par paramètres  d'un programme externe peut se faire aussi au lieu de modifier le VBS
strPwd="motdepasse"
'3 premier octets de la plage d'adresse à inventorier
zadresse_ip ="192.168.10."
ON ERROR RESUME NEXT
 'Octet final sur une boucle, on peut scanner sur la plage entiére ou juste sur quelques postes
' un passage par paramètres  d'un programme externe peut se faire aussi au lieu de modifier le VBS
for final_oct = 1  to 254
        strRetour = ""
        Newstation= zadresse_ip & final_oct
        Set objShell = CreateObject("WScript.Shell")
        Set objExec = objShell.Exec("ping -n 1 -w 100 " & Newstation )
        strPingStdOut = LCase(objExec.StdOut.ReadAll)
        If InStr(strPingStdOut, "temps") Then
                Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
                Set objWMIService = objSWbemLocator.ConnectServer(Newstation, "root\CIMV2",strUtil,strPwd)
                objWMIService.Security_.ImpersonationLevel =3
                Set colSettings = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
                For Each objOperatingSystem in colSettings
                    if objOperatingSystem.CSName <> "" then
                       znompc = objOperatingSystem.CSName
                       strRetour = lance_uti(newstation,strUtil,strPwd)
                    end if
                Next

                report1 = report1 & Newstation &","& znompc&"," & "OK"& vbCRLF

        end if
        znompc =""
next
'Fichier resultat des postes scannés (zone report1 )
Set FichierLog = CreateObject("Scripting.FileSystemObject")
if FichierLog.FileExists ("c:\RESULTAT_INV\Balayage.txt") then
   FichierLog.delete("C:\RESULTAT_INV\Balayage.txt")
   set f= FichierLog.CreateTextfile ("c:\RESULTAT_INV\Balayage.txt")
else
   set f= FichierLog.CreateTextfile ("C:\RESULTAT_INV\Balayage.txt")
end if

 Set f = FichierLog.OpenTextFile("C:\RESULTAT_INV\Balayage.txt", ForWriting,true)
f.write report1
f.close
 '--------------------------------------------------------------

'********************** MERCI DE BIEN VOULOIR SUPPRIMER CE SOURCE, LE ZIP ET MON COMPTE "MIKEOPEN" ****************************************************

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.