Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1574 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Script Détection Windows ne fonctionne pas sous Seven

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Script Détection Windows ne fonctionne pas sous Seven

n°2143978
Eysinem
Posté le 29-05-2012 à 16:11:56  profilanswer
 

J'utilise le script ci-dessous pour détecter la version de l'OS afin d’afficher le message adéquat.
 
Il marche sous XP mais pas sous Seven.
 
Pouvez-vous m'aider ?
 

Code :
  1. strComputer = "."
  2. Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2" )
  3. Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem" )
  4. For Each os in oss
  5. Systeme = os.Caption
  6. Select Case Systeme
  7. Case "Microsoft Windows XP Professionnel"
  8. Msgbox "On est sur XP"
  9. Case "Microsoft Windows 7 Professionnel"
  10. Msgbox "On est sur 7"
  11. End Select
  12. Next

mood
Publicité
Posté le 29-05-2012 à 16:11:56  profilanswer
 

n°2159326
NiKaro127
Posté le 05-10-2012 à 18:31:50  profilanswer
 

Il manque le « : » après ton « Case "...": », mais ça ne fonctionne toujours pas j'ai l'impression.
 
Essaie ça :

Code :
  1. strComputer = "."
  2. Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2" )
  3. Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem" )
  4. For Each os in oss
  5.     Systeme = os.Caption
  6.     WScript.Echo Systeme
  7.     If Systeme = "Microsoft Windows XP Professionnel" Then
  8.             WScript.Echo "On est sur XP"
  9.     ElseIf Systeme = "Microsoft Windows 7 Professionnel" Then
  10.             WScript.Echo "On est sur 7"
  11.     End If
  12. Next


---------------
Nicolas KAROLAK - Administrateur Systèmes & Réseaux

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Script Détection Windows ne fonctionne pas sous Seven

 

Sujets relatifs
partage windows avec phpQuestion sur un script qui ajoute un profil Outlook
Iompatibilité script entre Seven et XP[windows] Captures d'écrans en lignes de commandes
[SHELL UNIX] Fermer le terminal a la fin d un script shellScript Javascript - Fond d'une partie du site
[Topic Unique] Programmation Windows 8 / WinRT / Metro[GlovePIE] Programation script wiimote
Script d'ouverture de fenetres 
Plus de sujets relatifs à : Script Détection Windows ne fonctionne pas sous Seven


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR