IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

Les informations du pc


Sujet :

VBScript

  1. #1
    Membre à l'essai
    Homme Profil pro
    Collégien
    Inscrit en
    Juin 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Collégien
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Juin 2013
    Messages : 6
    Par défaut Les informations du pc
    bonjour ,

    je suis nouveau sur vbscript et j ai un exercice pour afficher les informations du pc et je ne sais pas comment le faire pouvez-vous m aider

    concernant l exercice je fois afficher :
    le nom de l ordinateur
    nom du domaine
    nom de l utilisateur
    nombre de processeur
    type de processeur
    niveau de processeur
    disque principal
    disque systeme
    répertoire systeme
    repertoir par defaut

    et en fin les information sur le l ecteur c
    type
    numero de serie
    nom
    espace total et libre


    merci d avance

  2. #2
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut
    et Bienvenue sur DVP
    Testez ce script trouvé ici dans notre forum
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    on error resume Next
    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}!\\" &_
    ".\root\default:StdRegProv")
     
    report = report & "******************************************" & vbCrLf
    report = report & " - Inventaire de l'ordinateur " & strComputer & " - " & vbCrLf
    report = report & "******************************************" & vbCrLf & vbCrLf
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
     
    report = report & vbCrLf & "******************************************" & vbCrLf
    report = report & "Informations sur Windows" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objItem in colItems
        report = report &  "- Nom du poste: " & strComputer  & vbCrLf
        report = report &  "- Description de l'ordinateur: " & objItem.Description & vbCrLf
        report = report &  "- Utilisateur possédant la licence Windows: " & objItem.RegisteredUser & vbCrLf
        report = report &  "- Organisation possédant la licence Windows: " & objItem.Organization & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Nom du système d'exploitation: " & objItem.Caption & vbCrLf
        If (objItem.OSProductSuite <> "")Then
            report = report &  "- Système d'exploitation de la suite " & objItem.OSProductSuite & vbCrLf
        End If
        report = report &  "- Version: " & objItem.Version & vbCrLf
        report = report &  "- Date de son installation: " & objItem.InstallDate & vbCrLf
        report = report &  "- Numéro de série de " & objItem.Caption & ": " & objItem.SerialNumber & vbCrLf
        report = report & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report & "Détails techniques sur Windows"& vbCrlf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Numéro du dernier Service Pack majeur installé: "
        report = report & objItem.ServicePackMajorVersion & vbCrLf
        If (objItem.ServicePackMinorVersion<>0) AND (objItem.ServicePackMinorVersion<>"") Then
            report = report &  "- Numéro du dernier Service Pack mineur installé: " & objItem.ServicePackMinorVersion & vbCrLf
        End If
        report = report &  "- - - - - -" & vbCrLf
        report = report &  "Les Service Pack et les mises-à-jour de sécurité de Windows sont disponibles sur:" & vbCrLf
        report = report &  "===> http://windowsupdate.microsoft.com <===" & vbCrLf
        report = report &  "- - - - - -" & vbCrLf & vbCrLf
        'report = report &  "- Emplacements du système d'exploitation sur l'ordinateur: " & vbCrLf & objItem.Name & vbCrLf
        report = report &  "- Répertoire où Windows est installé: " & objItem.WindowsDirectory & vbCrLf
        report = report &  "- Niveau d'encryption des données: " & objItem.EncryptionLevel & " bits" & vbCrLf
        If (objItem.MaxNumberOfProcesses="-1") Then
            report = report &  "- Maximum de processus pouvant être ouvert: Aucune limite fixée" & vbCrLf
        Else
            report = report &  "- Maximum de processus pouvant être ouvert: " & objItem.MaxNumberOfProcesses & vbCrLf
        End If
    Next
     
    Set colBaseBoards =  objWMIService.ExecQuery _
        ("Select * from Win32_BaseBoard")
    report = report & vbCrLf & "******************************************" & vbCrLf
    report = report & "Carte-mère" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objBaseBoard in colBaseBoards
     
            report = report & "- Nom: " & objBaseBoard.Name & vbCrLf
            report = report & "- Modèle: " & objBaseBoard.Model & vbCrLf
            report = report & "- Manufacturier: " & objBaseBoard.Manufacturer & vbCrLf
            report = report & "- Numéro de série: " & objBaseBoard.SerialNumber & vbCrLf
            report = report & "- Numéro d'inventaire (SKU): " & objBaseBoard.SKU & vbCrLf
            report = report & vbCrLf
    Next
     
    Set colOnBoardDevices =  objWMIService.ExecQuery _
        ("Select * from Win32_OnBoardDevice")
    report = report & "******************************************" & vbCrLf
    report = report & "Périphériques inclus sur la carte-mère (OnBoard)" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objOnBoardDevice in colOnBoardDevices
     
            report = report & "- Nom du périphérique: " & objOnBoardDevice.Name & vbCrLf
            report = report & "- Nom secondaire du périphérique: " & objOnBoardDevice.Caption & vbCrLf
            report = report & "- Type de périphérique: " & objOnBoardDevice.DeviceType & vbCrLf
            report = report & "- Modèle: " & objOnBoardDevice.Model & vbCrLf
            report = report & "- Manufacturier: " & objOnBoardDevice.Manufacturer & vbCrLf
            report = report & "- Numéro de série: " & objOnBoardDevice.SerialNumber & vbCrLf
            report = report & "- Numéro d'inventaire (SKU): " & objOnBoardDevice.SKU & vbCrLf
            report = report & vbCrLf
    Next
     
    Set colBIOS =  objWMIService.ExecQuery _
        ("Select * from Win32_BIOS")
    report = report & "******************************************" & vbCrLf
    report = report & "BIOS - Utilitaire de détection des disques et" & vbCrLf
    report = report & " de gestion des composantes internes" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objBIOS in colBIOS
     
            report = report & "- Nom: " & objBIOS.Name & vbCrLf
            report = report & "- Code d'identification: " & objBIOS.IdentificationCode & vbCrLf
            report = report & "- Manufacturier: " & objBIOS.Manufacturer & vbCrLf
            report = report & "- BIOS primaire: " & objBIOS.PrimaryBIOS & vbCrLf
            report = report & "- Date de création: " & objBIOS.ReleaseDate & vbCrLf
            report = report & "- Numéro de série: " & objBIOS.SerialNumber & vbCrLf
            report = report & "- Version: " & objBIOS.Version & vbCrLf
            report = report & "- Version (SMBIOS): " & objBIOS.SMBIOSBIOSVersion & vbCrLf
            report = report & vbCrLf
    Next
     
    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
            'report = report & objComputer.Name & vbcrlf
            report = report & "- Vous avez actuellement " & objComputer.TotalPhysicalMemory /1024\1024+1 & " Mo de mémoire vive(RAM) au total." & vbcrlf
    Next
    report = report & "- - - - - -" & vbcrlf
    report = report & "À titre de comparaison :" & vbcrlf
    report = report & "Si vous avez Windows NT, 95 ou 98 vous devriez avoir au moins 64 Mo" & vbcrlf
    report = report & " de mémoire vive pour une utilisation confortable" & vbcrlf
    report = report & "Si vous avez Windows 2000, vous devriez avoir au moins 128 Mo de" & vbcrlf
    report = report & " mémoire vive pour une utilisation confortable" & vbcrlf
    report = report & "Si vous avez Windows XP ou 2003, vous devriez avoir au moins 256 Mo" & vbcrlf
    report = report & " de mémoire vive pour une utilisation confortable" & vbcrlf
    report = report & "- - - - - -" & vbcrlf & vbCrLf
     
    Set colSettings = objWMIService.ExecQuery _
        ("Select * from Win32_Processor")
    For Each objProcessor in colSettings
     
            report = report & "- 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
     
            report = report & "- Nom du processeur: " & objProcessor.Name & vbCrLf
            report = report & "- Description du processeur: " & objProcessor.Description & vbCrLf
            report = report & "- Vitesse actuelle du processeur: " & objProcessor.CurrentClockSpeed & " Mhz" & vbCrLf
            report = report & "- Vitesse maximale du processeur: " & objProcessor.MaxClockSpeed & " Mhz" & vbCrLf
     
            report = report & vbCrLf
    Next
     
    report = report & "******************************************" & vbCrLf
    report = report & "Disque(s) dur(s) et autres lecteurs actuellement " & vbCrLf
    report = report & "en usage" & vbCrLf & "******************************************" & vbCrLf
     
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
     
    Dim oDesLecteurs
    Set oDesLecteurs = oFSO.Drives
     
    Dim oUnLecteur
    Dim strLectType
     
    For Each oUnLecteur in oDesLecteurs
            If oUnLecteur.IsReady Then
                    Select Case oUnLecteur.DriveType
                            Case 0: strLectType = "Inconnu"
                            Case 1: strLectType = "Amovible (Disquette, clé USB, etc.)"
                            Case 2: strLectType = "Fixe (Disque dur, etc.)"
                            Case 3: strLectType = "Réseau"
                            Case 4: strLectType = "CD-Rom"
                            Case 5: strLectType = "Virtuel"
                    End Select
     
                    report = report & "- Lettre du lecteur: " & oUnLecteur.DriveLetter & vbCrLf
                    report = report & "- Numéro de série: " & oUnLecteur.SerialNumber & vbCrLf
                    report = report & "- Type de lecteur: " & oUnLecteur.strLectType & vbCrLf
                    If (oUnLecteur.FileSystem <> "") Then
                            report = report & "- Système de fichier utilisé: " & oUnLecteur.FileSystem & vbCrLf
                    End If
     
                    Set objWMIService = GetObject("winmgmts:")
                    Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & oUnLecteur.DriveLetter & ":'")
                    report = report & "- Il y a " & objLogicalDisk.FreeSpace /1024\1024+1 & " Mo d'espace restant sur ce lecteur/disque" & vbCrLf
                    report = report & "- Il y a " & objLogicalDisk.Size /1024\1024+1 & " Mo d'espace au total sur ce lecteur/disque" & vbCrLf
     
            End If
            report = report & vbCrLf
    Next
     
    Set colCartesVideo = objWMIService.ExecQuery _
        ("Select Description From Win32_VideoController")
    report = report & "******************************************" & vbCrLf
    report = report & "Carte(s) vidéo" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objCarteVideo in colCartesVideo
     
            report = report & "- Nom de la carte: " & objCarteVideo.Description & vbcrlf
            report = report & vbCrLf
    Next
     
    Set colSoundDevices =  objWMIService.ExecQuery _
        ("Select * from Win32_SoundDevice")
    report = report & "******************************************" & vbCrLf
    report = report & "Carte(s) de son" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objSoundDevice in colSoundDevices
     
            report = report & "- Nom de la carte: " & objSoundDevice.Description & vbCrLf
            report = report & vbCrLf
    Next
     
    Set colInstalledPrinters =  objWMIService.ExecQuery _
        ("Select * from Win32_Printer")
    report = report & "******************************************" & vbCrLf
    report = report & "Imprimante(s) installée(s)" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objPrinter in colInstalledPrinters
     
            If objPrinter.Default = "True" Then
                    report = report & "- Nom de l'imprimante (par défaut): " & objPrinter.Name & vbCrLf
            Else
                    report = report & "- Nom de l'imprimante: " & objPrinter.Name & vbCrLf
            End If
            report = report & vbCrLf
    Next
     
    Set colAdapters = objWMIService.ExecQuery _
        ("Select * from Win32_NetworkAdapter")
    report = report & "******************************************" & vbCrLf
    report = report & "Carte(s) réseau(x)" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objAdapter in colAdapters
     
            If (objAdapter.Manufacturer<>"Microsoft") Then
                    'report = report & "- Nom de la carte/adapteur (Caption): " & objAdapter.Caption & vbcrlf
                    report = report & "- Nom de la carte/adapteur: " & objAdapter.Name & vbcrlf
                    report = report & "- Type de la carte/adapteur: " & objAdapter.AdapterType & vbcrlf
                    'report = report & "- État actuel: " & objAdapter.Availability & vbcrlf
                    report = report & "- Description: " & objAdapter.Description & vbcrlf
                    report = report & "- Adresse MAC: " & objAdapter.MACAddress & vbcrlf
                    'report = report & "- Adresse réseau de la carte: " & objAdapter.NetworkAddresses & vbcrlf
                    'report = report & "- Adresse préprogrammée: " & objAdapter.PermanentAddress & vbcrlf
                    report = report & "- Nom du fabricant: " & objAdapter.Manufacturer & vbcrlf
                    report = report & "- Nom du produit: " & objAdapter.ProductName & vbcrlf
                    report = report & "- Nom de service: " & objAdapter.ServiceName & vbcrlf
                    report = report & "- Vitesse maximale: " & objAdapter.MaxSpeed & vbcrlf
                    'If (objAdapter.Speed = 0) Or (objAdapter.Speed = "") Then
                    '        report = report & "- Bande passante actuelle: Non-disponible ou si faible qu'elle indique 0" & vbcrlf
                    'Else
                    '        report = report & "- Bande passante actuelle: " & objAdapter.Speed & vbcrlf
                    'End If
                    'report = report & "- Date de la dernière réinitialisation: " & objAdapter.TimeOfLastReset & vbcrlf
     
                    Set colAdaptersConf = objWMIService.ExecQuery _
                            ("Select * from Win32_NetworkAdapterConfiguration")
                    For Each objAdapterConf in colAdaptersConf
     
                            If (objAdapter.Manufacturer<>"Microsoft") AND (objAdapter.Caption = objAdapterConf.Caption) Then
                                    report = report & "==> Configurations de la carte réseau <==" & vbcrlf
     
                                    report = report & "- Adresse IP: " & objAdapterConf.IPAddress & vbcrlf
                                    report = report & "- Masque de sous-réseau: " & objAdapterConf.IPSubnet & vbcrlf
                                    report = report & "- Le DHCP (Attribution automatique d'une adresse IP par un serveur DHCP) est-il activé:" & vbCrLf
                                    report = report & objAdapterConf.DHCPEnabled & vbcrlf
                                    report = report & "- Serveur DHCP: " & objAdapterConf.DHCPServer & vbcrlf
                                    report = report & "- Serveur(s) DNS: " & objAdapterConf.DNSServerSearchOrder & vbcrlf
     
                            End If
     
                    Next
     
     
            End If
     
    Next
    report = report & "- - - - - -" & vbcrlf
    report = report & "Si vous ne pouvez naviguer et que les configurations IP semblent correctes," & vbcrlf
    report = report & "vous pouvez essayer l'utilitaire WinsockFix.exe =>" & vbcrlf
    report = report & "http://www.google.ca/search?hl=fr&rls=GGLD%2CGGLD%3A2004-30%2CGGLD%3Afr&q=winsockfix.exe+download&btnG=Rechercher&meta=" & vbcrlf
    report = report & "- - - - - -" & vbcrlf
    report = report & vbcrlf
     
    Set colPOTSModems =  objWMIService.ExecQuery _
        ("Select * from Win32_POTSModem")
    report = report & "******************************************" & vbCrLf
    report = report & "Modem(s)" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objPOTSModem in colPOTSModems
     
            report = report & "- Nom du modem: " & objPOTSModem.Description & vbCrLf
            report = report & vbCrLf
    Next
     
    Set colEcrans =  objWMIService.ExecQuery _
        ("Select * from Win32_Win32_DesktopMonitor")
    report = report & "******************************************" & vbCrLf
    report = report & "Écran(s)" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objEcran in colEcrans
     
            report = report & "- Nom de l'écran: " & objEcran.Name & vbCrLf
            report = report & "- Type d'écran: " & objEcran.MonitorType & vbCrLf
            report = report & "- Nom du fabricant: " & objEcran.MonitorManufacturer & vbCrLf
            report = report & "- Hauteur: " & objEcran.ScreenHeight & vbCrLf
            report = report & "- Largeur: " & objEcran.ScreenWeight & vbCrLf
            report = report & vbCrLf
     
    Next
     
     
    '    report = report & "******************************************" & vbCrLf
    '    report = report & "Listes des connexions réseaux"& vbCrlf
    '    report = report & "=> Cette section peut parfois être vide même s'il" & vbCrLf
    '    report = report & " existe des connexions réseaux <=" & vbCrLf
    '    report = report & "******************************************" & vbCrLf
     
    'Set colConnReseaux = objWMIService.ExecQuery _
    '    ("Select * from Win32_NetworkConnection")
     
    'For Each objConnReseau in colConnReseaux
     
    '        report = report & "- Nom de la carte/adapteur: " & objConnReseau.Name & vbcrlf
    '        report = report & "- Nom local: " & objConnReseau.LocalName & vbcrlf
    '        report = report & "- Nom d'utilisateur: " & objConnReseau.UserName & vbcrlf
    '        report = report & "- Type: " & objConnReseau.DisplayType & vbcrlf
    '        report = report & "- Description: " & objConnReseau.Description & vbcrlf
    '        report = report & "- État actuel de la connexion: " & objConnReseau.ConnectionState & vbcrlf
    '        report = report & "- Nom du fournisseur: " & objConnReseau.ProviderName & vbcrlf
    '        report = report & "- Nom de la ressource distante: " & objConnReseau.RemoteName & vbcrlf
    '        report = report & "- Type de ressource: " & objConnReseau.ResourceType & vbcrlf
    '        report = report & "- Commentaire du fournisseur: " & objConnReseau.Comment & vbcrlf
     
    '        report = report & vbcrlf
     
    'Next
     
    Set colUsagers = objWMIService.ExecQuery _
        ("Select * from Win32_Account")
    report = report & "******************************************" & vbCrLf
    report = report & "Utilisateurs et groupes d'utilisateurs de cet ordinateur" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objUsager in colUsagers
     
            report = report & "- Nom de l'usager ou du groupe: " & objUsager.Name & vbcrlf
            report = report & "- Description: " & objUsager.Description & vbcrlf
            report = report & "- Domaine ou ordinateur auquel il appartient: " & objUsager.Domain & vbcrlf
            'report = report & "- Numéro d'identification (SID): " & objUsager.SID & vbcrlf
     
            report = report & vbcrlf
     
    Next
     
    oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys
    software = "******************************************" & vbCrLf
    software = software & "Logiciels installés" & vbCrLf & "******************************************" & vbCrLf
    For Each subkey In arrSubKeys
            'MsgBox subkey
            If Left (subkey, 1) <> "{" Then
                    software = software & subkey & vbCrLf
            End If
    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("inventaire" & strComputer & ".txt") Then
            set ts = fso.CreateTextFile("inventaire_" & strComputer & ".txt", True)
    Else
            set ts = fso.OpenTextFile("inventaire_" & strComputer & ".txt", 2, True)
    End If
     
    ts.write report
    ts.write software
    Set ws = CreateObject("wscript.shell")
    ws.run "notepad inventaire_" & strComputer & ".txt"

  3. #3
    Membre à l'essai
    Homme Profil pro
    Collégien
    Inscrit en
    Juin 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Collégien
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Juin 2013
    Messages : 6
    Par défaut information pc
    merci de votre réponse mais quand j affiche le code il me donne bcp d info que je veux dans l exercice et que je ne vx pas et quand j essaye de faire copier coller le code que je vx ca marche pas *

    merci d avance

  4. #4
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut

    commence par poster la partie du code que vous voulez et indiquez dans quelle ligne vous avez une erreur et

  5. #5
    Membre à l'essai
    Homme Profil pro
    Collégien
    Inscrit en
    Juin 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Collégien
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Juin 2013
    Messages : 6
    Par défaut exercice information
    voici le code que j ai copier pour afficher les informations indiqué plus haut de la page mais j ai toujours des problèmes et merci d abord de votre aide cher ami
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    Set oShell = CreateObject("wscript.Shell")
    Set env = oShell.environment("Process")
     
     
    report = report & "******************************************" & vbCrLf
    report = report & " - Information  de l'ordinateur " & strComputer & " - " & vbCrLf
    report = report & "******************************************" & vbCrLf & vbCrLf
     
     
    report = report & vbCrLf & "******************************************" & vbCrLf
    report = report & "Informations sur Windows" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objItem in colItems
        report = report &  "- Nom du poste: " & strComputer  & vbCrLf
        report = report &  "- Description de l'ordinateur: " & objItem.Description & vbCrLf
        report = report &  "- Utilisateur possédant la licence Windows: " & objItem.RegisteredUser & vbCrLf
        report = report &  "- Organisation possédant la licence Windows: " & objItem.Organization & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Nom du système d'exploitation: " & objItem.Caption & vbCrLf
        If (objItem.OSProductSuite <> "")Then
            report = report &  "- Système d'exploitation de la suite " & objItem.OSProductSuite & vbCrLf
        End If
        report = report &  "- Version: " & objItem.Version & vbCrLf
        report = report &  "- Date de son installation: " & objItem.InstallDate & vbCrLf
        report = report &  "- Numéro de série de " & objItem.Caption & ": " & objItem.SerialNumber & vbCrLf
        report = report & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report & "Détails techniques sur Windows"& vbCrlf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Numéro du dernier Service Pack majeur installé: "
        report = report & objItem.ServicePackMajorVersion & vbCrLf
     
        If (objItem.MaxNumberOfProcesses="-1") Then
            report = report &  "- Maximum de processus pouvant être ouvert: Aucune limite fixée" & vbCrLf
        Else
            report = report &  "- Maximum de processus pouvant être ouvert: " & objItem.MaxNumberOfProcesses & vbCrLf
        End If
    Next
     
    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
            'report = report & objComputer.Name & vbcrlf
            report = report & "- Vous avez actuellement " & objComputer.TotalPhysicalMemory /1024\1024+1 & " Mo de mémoire vive(RAM) au total." & vbcrlf
    Next
     
    Set colSettings = objWMIService.ExecQuery _
        ("Select * from Win32_Processor")
    For Each objProcessor in colSettings
     
            report = report & "- 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
     
            report = report & "- Nom du processeur: " & objProcessor.Name & vbCrLf
            report = report & "- Description du processeur: " & objProcessor.Description & vbCrLf
            report = report & "- Vitesse actuelle du processeur: " & objProcessor.CurrentClockSpeed & " Mhz" & vbCrLf
            report = report & "- Vitesse maximale du processeur: " & objProcessor.MaxClockSpeed & " Mhz" & vbCrLf
     
            report = report & vbCrLf
    Next
     
    report = report & "******************************************" & vbCrLf
    report = report & "Disque(s) dur(s) et autres lecteurs actuellement " & vbCrLf
    report = report & "en usage" & vbCrLf & "******************************************" & vbCrLf
     
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
     
    Dim oDesLecteurs
    Set oDesLecteurs = oFSO.Drives
     
    Dim oUnLecteur
    Dim strLectType
     
    For Each oUnLecteur in oDesLecteurs
            If oUnLecteur.IsReady Then
                    Select Case oUnLecteur.DriveType
                            Case 0: strLectType = "Inconnu"
                            Case 1: strLectType = "Amovible (Disquette, clé USB, etc.)"
                            Case 2: strLectType = "Fixe (Disque dur, etc.)"
                            Case 3: strLectType = "Réseau"
                            Case 4: strLectType = "CD-Rom"
     
                    End Select
     
                    report = report & "- Lettre du lecteur: " & oUnLecteur.DriveLetter & vbCrLf
                    report = report & "- Numéro de série: " & oUnLecteur.SerialNumber & vbCrLf
                    report = report & "- Type de lecteur: " & oUnLecteur.strLectType & vbCrLf
                    If (oUnLecteur.FileSystem <> "") Then
                            report = report & "- Système de fichier utilisé: " & oUnLecteur.FileSystem & vbCrLf
                    End If
     
                    Set objWMIService = GetObject("winmgmts:")
                    Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & oUnLecteur.DriveLetter & ":'")
                    report = report & "- Il y a " & objLogicalDisk.FreeSpace /1024\1024+1 & " Mo d'espace restant sur ce lecteur/disque" & vbCrLf
                    report = report & "- Il y a " & objLogicalDisk.Size /1024\1024+1 & " Mo d'espace au total sur ce lecteur/disque" & vbCrLf
     
            End If
            report = report & vbCrLf
    Next
     
    strComputer = "."
     
     
    Set objWMIService = GetObject("winmgmts:" & "!\\" & strComputer & "\root\cimv2")
     
    Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True")
     
    For Each objAdapter in colAdapters
     
     
        IPdebut = LBound(objAdapter.IPAddress)
     
        IPfin = UBound(objAdapter.IPAddress)
     
        If (objAdapter.IPAddress(IPdebut) <> "") then
     
     
     
            For i = IPdebut To IPfin
     
                    msg = msg & "utilise l'adresse IP " & objAdapter.IPAddress(i) & vbCrLf
     
            Next     
     
     
        End If
     
    Next
     
     
     
    Wscript.Echo msg
    ts.write report
    ts.write software
    Set ws = CreateObject("wscript.shell")
    ws.run "notepad " & strComputer & ".txt"

  6. #6
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    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}!\\" &_
    ".\root\default:StdRegProv")
     
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
     
    report = report & "******************************************" & vbCrLf
    report = report & " - Information  de l'ordinateur " & strComputer & " - " & vbCrLf
    report = report & "******************************************" & vbCrLf & vbCrLf
     
     
    report = report & vbCrLf & "******************************************" & vbCrLf
    report = report & "Informations sur Windows" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objItem in colItems
        report = report &  "- Nom du poste: " & strComputer  & vbCrLf
        report = report &  "- Description de l'ordinateur: " & objItem.Description & vbCrLf
        report = report &  "- Utilisateur possédant la licence Windows: " & objItem.RegisteredUser & vbCrLf
        report = report &  "- Organisation possédant la licence Windows: " & objItem.Organization & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Nom du système d'exploitation: " & objItem.Caption & vbCrLf
        If (objItem.OSProductSuite <> "")Then
            report = report &  "- Système d'exploitation de la suite " & objItem.OSProductSuite & vbCrLf
        End If
        report = report &  "- Version: " & objItem.Version & vbCrLf
        report = report &  "- Date de son installation: " & objItem.InstallDate & vbCrLf
        report = report &  "- Numéro de série de " & objItem.Caption & ": " & objItem.SerialNumber & vbCrLf
        report = report & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report & "Détails techniques sur Windows"& vbCrlf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Numéro du dernier Service Pack majeur installé: "
        report = report & objItem.ServicePackMajorVersion & vbCrLf
     
        If (objItem.MaxNumberOfProcesses="-1") Then
            report = report &  "- Maximum de processus pouvant être ouvert: Aucune limite fixée" & vbCrLf
        Else
            report = report &  "- Maximum de processus pouvant être ouvert: " & objItem.MaxNumberOfProcesses & vbCrLf
        End If
    Next
     
    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
    'report = report & objComputer.Name & vbcrlf
        report = report & "- Vous avez actuellement " & objComputer.TotalPhysicalMemory /1024\1024+1 & " Mo de mémoire vive(RAM) au total." & vbcrlf
    Next
     
    Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_Processor")
    For Each objProcessor in colSettings
     
        report = report & "- 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
     
        report = report & "- Nom du processeur: " & objProcessor.Name & vbCrLf
        report = report & "- Description du processeur: " & objProcessor.Description & vbCrLf
        report = report & "- Vitesse actuelle du processeur: " & objProcessor.CurrentClockSpeed & " Mhz" & vbCrLf
        report = report & "- Vitesse maximale du processeur: " & objProcessor.MaxClockSpeed & " Mhz" & vbCrLf
     
        report = report & vbCrLf
    Next
     
    report = report & "******************************************" & vbCrLf
    report = report & "Disque(s) dur(s) et autres lecteurs actuellement " & vbCrLf
    report = report & "en usage" & vbCrLf & "******************************************" & vbCrLf
     
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
     
    Dim oDesLecteurs
    Set oDesLecteurs = oFSO.Drives
     
    Dim oUnLecteur
    Dim strLectType
     
    For Each oUnLecteur in oDesLecteurs
        If oUnLecteur.IsReady Then
            Select Case oUnLecteur.DriveType
            Case 0: strLectType = "Inconnu"
            Case 1: strLectType = "Amovible (Disquette, clé USB, etc.)"
            Case 2: strLectType = "Fixe (Disque dur, etc.)"
            Case 3: strLectType = "Réseau"
            Case 4: strLectType = "CD-Rom"
     
            End Select
     
            report = report & "- Lettre du lecteur: " & oUnLecteur.DriveLetter & vbCrLf
            report = report & "- Numéro de série: " & oUnLecteur.SerialNumber & vbCrLf
    '             'report = report & "- Type de lecteur: " & oUnLecteur.strLectType & vbCrLf
            If (oUnLecteur.FileSystem <> "") Then
                report = report & "- Système de fichier utilisé: " & oUnLecteur.FileSystem & vbCrLf
            End If
     
            Set objWMIService = GetObject("winmgmts:")
            Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & oUnLecteur.DriveLetter & ":'")
            report = report & "- Il y a " & objLogicalDisk.FreeSpace /1024\1024+1 & " Mo d'espace restant sur ce lecteur/disque" & vbCrLf
            report = report & "- Il y a " & objLogicalDisk.Size /1024\1024+1 & " Mo d'espace au total sur ce lecteur/disque" & vbCrLf
     
        End If
        report = report & vbCrLf
    Next
     
    srComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "!\\" & srComputer & "\root\cimv2")
    Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") 
    For Each objAdapter in colAdapters
        IPdebut = LBound(objAdapter.IPAddress)
        IPfin = UBound(objAdapter.IPAddress)
        If (objAdapter.IPAddress(IPdebut) <> "") then
            For i = IPdebut To IPfin
                msg = msg & "utilise l'adresse IP " & objAdapter.IPAddress(i) & vbCrLf
            Next     
        End If
    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("inventaire" & strComputer & ".txt") Then
        set ts = fso.CreateTextFile("inventaire_" & strComputer & ".txt", True)
    Else
        set ts = fso.OpenTextFile("inventaire_" & strComputer & ".txt", 2, True)
    End If
    Wscript.Echo msg
    ts.write report
    ts.write software
    Set ws = CreateObject("wscript.shell")
    ws.run "notepad inventaire_" & strComputer & ".txt"

  7. #7
    Membre à l'essai
    Homme Profil pro
    Collégien
    Inscrit en
    Juin 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Collégien
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Juin 2013
    Messages : 6
    Par défaut information pc
    vraiment je ne ss pas quoi vous dire mais merci bcp
    une derniere question:
    esque je peux afficher l adresse ip dans le dossier inventaire oui /non

    et si oui comment???

    merci bcp pour votre aide

  8. #8
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut
    Citation Envoyé par ezzaamine Voir le message
    vraiment je ne ss pas quoi vous dire mais merci bcp une derniere question:
    esque je peux afficher l adresse ip dans le dossier inventaire oui /non
    et si oui comment???
    Oui , on peut , mais je te laisse réfléchir un peu, car c'est à toi de faire un effort maintenant et n'oublies pas de marquer les postes qui ont t'apporter de l'aide par un +
    Indication : Dans la ligne N° 143 tu doit changer quelque chose
    Bonne Chance

  9. #9
    Membre à l'essai
    Homme Profil pro
    Collégien
    Inscrit en
    Juin 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Collégien
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Juin 2013
    Messages : 6
    Par défaut information pc
    mais vraiment je dois l envoye aujourd hui avant 4h (quebec) donc il me reste 40 min et j ai essaye de change ligne 143 par report et ca marche pas alors svp il me reste pas bcp de temps

    et merci

  10. #10
    Expert confirmé
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 844
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 50
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 844
    Par défaut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    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}!\\" &_
    ".\root\default:StdRegProv")
     
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
     
    report = report & "******************************************" & vbCrLf
    report = report & " - Information  de l'ordinateur " & strComputer & " - " & vbCrLf
    report = report & "******************************************" & vbCrLf & vbCrLf
     
     
    report = report & vbCrLf & "******************************************" & vbCrLf
    report = report & "Informations sur Windows" & vbCrLf & "******************************************" & vbCrLf
     
    For Each objItem in colItems
        report = report &  "- Nom du poste: " & strComputer  & vbCrLf
        report = report &  "- Description de l'ordinateur: " & objItem.Description & vbCrLf
        report = report &  "- Utilisateur possédant la licence Windows: " & objItem.RegisteredUser & vbCrLf
        report = report &  "- Organisation possédant la licence Windows: " & objItem.Organization & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Nom du système d'exploitation: " & objItem.Caption & vbCrLf
        If (objItem.OSProductSuite <> "")Then
            report = report &  "- Système d'exploitation de la suite " & objItem.OSProductSuite & vbCrLf
        End If
        report = report &  "- Version: " & objItem.Version & vbCrLf
        report = report &  "- Date de son installation: " & objItem.InstallDate & vbCrLf
        report = report &  "- Numéro de série de " & objItem.Caption & ": " & objItem.SerialNumber & vbCrLf
        report = report & vbCrLf
        report = report & "******************************************" & vbCrLf
        report = report & "Détails techniques sur Windows"& vbCrlf
        report = report & "******************************************" & vbCrLf
        report = report &  "- Numéro du dernier Service Pack majeur installé: "
        report = report & objItem.ServicePackMajorVersion & vbCrLf
     
        If (objItem.MaxNumberOfProcesses="-1") Then
            report = report &  "- Maximum de processus pouvant être ouvert: Aucune limite fixée" & vbCrLf
        Else
            report = report &  "- Maximum de processus pouvant être ouvert: " & objItem.MaxNumberOfProcesses & vbCrLf
        End If
    Next
     
    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
    'report = report & objComputer.Name & vbcrlf
        report = report & "- Vous avez actuellement " & objComputer.TotalPhysicalMemory /1024\1024+1 & " Mo de mémoire vive(RAM) au total." & vbcrlf
    Next
     
    Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_Processor")
    For Each objProcessor in colSettings
     
        report = report & "- 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
     
        report = report & "- Nom du processeur: " & objProcessor.Name & vbCrLf
        report = report & "- Description du processeur: " & objProcessor.Description & vbCrLf
        report = report & "- Vitesse actuelle du processeur: " & objProcessor.CurrentClockSpeed & " Mhz" & vbCrLf
        report = report & "- Vitesse maximale du processeur: " & objProcessor.MaxClockSpeed & " Mhz" & vbCrLf
     
        report = report & vbCrLf
    Next
     
    report = report & "******************************************" & vbCrLf
    report = report & "Disque(s) dur(s) et autres lecteurs actuellement " & vbCrLf
    report = report & "en usage" & vbCrLf & "******************************************" & vbCrLf
     
    Dim oFSO
    Set oFSO = WScript.CreateObject("Scripting.FileSystemObject")
     
    Dim oDesLecteurs
    Set oDesLecteurs = oFSO.Drives
     
    Dim oUnLecteur
    Dim strLectType
     
    For Each oUnLecteur in oDesLecteurs
        If oUnLecteur.IsReady Then
            Select Case oUnLecteur.DriveType
            Case 0: strLectType = "Inconnu"
            Case 1: strLectType = "Amovible (Disquette, clé USB, etc.)"
            Case 2: strLectType = "Fixe (Disque dur, etc.)"
            Case 3: strLectType = "Réseau"
            Case 4: strLectType = "CD-Rom"
     
            End Select
     
            report = report & "- Lettre du lecteur: " & oUnLecteur.DriveLetter & vbCrLf
            report = report & "- Numéro de série: " & oUnLecteur.SerialNumber & vbCrLf
    '             'report = report & "- Type de lecteur: " & oUnLecteur.strLectType & vbCrLf
            If (oUnLecteur.FileSystem <> "") Then
                report = report & "- Système de fichier utilisé: " & oUnLecteur.FileSystem & vbCrLf
            End If
     
            Set objWMIService = GetObject("winmgmts:")
            Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='" & oUnLecteur.DriveLetter & ":'")
            report = report & "- Il y a " & objLogicalDisk.FreeSpace /1024\1024+1 & " Mo d'espace restant sur ce lecteur/disque" & vbCrLf
            report = report & "- Il y a " & objLogicalDisk.Size /1024\1024+1 & " Mo d'espace au total sur ce lecteur/disque" & vbCrLf
     
        End If
        report = report & vbCrLf
    Next
     
    srComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "!\\" & srComputer & "\root\cimv2")
    Set colAdapters = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled = True") 
    For Each objAdapter in colAdapters
        IPdebut = LBound(objAdapter.IPAddress)
        IPfin = UBound(objAdapter.IPAddress)
        If (objAdapter.IPAddress(IPdebut) <> "") then
            For i = IPdebut To IPfin
                msg =  msg  & "utilise l'adresse IP " & objAdapter.IPAddress(i) & vbCrLf
            Next     
        End If
    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("inventaire" & strComputer & ".txt") Then
        set ts = fso.CreateTextFile("inventaire_" & strComputer & ".txt", True)
    Else
        set ts = fso.OpenTextFile("inventaire_" & strComputer & ".txt", 2, True)
    End If
    'Wscript.Echo msg
    ts.write report
    ts.write software
    ts.write msg
    Set ws = CreateObject("wscript.shell")
    ws.run "notepad inventaire_" & strComputer & ".txt"

  11. #11
    Membre à l'essai
    Homme Profil pro
    Collégien
    Inscrit en
    Juin 2013
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Canada

    Informations professionnelles :
    Activité : Collégien
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Juin 2013
    Messages : 6
    Par défaut information pc
    merci bcp pour votre aide

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. lire les informations directX
    Par alcoololo dans le forum DirectX
    Réponses: 3
    Dernier message: 13/06/2005, 12h57
  2. Ou trouver les informations qui defile lors du boot ?
    Par piff62 dans le forum Administration système
    Réponses: 2
    Dernier message: 17/03/2005, 17h19
  3. Réponses: 5
    Dernier message: 16/03/2005, 22h17
  4. retrouver les informations "résumé" d'une base
    Par VVE dans le forum VBA Access
    Réponses: 3
    Dernier message: 28/07/2004, 15h10
  5. Afficher les informations du système
    Par orisis dans le forum Windows
    Réponses: 8
    Dernier message: 10/06/2004, 15h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo