Bonjour,

J'ai essayé de modifier un script trouver ici pour tester si l'OS est windows 10.

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
If FindOSType(".") = "Windows 10" Then 
MsgBox "Exécution avec Windows 10",64,"Système d'exploitation"
'votre code pour Windows 10
Else
MsgBox "Exécution avec Windows 7",64,"Système d'exploitation"
'Votre code pour les autres systèmes
end if
 
Function FindOSType(strComputer)
'Defining Variables
    Dim objWMI, objItem, colItems
    Dim OSVersion, OSName, ProductType
 
'Get the WMI object and query results
    Set objWMI = GetObject("winmgmts://" & strComputer & "/root/cimv2")
    Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)
 
'Get the OS version number (first two) and OS product type (server or desktop) 
    For Each objItem in colItems
        OSVersion = Left(objItem.Version,3)
        ProductType = objItem.ProductType
    Next
'Time to convert numbers into names
    Select Case OSVersion
    Case "10.0*"    
		OSName = "Windows 10"
    Case "6.1"
        OSName = "Windows 7"
    End Select
 
'Return the OS name
    FindOSType = OSName
 
'Clear the memory
    Set colItems = Nothing
    Set objWMI = Nothing
End Function
Malheureusement cela ne fonctionne pas. Pourriez-vous m'aider ?

Je vous remercie par avance