Archived Boards > COM Automation and dotNet

Trying to use WMI root/MicrosoftIISv2


Found a script in the dbase that 'kind of' does what I need to do - stop and start AppPools on an IIS 7 (Server 2008 R2) server. Got the IIS WMI Ver 6 tools installed and I can now actually connect using    objService = objLocator.ConnectServer(sCompName,"root/microsoftiisv2","","")   with no errors. However whenever I query now  (query = "Select * From IIsApplicationPool") I get "SWbemServicesEx Access Denied" error.

I went digging and found a VB post stating I would need to do something like    Set objWMIService = GetObject("winmgmts:{authenticationLevel=Pkt}!\\" _  & strComputer & "\root\...") but can't figure out how to set it up to work with WB. Any help, advice or other method will be GREATLY appreciated!

Have you tried this

--- Code: Winbatch ---objWMIService = GetObject("winmgmts:{authenticationLevel=Pkt}!\\":strComputer:"\root\...whatever goes here maybe microsoftiisv2 ...")


[0] Message Index

Go to full version