WMI query not working outside IDE
I tested this in the IDE and it worked fine. When I pushed the EXE to a live machine it did absolutely nothing. Is there a service that needs to be running? Permissions are set correctly for the administrator and I even granted full permissions to Everyone on the server. Is there something I am missing? Dim objWmiService As Object Dim colItems As Object Dim strComputer As String strComputer = "." Set objWmiService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftIISv2") Set colItems = objWmiService.ExecQuery("SELECT * FROM IISWebServerSetting", , 48)
May 15th, 2012 12:46pm

You may need to trap errors to check if there is a permission problem. IIS may require permissions granted to a builtin user, perhaps IUSR_ServerName or IWAN_ServerName. See this link: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/3648346f-e4f5-474b-86c7-5a86e85fa1ff.mspx?mfr=true Otherwise, for best compatibility I specify impersonationLevel and authenticationLevel in the WMI binding string. For example (one line): Set objWmiService = GetObject("winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" & strComputer & "\root\MicrosoftIISv2") ----- Richard Mueller - MVP Directory Services
Free Windows Admin Tool Kit Click here and download it now
May 15th, 2012 1:36pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics