locked
Win32_PerfFormattedData_W3SVC_WebService can't work RRS feed

  • Question

  • hi all,

    i write this code is working correctly in my windows server 2003 SP2 ,but when i change a computer with the same OS,it's just can't output the ServiceUptime and TotalConnectionAttemptsAllInstances,can anyone tell me the reason,Thanks!

    strComputer = "." 
    
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
     
    Set colItems = objWMIService.InstancesOf("Win32_PerfFormattedData_W3SVC_WebService")  
    
    
    For Each colItem In colItems	
    	logFile.WriteLine("Serviceuptime:" & colItem.ServiceUptime)
    	logFile.WriteLine("TotalConnetions: " & CLng(colItem.TotalConnectionAttemptsAllInstances) )  
    Next 

     

    Monday, July 4, 2011 1:42 AM