Hi Folks,
I must be missing something simple here, but I can’t understand why I’m having issues with this.
I want to simply get (and match) a VirApp under a specific website.
So, this here command works fine:
Import-Module WebAdministration -ErrorAction Stop $WebsiteName = "mywebsite.com" $VirDirName = "LocalVD" Get-WebApplication -Site $WebsiteName
It will list all VirApps under that site:
Name Application pool Protocols Physical Path ---- ---------------- --------- ------------- LocalVD mywebsite.com http E:\websites\mywebsite\www\LocalVD access mywebsites.com http E:\SSO\access
So, why is this returning nothing?
$VirApp = (Get-WebApplication -Site $WebsiteName | Where-Object {$_.Name -eq $VirDirName})
The $_.Name should work right? It should match the Name object in the array?
I can even directly get the VirApp name via
Get-WebApplication -Name $VirDirName
and it gives:
Name Application pool Protocols Physical Path ---- ---------------- --------- ------------- LocalVD mywebsite.com http E:\websites\mywebsite\www\LocalVD
But, I need to firstly get a specific website and only a specific VirApp under that site.
So, what is wrong with my statement to match the $_.Name and the $VirDirName variable?
It doesn’t return any value.
What did I miss here?
THANKS!