On server 2008 R2 Standard within Powershell. I am trying to run a script that uses Get-WebBinding
try{
Import-Module WebAdministration
Get-WebApplication
$webapps = Get-WebApplication
$list = @()
foreach ($webapp in get-childitem IIS:\AppPools\)
{
$name = "IIS:\AppPools\" + $webapp.name
$item = @{}
$item.WebAppName = $webapp.name
$item.Version = (Get-ItemProperty $name managedRuntimeVersion).Value
$item.State = (Get-WebAppPoolState -Name $webapp.name).Value
$item.UserIdentityType = $webapp.processModel.identityType
$item.Username = $webapp.processModel.userName
$item.Password = $webapp.processModel.password
$obj = New-Object PSObject -Property $item
$list += $obj
}
$list | Format-Table -a -Property "WebAppName", "Version", "State", "UserIdentityType", "Username", "Password" | Out-String
}catch
{
$ExceptionMessage = "Error in Line: " + $_.Exception.Line + ". " + $_.Exception.GetType().FullName + ": " + $_.Exception.Message + " Stacktrace: " + $_.Exception.StackTrace
$ExceptionMessage
}
however, I am getting the following error:
The term 'Get-WebBinding' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:25 char:15 + Get-WebBinding <<<< | % { + CategoryInfo : ObjectNotFound: (Get-WebBinding:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
I tried to add the snapin and got this error:
PS C:\Windows\system32> add-pssnapin WebAdministration Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 2. At line:1 char:13 + add-pssnapin <<<< WebAdministration + CategoryInfo : InvalidArgument: (WebAdministration:String) [Add-PSSnapin], PSArgumentException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
And per this article https://community.spiceworks.com/topic/370385-powershell-commands-to-export-iis7-sites-binding-information: since I am using iis 7, I tried to get the powershell extensions. I went to the iis.net link ( https://www.iis.net/downloads/microsoft/powershell ) and couldn't find the download. The button just takes you to a gallery search.
There is a button to install the extension but it doesn't pull up the installer.