I'm using this to create an instance of ServerManager
:
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")
$serverManager = New-Object Microsoft.Web.Administration.ServerManager
When running $serverManager.ApplicationPools | Select -Property Name
I get:
Name
----
Clr4IntegratedAppPool
Clr4ClassicAppPool
Clr2IntegratedAppPool
Clr2ClassicAppPool
UnmanagedClassicAppPool
When running $serverManager.Sites | Select -Property Bindings
I get:
Bindings
--------
{[http] :8080:localhost}
{[http] *:23700:localhost}
{[http] *:58996:localhost}
{[http] *:62159:localhost}
{[http] *:51643:localhost}
{[http] *:64256:localhost}
{[http] *:50934:localhost}
{[http] *:53107:localhost}
{[http] *:49414:localhost}
{[http] *:59074:localhost}
{[http] *:61886:localhost}
{[http] *:57546:localhost}
{[http] *:63087:localhost}
{[http] *:63838:localhost}
{[http] *:63727:localhost}
{[http] *:60172:localhost}
So it seems to be connecting to IIS Express instead of my full IIS. How can I make it connect to full IIS instead? The documentation doesn't list any overloads accepting parameters, at least none intended for public use.
There are two versions of the DLL. 7.0.0.0 is included with full IIS, 7.9.0.0 is included with IIS Express. Both versions are also in the GAC.
Specifying version 7.0.0.0 allows access to the full IIS:
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL")
Meanwhile I also found that LoadWithPartialName
is deprecated, this is the current way to do it:
Add-Type -AssemblyName "Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"