Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7997891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:04:41+00:00 2026-06-04T15:04:41+00:00

I want to use PowerShell to administer my IIS7 on Windows7 64 bits. I

  • 0

I want to use PowerShell to administer my IIS7 on Windows7 64 bits.

I try install IIS7 Powershell snap-in http://www.iis.net/download/PowerShell

I “Run as administrator”, then typing the command listed below: msiexec /I iis7psprov_x64.msi but I get this error message: “The PowerShell snap-in is part of Windows Operating System. Please install via Programs and Features or Server Manager”

I think this particular feature is not necessary to load the WebAdministration module but I active all options in “Programs and features |

turn Windows features on or off | IIS | Web Management Tools | IIS Management Scripts and Tools

I do those checks:

1.) Power-Shell is installed

PS C:\Program Files\IIS> $Host.Version


    Major  Minor  Build  Revision
     -----  -----  -----  --------
     2      0      -1     -1



PS C:\Program Files\IIS> $PSVersionTable
    Name                           Value
     ----                           -----
     CLRVersion                     2.0.50727.5448
     BuildVersion                   6.1.7601.17514
     PSVersion                      2.0
     WSManStackVersion              2.0
     PSCompatibleVersions           {1.0, 2.0}
     SerializationVersion           1.1.0.1
     PSRemotingProtocolVersion      2.1



PS C:\Program Files\IIS> get-host
    Name             : ConsoleHost
     Version          : 2.0
     InstanceId       : 445ad8f5-87fc-48f7-b010-f7faf948b86c
     UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
     CurrentCulture   : es-ES
     CurrentUICulture : es-ES
     PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
     IsRunspacePushed : False
     Runspace         : System.Management.Automation.Runspaces.LocalRunspace

2.) Set-ExecutionPolicy -ExecutionPolicy {Your Execution Policy}

PS C:\Program Files\IIS> get-ExecutionPolicy
 Unrestricted

3.)Import-Module WebAdministration

PS C:\Program Files\IIS> Import-Module WebAdministration
 PS C:\Program Files\IIS>

4.) C:\Windows\System32\WindowsPowerShell\v1.0\Modules\WebAdministration path exists

5.) Modules and Snap-in

PS C:\Program Files\IIS> get-module -listavailable

ModuleType Name                      ExportedCommands
 ---------- ----                      ----------------
 Manifest   AppLocker                 {}
 Manifest   BitsTransfer              {}
 Manifest   PSDiagnostics             {}
 Manifest   TroubleshootingPack       {}
 Manifest   WebAdministration         {}



PS C:\Program Files\IIS> Get-PSSnapin -Registered


Name        : SqlServerCmdletSnapin100
 PSVersion   : 2.0
 Description : This is a PowerShell snap-in that includes various SQL Server cmdlets.

Name        : SqlServerProviderSnapin100
 PSVersion   : 2.0
 Description : SQL Server Provider

Name        : TfsBPAPowerShellSnapIn
 PSVersion   : 2.0
 Description : This is a PowerShell snap-in that includes Team Foundation Server cmdlets.



PS C:\Program Files\IIS> get-pssnapin


Name        : Microsoft.PowerShell.Diagnostics
 PSVersion   : 2.0
 Description : Este complemento de Windows PowerShell contiene cmdlets de Eventos de Windows y de contador de rendimient
               o.

Name        : Microsoft.WSMan.Management
 PSVersion   : 2.0
 Description : Este complemento de Windows PowerShell contiene cmdlets (como Get-WSManInstance y Set-WSManInstance) que
               usa el host de Windows PowerShell para administrar operaciones WSMan.

Name        : Microsoft.PowerShell.Core
 PSVersion   : 2.0
 Description : Este complemento de Windows PowerShell contiene cmdlets usados para administrar los componentes de Window
               s PowerShell.

Name        : Microsoft.PowerShell.Utility
 PSVersion   : 2.0
 Description : Este complemento de Windows PowerShell contiene cmdlets de utilidad que sirven para manipular datos.

Name        : Microsoft.PowerShell.Host
 PSVersion   : 2.0
 Description : Este complemento de Windows PowerShell contiene cmdlets (como Start-Transcript y Stop-Transcript) proporc
               ionados para su uso con el host de la consola de Windows PowerShell.

Name        : Microsoft.PowerShell.Management
 PSVersion   : 2.0
 Description : El complemento Windows PowerShell contiene cmdlets de administración para administrar los componentes de
               Windows.

Name        : Microsoft.PowerShell.Security
 PSVersion   : 2.0
 Description : Este complemento de Windows PowerShell contiene varios cmdlets para la administración de la seguridad de
               Windows PowerShell.





PS C:\Program Files\IIS> [System.Reflection.Assembly]::LoadFrom( "C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll" )

GAC    Version        Location
 ---    -------        --------
 True   v2.0.50727     C:\Windows\assembly\GAC_MSIL\Microsoft.Web.Administration\7.0.0.0__31bf3856ad364e35\Microsoft....



PS C:\Program Files\IIS> (New-Object Microsoft.Web.Administration.ServerManager)


ApplicationDefaults      : Microsoft.Web.Administration.ApplicationDefaults
 ApplicationPoolDefaults  : Microsoft.Web.Administration.ApplicationPoolDefaults
 ApplicationPools         : {DefaultAppPool}
 SiteDefaults             : Microsoft.Web.Administration.SiteDefaults
 Sites                    : {Default Web Site}
 VirtualDirectoryDefaults : Microsoft.Web.Administration.VirtualDirectoryDefaults
 WorkerProcesses          : {}




PS C:\Program Files\IIS> (New-Object Microsoft.Web.Administration.ServerManager).Sites


ApplicationDefaults        : Microsoft.Web.Administration.ApplicationDefaults
 Applications               : {Default Web Site/}
 Bindings                   : {[http] *:80:}
 Id                         : 1
 Limits                     : Microsoft.Web.Administration.SiteLimits
 LogFile                    : Microsoft.Web.Administration.SiteLogFile
 Name                       : Default Web Site
 ServerAutoStart            : True
 State                      : Started
 TraceFailedRequestsLogging : Microsoft.Web.Administration.SiteTraceFailedRequestsLogging
 VirtualDirectoryDefaults   : Microsoft.Web.Administration.VirtualDirectoryDefaults
 Attributes                 : {name, id, serverAutoStart, state}
 ChildElements              : {bindings, limits, logFile, traceFailedRequestsLogging...}
 ElementTagName             : site
 IsLocallyStored            : True
 Methods                    : {Start, Stop}
 RawAttributes              : {[name, Default Web Site], [id, 1], [serverAutoStart, True], [state, 1]}
 Schema                     : Microsoft.Web.Administration.ConfigurationElementSchema

6.) I try in ps1 file

$succeeded = import-module WebAdministration
 Write-Host  $succeeded

if (($succeeded -ne $null) -and ($succeeded.GetType() -eq [System.Exception]))
 {
   #Could not import, trying to snapin
   add-pssnapin WebAdministration
 }

$succeeded is null, and “add-pssnapin WebAdministration” produces error message: Add-PSSnapin : The Windows PowerShell snap-in ‘WebAdministration’ is not installed on this machine.

PS C:\Program Files\IIS> Add-PSSnapin WebAdministration
 Add-PSSnapin : El complemento WebAdministration de Windows PowerShell no está instalado en este equipo
 En línea: 1 Carácter: 13
 + Add-PSSnapin <<<<  WebAdministration
     + CategoryInfo          : InvalidArgument: (WebAdministration:String) [Add-PSSnapin], PSArgum
     + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

any suggestions about it ? Why fails Add-PSSnapin WebAdministration ?

UPDATE:
I’m confused when exactly do I use Add-PSSnapin and when do I use Import-Module

http://social.technet.microsoft.com/Forums/en/ITCG/thread/3e1ca6e1-d197-4c04-a145-1e922814a618

surely, WebAdministration is only Module, and has’nt PSSnapin. May be…

References:

PowerShell IIS Snapin

Cannot install Powershell Snap-in

http://www.iis.net/download/PowerShell

http://learn.iis.net/page.aspx/429/installing-the-iis-powershell-snap-in/

http://learningpcs.blogspot.com.es/2010/08/powershell-iis-7-webadministration.html

Versión de PowerShell instalada

Determine installed PowerShell version

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T15:04:43+00:00Added an answer on June 4, 2026 at 3:04 pm

    Here is the function I have in my profile.ps1 for loading the WebAdmin module. It covers IIS 7 and 7.5

    # Web administration is loaded as a module on Windows 2008 R2 but as a set of snapins
    # for Windows 2008 (not R2)
    
    function Util-Load-Web-Administration
    {
        $ModuleName = "WebAdministration"
        $ModuleLoaded = $false
        $LoadAsSnapin = $false
    
        if ($PSVersionTable.PSVersion.Major -ge 2)
        {
            if ((Get-Module -ListAvailable | ForEach-Object {$_.Name}) -contains $ModuleName)
            {
                Import-Module $ModuleName
    
                if ((Get-Module | ForEach-Object {$_.Name}) -contains $ModuleName)
                    { $ModuleLoaded = $true } else { $LoadAsSnapin = $true }
            }
            elseif ((Get-Module | ForEach-Object {$_.Name}) -contains $ModuleName)
                { $ModuleLoaded = $true } else { $LoadAsSnapin = $true }
        }
        else
        { $LoadAsSnapin = $true }
    
        if ($LoadAsSnapin)
        {
            try
            {
                if ((Get-PSSnapin -Registered | ForEach-Object {$_.Name}) -contains $ModuleName)
                {
                    if ((Get-PSSnapin -Name $ModuleName -ErrorAction SilentlyContinue) -eq $null) 
                        { Add-PSSnapin $ModuleName }
    
                    if ((Get-PSSnapin | ForEach-Object {$_.Name}) -contains $ModuleName)
                        { $ModuleLoaded = $true }
                }
                elseif ((Get-PSSnapin | ForEach-Object {$_.Name}) -contains $ModuleName)
                    { $ModuleLoaded = $true }
            }
    
            catch
            {
                Write-Error "`t`t$($MyInvocation.InvocationName): $_"
                Exit
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://learn.iis.net/page.aspx/327/powershell-scripts/ CreateIISBindingOntoSite DAP1Site1 80 www.DAP1Site2.com http However I want to generate and usa a
I want to use Powershell to write some utilities, leveraging our own .NET components
In .NET scripting languages such as PowerShell and IronPython, when you want to use
I want to use ADO.NET Prepare command will increase performance if query is repeatevely
I am really very new to powershell. I want to use powershell to read
Update, Script is working with PowerShell V3.0, Thanks @ Doug I want to use
I want to use Windows Task Scheduler to execute my ASP.NET web page (.aspx).
I am teaching myself PowerShell by writing a simple parser. I use the .Net
I want to use PowerShell to transfer files with FTP to an anonymous FTP
Suppose I have the following XML file, and I want to use PowerShell (version

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.