How can I use IIS administration commandlets on Windows Server 2012 R2?
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.
Related videos on Youtube
Adrian Grigore
Please visit my development blog at http://devermind.com if you'd like to learn more about me.
Updated on September 18, 2022Comments
-
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.
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 over 8 yearsI don't see
Get-IISSite
listed for 2012 R2, it doesn't appear until Server Technical Preview/Windows 10. What doesImport-Module WebAdministration; (Get-Module WebAdministration).ExportedCommands
have to say? -
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 over 8 yearsLooking at the docs the main difference seems
Get-WebSite
uses-Name <String>
whileGet-IISSite
users-Name <String[]>
. I haven't a Server Technical Preview available at the moment to provide a more useful response, sorry. -
Alex over 2 yearsIIS Team Blog - Introducing IISAdministration in the PowerShell Gallery blogs.iis.net/iisteam/…
-