Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Display site and bindings using wmi

$
0
0

Hi

I want to display IIS sites and their relevant bindings in tabular format. I am connecting to remote machines so due to security reasons I cannot use Get-Website and so have to use WMI. I have the following which doesn't return results when I insert name after "-property": 

$objWMI = [WmiSearcher] "Select * From Site"

$objWMI.Scope.Path = "\\remotepc\root\WebAdministration" 

$objWMI.Scope.Options.Authentication = 6 

$sites = $objWMI.Get() 

foreach ($site in $sites)

{

$site |ft -property name,bindings|select BindingInformation |where {$_.BindingInformation -like "*bind*"}|sort Bindinginformation

}

It doesn't seem to like the name before the bindings.

I would like it in a tabular format like this:

mysitev1.co.uk         www.bindsite.co.uk

mysitev2.co.uk         www.bind2site.co.uk

etc

Thanks

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles