Powershell WMI for IIS7/7.5 reporting
Posted on 2011-03-02
I have been tasked to put together a reporting script to gather several attributes from several IIS instances on several servers using several versions of IIS. The script needs to be able to run from any location with a vanilla PowerShell configuration loaded. I have it working fine and gathering all needed attribues using:
Get-WmiObject -Namespace "root\WebAdministration" -Class Site -Authentication PacketPrivacy -ComputerName x
Get-WmiObject -NameSpace "root\WebAdministration" -Class VirtualDirectory -Authentication PacketPrivacy -ComputerName x
I can find the site name, physical directory pathm log directory path, site binding information along with other details, but I cannot find the AppPoolID.
In IIS 6 I used to gather this with an ADSI connection or with System.DirectoryServices.DirectoryEntry("IIS://server/W3SVC/1/root") but this does not appear to work with a 7.5 instance not in compatability mode.
Where can I find the AppPoolID in the root\WebAdministration namespace?