29

We have some Powershell scripts used to set up various dev/test/prod environments and one of them installs and configures IIS. Unfortunately these scripts don't appear to be working under Windows 10 at this time because the Install-WindowsFeature cmdlet is missing.

Where these removed intentionally, or is there some hoop I need to jump through to install them that wasn't previously necessary?

Mr. Smythe
  • 613
  • 1
  • 8
  • 13

3 Answers3

33

While Ryan's answer is correct, I would recommend to stay away from the Install-WindowsFeature cmdlets if you want to run your scripts on workstations as well. You will always be dependent on RSAT even though you don't need it otherwise.

Just use Enable-WindowsOptionalFeature which works on servers and workstations. You would need to change your scripts, the feature names are different too.

I wrote a bit about: Different ways for installing Windows features on the command line

Peter Hahndorf
  • 13,763
  • 3
  • 37
  • 58
  • 1
    I'm accepting this one as it seems more flexible and politely points out that I'm doing it wrong. :) Now, off to find out if the xml template I've been feeding into Install-WindowsFeature will work with Enable-WindowsOptionalFeature as well. – Mr. Smythe Aug 11 '15 at 14:42
  • 1
    `Enable-WindowsOptionalFeature` has a bit of weird behavior though. It doesn't allow you to suppress the confirm prompt. It makes it unfit for use in an automated provision-er like chef. I don't have a better answer, I was just surprised that it was written in a way that doesn't respect Powershell's builtin confirm preference. – Jason Morgan Dec 23 '17 at 18:57
  • @JasonMorgan - Do you have an example for such a case? – Peter Hahndorf Dec 25 '17 at 02:22
2

It's not out yet. As always, Remote Server Administration Tools (RSAT - also includes the *-WindowsFeature cmdlets) have always been very sensitive to OS version. I.e., you'd use Windows 7 RSAT on Windows 7 to manage Server 2008 R2, Windows 8.1 RSAT on Win 8.1 to manage Server 2012 R2, etc. Using RSAT across OS versions may work, but it may also crash unexpectedly. The *-WindowsFeature cmdlets are technically part of the ServerManager module, and since Server 2016 isn't out yet, you might not see these cmdlets for a while.

Might be able to get this to work: https://www.microsoft.com/en-us/download/details.aspx?id=45520

Or, if not, just find a downlevel Windows workstation to do your remote administration from for now.

Ryan Ries
  • 55,011
  • 9
  • 138
  • 197
  • 1
    Only a side note to your answer, RSAT for Windows 10 is expected this month and will arrive alongside Windows Server 2016 Technical Preview 3 – yagmoth555 Aug 11 '15 at 02:01
  • For the record, this is all being done locally. But a dependency is a dependency. – Mr. Smythe Aug 11 '15 at 14:37
  • @Mr.Smythe Of course, outside the scoop of your question, if you manage your servers from those machine, you might still need RSAT in the end – yagmoth555 Aug 11 '15 at 16:24
  • 1
    fyi; https://www.microsoft.com/en-us/download/details.aspx?id=45520 :) published today (and winserv 2016 technical preview 3 too!) /cc @Mr.Smythe – yagmoth555 Aug 19 '15 at 19:39
0

You will also see this error on Server 2012/16/19 if you execute the command form the x86 version of PowerShell The Term ‘Uninstall-WindowsFeature’ is not Recognized

Dave M
  • 4,494
  • 21
  • 30
  • 30
user187724
  • 21
  • 1