How can I use IIS administration commandlets on Windows Server 2012 R2?

5,493

As jScott correctly remarked in the comments, Get-IISSite ist not included in Windows-Server 2012 R2, but only in later Windows Server versions and in Windows 10 or higher. Import-Module WebAdministration; (Get-Module WebAdministration).ExportedCommands is very similar and works under Windows Server 2012 R2 though.

Share:
5,493

Related videos on Youtube

Adrian Grigore
Author by

Adrian Grigore

Please visit my development blog at http://devermind.com if you'd like to learn more about me.

Updated on September 18, 2022

Comments

  • Adrian Grigore
    Adrian Grigore over 1 year

    I'm trying to use IIS administration commandlets such as Get-IISSite on a Windows Server 2012 R2 computer.

    I've already installed IIS Server and all IIS Management Tools roles and rebooted the server.

    Installed Web Server Roles

    However, when I open a PS commandline as administrator, the commandlets are still missing:

    PS C:\Users\Administrator> get-command *iis*
    
    CommandType     Name                                               ModuleName
    -----------     ----                                               ----------
    Function        IIS:                                               WebAdministration
    Application     iisreset.exe
    
    
    PS C:\Users\Administrator>
    

    What am I doing wrong?

    Edit: One thing I've also already tried (without any luck):

    PS C:\Users\Administrator> Import-Module webadministration
    PS C:\Users\Administrator> get-command *iis*
    
    CommandType     Name                                               ModuleName
    -----------     ----                                               ----------
    Function        IIS:                                               webadministration
    Application     iisreset.exe
    
    
    PS C:\Users\Administrator>
    
    • jscott
      jscott over 8 years
      I don't see Get-IISSite listed for 2012 R2, it doesn't appear until Server Technical Preview/Windows 10. What does Import-Module WebAdministration; (Get-Module WebAdministration).ExportedCommands have to say?
    • Adrian Grigore
      Adrian Grigore over 8 years
      @jscott: that does indeed work (There's get-webserver instead of get-iis). Thanks for your help! However, now I'm confused. What is the difference between get-webserver and get-iis? it seems very similar.
    • jscott
      jscott over 8 years
      Looking at the docs the main difference seems Get-WebSite uses -Name <String> while Get-IISSite users -Name <String[]>. I haven't a Server Technical Preview available at the moment to provide a more useful response, sorry.
    • Alex
      Alex over 2 years
      IIS Team Blog - Introducing IISAdministration in the PowerShell Gallery blogs.iis.net/iisteam/…