views:

49

answers:

1

How to Get the Time When IIS Started With Classic ASP?

+3  A: 
' This works on my machine... '
Option Explicit
Dim objWMIService, procs, proc, creationDate
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\.\root\cimv2") 

Set procs = objWMIService.ExecQuery ("Select * from Win32_Process where name='inetinfo.exe'")

For Each proc In procs
  creationDate = creationDate & vbCr & proc.CreationDate
Next
Jonas Elfström
Seems to throw "error '80041003'" on my machine unless I disable anonymous access in IIS for the ASP page that executes the above script.
Saul Dolgin
Sounds like the user that your ASP application runs as does not have enough privileges, maybe temporarily impersonating another user could help: http://support.microsoft.com/kb/248187
Jonas Elfström
Cool... Works for me!
Daniel Silveira