Je dois faire une affectation pour mon stage et je n'arrive pas à comprendre pourquoi le conditionnel ne fonctionnera pas. J'essaye d'obtenir tous les windowsservices sauf quelques uns avec un VBScript et l'écris dans un fichier texte. Bien que je n'ai aucune expérience de programmation et je suis à la perte ici. Pourriez-vous les gars comprendre ce qui ne va pas avec ce morceau de code:VBscript conditionnel pour chaque
Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile _
("D:\Beheer\Scripts\Services\Services_For_this_server.txt", ForAppending, True)
Set colServices = GetObject("winmgmts:").ExecQuery _
("Select * from Win32_Service")
For Each objService in colServices
If objService = "Human Interface Device Access" OR
"Health Key and Certificate Management" OR
"IKE and AuthIP IPsec Keying Modules" OR
"PnP-X IP Bus Enumerator" OR
"IP Helper" OR
"CNG Key Isolation" OR
"KtmRm for Distributed Transaction Coordinator" OR
"Server" OR
"Workstation" OR
"Link-Layer Topology Discovery Mapper" OR
"TCP/IP NetBIOS Helper" OR
"Multimedia Class Scheduler" OR
"Windows Firewall" OR
"Distributed Transaction Coordinator" OR
"Microsoft iSCSI Initiator Service" OR
"Windows Installer" OR
"Network Access Protection Agent" OR
"Netlogon" OR
"Network Connections" OR
"Network List Service" OR
"Network Location Awareness" OR
"Network Store Interface Service" OR
"Performance Counter DLL Host" OR
"Performance Logs & Alerts" OR
"Plug and Play" OR
"IPsec Policy Agent" OR
"Power" OR
"User Profile Service" OR
"Protected Storage" OR
"Remote Access Auto Connection Manager" OR
"Remote Access Connection Manager" OR
"Routing and Remote Access" OR
"Remote Registry" OR
"RPC Endpoint Mapper" OR
"Remote Procedure Call (RPC) Locator" OR
"Remote Procedure Call (RPC)" OR
"Resultant Set of Policy Provider" OR
"Special Administration Console Helper" OR
"Security Accounts Manager" OR
"Smart Card" OR
"Task Scheduler" OR
"Smart Card Removal Policy" OR
"Secondary Logon" OR
"System Event Notification Service" OR
"Remote Desktop Configuration" OR
"Internet Connection Sharing (ICS)" OR
"Shell Hardware Detection" OR
"SNMP Trap" OR
"Print Spooler" OR
"Software Protection" OR
"SPP Notification Service" OR
"SSDP Discovery" OR
"Secure Socket Tunneling Protocol Service" OR
"Microsoft Software Shadow Copy Provider" OR
"Telephony"
THEN ""
ELSE
objTextFile.WriteLine(objService.DisplayName)
Next
objTextFile.Close
Que voulez-vous arriver, et de quelle manière il ne « fonctionne pas »? –