Hello,
j'ai ce script:
Code:
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 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colDiskPartitions = objWMIService.ExecQuery _ ("Select * from Win32_DiskPartition") For each objPartition in colDiskPartitions Wscript.Echo "Device ID: " & objPartition.DeviceID Wscript.Echo "=============================================" & vbcr Wscript.Echo " Number Of Blocks: " & objPartition.NumberOfBlocks Wscript.Echo " Block Size: " & objPartition.BlockSize & " KB" Wscript.Echo " Total Volume Size: " & Round( (objPartition.Size/1024/1024/1024), 0) & " GB" Wscript.Echo " Type: " & objPartition.Type Wscript.Echo " Starting Offset: " & objPartition.StartingOffset & " (" & objPartition.StartingOffset/1024 & " KB)" If ( (objPartition.StartingOffset Mod 1024) = 0) Then Wscript.Echo " Disk Alignment: Aligned" If ( (objPartition.StartingOffset / 1024) < 1024 ) Then Wscript.Echo vbCrLf & " * Please note, this is not necessarly a problem, however we noticed" & _ vbCrLf & " your starting offset is less than the Microsoft recommended size" & _ vbCrLf & " of 1024 KB. Please see Microsoft's KB article 929491 for " & _ vbCrLf & " additional details." End If Else Wscript.Echo " Disk Alignment: NOT ALIGNED!!" End If Wscript.Echo "" Next
... ou j'ai besoin de n'afficher qu'un seul HD et non tous, j'aurais aimé
inclure entre
un genre de "if objPartition.DeviceID contains 'INTEL SSD' then"Code:
1
2
3 For each objPartition in colDiskPartitions Wscript.Echo "Device ID: " & objPartition.DeviceID
mais je ne sais pas le faire, des pistes ?
j'ai essayé ce qui suit mais ca marche pas :-(
D:\align.vbs(29, 11) Erreur de compilation Microsoft VBScript: Fin d'instruction
attendue
ps: je n'y connais rien dans ce language ;)Code:
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 strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colDiskPartitions = objWMIService.ExecQuery _ ("Select * from Win32_DiskPartition") For each objPartition in colDiskPartitions Dim str As String >>>>>>>>>> la ligne 29 est celle au dessus ;) str = result.objPartition.DeviceID If str.Contains("INTEL SSD") = True Then Wscript.Echo "Device ID: " & objPartition.DeviceID Wscript.Echo "=============================================" & vbcr Wscript.Echo " Number Of Blocks: " & objPartition.NumberOfBlocks Wscript.Echo " Block Size: " & objPartition.BlockSize & " KB" Wscript.Echo " Total Volume Size: " & Round( (objPartition.Size/1024/1024/1024), 0) & " GB" Wscript.Echo " Type: " & objPartition.Type Wscript.Echo " Starting Offset: " & objPartition.StartingOffset & " (" & objPartition.StartingOffset/1024 & " KB)" If ( (objPartition.StartingOffset Mod 1024) = 0) Then Wscript.Echo " Disk Alignment: Aligned" If ( (objPartition.StartingOffset / 1024) < 1024 ) Then Wscript.Echo vbCrLf & " * Please note, this is not necessarly a problem, however we noticed" & _ vbCrLf & " your starting offset is less than the Microsoft recommended size" & _ vbCrLf & " of 1024 KB. Please see Microsoft's KB article 929491 for " & _ vbCrLf & " additional details." End If Else Wscript.Echo " Disk Alignment: NOT ALIGNED!!" End If Wscript.Echo "" End If Next