
matt.kirkland1.552491663116908E12 asked a question.
Installscript: Get IIS WebSites with WMI
I am trying to a list of websites from the local machine that IIS has available. I am trying to use the CoGetObject to access WMI but i cannot get it to work any ways that i have been able to find online. Ultimately i am trying to get the Virtual Directory path for any current website that may exist on the users machine before install or upgrade.
What i have tried so far is not working for me. Anyone have something working with IIS 7.5 on Win7 x64?
set oIISRoot = CoGetObject("IIS://localhost/W3SVC","");
set oIISRoot = CoGetObject("winmgmts:\\.\root\CIMV2", "");
set oIISRoot = CoGetObject("IIS://localhost/W3SVC/1/ROOT");
I have had limited success on some machines with this
I've tried these same pieces of code for GetObject as well with no success
set "appcmd=%windir%\system32\inetsrv\appcmd.exe"
%appcmd% list site
From a command prompt or bat file do this:
set "appcmd=%windir%\system32\inetsrv\appcmd.exe"
%appcmd% list site "
I ended up taking this route. appcmd.exe can handle what i need it too. Thanks