WinBatch® Technical Support Forum

Archived Boards => COM Automation and dotNet => Topic started by: seckner on October 22, 2015, 01:21:18 PM

Title: Trying to use WMI root/MicrosoftIISv2
Post by: seckner on October 22, 2015, 01:21:18 PM
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!
Title: Re: Trying to use WMI root/MicrosoftIISv2
Post by: td on October 22, 2015, 02:30:16 PM
Have you tried this

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


?