bonjour à tous,

J'aimerais savoir s'il etait possible que vous m'aidiez pour mon code en effet j'aimerais apporter quelques modifs, ce script sera lancé toutes les nuits et donnera des informations dans un fichier texte et si c'est possible sera envoyé par mail !

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
option explicit
dim rapport
dim fs
const ForWriting = 2
 
information
 
 
Sub information
 
dim objCpu
dim cpu
 
dim objOs
dim Os
 
dim objRam
dim Ram
 
dim objDisk
dim Disk
dim Disk2
 
dim objpart
dim part
 
Dim objbattery
Dim battery
 
Dim objstartup
Dim startup
 
Dim Wshell
 
 
set Wshell      = CreateObject("Wscript.shell")
set fs          = CreateObject("scripting.FileSystemObject")
 
Set objCpu      = GetObject( "winmgmts:\\").InstancesOf("Win32_processor")
set objOs       = GetObject( "winmgmts:\\").InstancesOf("Win32_OperatingSystem")
set objRam      = GetObject( "winmgmts:\\").InstancesOf("Win32_physicalMemory")
set objDisk     = GetObject( "winmgmts:\\").InstancesOf("Win32_DiskDrive")
set objpart     = GetObject( "winmgmts:\\").InstancesOf("Win32_DiskPartition")
Set objbattery  = GetObject( "winmgmts:\\").InstancesOf("Win32_Battery")
Set objstartup  = GetObject( "winmgmts:\\").InstancesOf("Win32_StartupCommand")
 
 
set rapport = fs.OpenTextFile("recapserveur.log",ForWriting, true)
rapport.writeLine("Fichier d'informations sur le serveur")
rapport.writeLine("")
rapport.writeLine("")
rapport.writeLine("Info Processeur :")
rapport.writeLine("")
For each cpu in objCpu
       rapport.writeLine("   Nom                      : " & cpu.Name)
       rapport.writeLine("   Description              : " & cpu.Description)
       rapport.writeLine("   Fréquence réelle         : " & cpu.CurrentClockSpeed & " Mhz")
       rapport.writeLine("   DataWidth                : " & cpu.DataWidth & " Ko")
       rapport.writeLine("   DeviceID                 : " & cpu.DeviceID)
       rapport.writeLine("   L2CacheSize              : " & cpu.L2CacheSize & "Ko")
       rapport.writeLine("   L2CacheSpeed             : " & cpu.L2CacheSpeed & "Ko")
       rapport.writeLine("   Fabriquant               : " & cpu.Manufacturer)
       rapport.writeLine("   Fréquence Max            : " & cpu.MaxClockSpeed & "Mhz")
       rapport.writeLine("")
next
rapport.writeLine("")
rapport.writeLine("")
 
rapport.writeLine("Info Système Exploitation :")
rapport.writeLine("")
for each Os in objOs
rapport.writeLine("   Caption                  : " & Os.Caption)
rapport.writeLine("   CSDVersion               : " & Os.CSDVersion)
 
rapport.writeLine("   Mémoire vive libre       : " & FormatNumber(Os.FreePhysicalMemory / 1024, 1) & " Mo")
rapport.writeLine("   FreeSpaceInPagingFiles   : " & FormatNumber(Os.FreeSpaceInPagingFiles/ 1024, 1) & " Mo")
rapport.writeLine("   Mémoire virtuelle libre  : " & FormatNumber(Os.FreeVirtualMemory/ 1024, 1) & " Mo")
rapport.writeLine("   MaxProcessMemorySize     : " & FormatNumber(Os.MaxProcessMemorySize/ 1024, 1) & " Mo")
rapport.writeLine("   Nombre d'utilisateurs    : " & Os.NumberOfUsers)
rapport.writeLine("   Organisation             : " & Os.Organization)
rapport.writeLine("   RegisteredUser           : " & Os.RegisteredUser)
rapport.writeLine("   Numéro de série          : " & Os.SerialNumber)
rapport.writeLine("   Version                  : " & Os.Version)
rapport.writeLine("   Chemin Windows System    : " & Os.WindowsDirectory)
rapport.writeLine("")
next
rapport.writeLine("")
rapport.writeLine("")
rapport.writeLine("")
rapport.writeLine("")
 
rapport.writeLine("Info Mémoire Vive :")
rapport.writeLine("")
for each ram in objRam
        rapport.writeLine("   Capacity                 : " & FormatNumber(ram.Capacity/ 1024^2, 1) & " Mo")
        rapport.writeLine("   DataWidth                : " & ram.DataWidth )
        rapport.writeLine("   MemoryType code          : " & ram.MemoryType) 'code
        rapport.writeLine("")
next
rapport.writeLine("")
rapport.writeLine("")
 
rapport.writeLine("Info Disque dur :")
rapport.writeLine("")
for each Disk in objDisk
        rapport.writeLine("   Caption                  : " & Disk.Caption)
        rapport.writeLine("   InterfaceType            : " & Disk.InterfaceType)
        rapport.writeLine("   Modèle                   : " & Disk.Model)
        rapport.writeLine("   Nom                      : " & Disk.Name)
        rapport.writeLine("   Taille                   : " & FormatNumber(Disk.Size/ 1024^2, 1) & " Mo")
        rapport.writeLine("   Status                   : " & Disk.Status)
        if not(IsNull(Disk.StatusInfo)) then
                rapport.writeLine("   StatusInfos      : " & Disk.StatusInfo)
        end if
        rapport.writeLine("")
next
rapport.writeLine("")
rapport.writeLine("")
 
rapport.writeLine("Info Partitions :")
rapport.writeLine("")
For each part in objpart
       rapport.writeLine("   Caption                  : " & part.Caption)
       rapport.writeLine("   Taille                   : " & FormatNumber(part.Size/ 1024^2, 1) & " Mo")
       rapport.writeLine("   Première Partition       : " & part.PrimaryPartition)
       rapport.writeLine("   Type                     : " & part.Type)
	   rapport.writeLine("")
next
rapport.writeLine("")
rapport.writeLine("Info disques logiques: ")
rapport.writeLine("")
for each disk2 in fs.Drives
        if (disk2.driveType = 2) then
        rapport.writeLine("   Disque logique           : " & disk2.driveletter & " ")
        rapport.writeLine("   Système de fichier       : " & disk2.FileSystem)
        rapport.writeLine("   Espace total             : " & FormatNumber(disk2.totalsize / 1024^2, 1) & " Mo")
        rapport.writeLine("   Espace disponible        : " & FormatNumber(disk2.AvailableSpace/ 1024 ^2, 1) &  " Mo")
        rapport.writeLine("")
        rapport.writeLine("")
        End if
Next
 
rapport.Close
 
End sub
en faite j'aimerais obtenir des informations sur l'espace disque de mes partitions, car là je n'ai que l'espace disque du disque dur logique (c

deuxièmement, j'aimerais que mon fichier qui est crée porte un nom en rapport avec la date du jour genre 02012007.log et que ce fichier texte ne soit pas remplacé car const ForWriting = 2 remplace le fichier lors du lancement du script.

Voilà pour l'instant ! Merci pour votre année et j'en profite pour vous transmettre mes voeux !