我必須爲我的實習做一個任務,我無法弄清楚爲什麼條件將無法正常工作。 我試圖讓所有的windowsservices除了一些VBscript,並將其寫入到文本文件。雖然我沒有編程經驗,但我在這裏不知所措。你們能找出這段代碼有什麼問題:VBscript有條件的每個
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
你要什麼發生,以及以何種方式它「不工作」? – 2013-02-24 14:23:09