Hi folks. i'm trying to get all the application pools in IIS for a Site and the web applications under neath that particular site. Our infrastructure has the "default site" and "company application" sites. I'm only trying to get a list of all the app pools for the 2nd site - "company application". Now the "company application" name changes since our company has literally several hundred applications. I've written this so far to pull the name of the 2nd site within IIS successfully and store the Site name to a text file on d: drive. So i'm now trying to get the names of the web applications beneath the 2nd site but am having difficulty with select-object.
$site = gc "D:\temp\iisname.txt"
Get-WebApplication -Site "$site"
Output below :-
Name Application pool Protocols Physical Path
---- ---------------- --------- -------------
AppXY AppXY http D:\Inetpub\companyApp\AppXY
AppZBA AppZBA http D:\Inetpub\companyApp\AppZBA
The problem now lies here, when I update the code with select object as below. The output below is blank. How do i rectify this please? Thanks much
$site = gc "D:\temp\iisname.txt"
Get-WebApplication -Site "$site" |Select-Object -Property Name
Name
----