Powershell script to enable 'IIS Management Scripts and Tools' Powershell script to enable 'IIS Management Scripts and Tools' powershell powershell

Powershell script to enable 'IIS Management Scripts and Tools'


Would that be for Windows 2008 or Windows Server 2008 R2?

Server 2008R2:

-To query:

PS> get-windowsfeature|where{$_.name -eq "Web-Scripting-Tools"}Display Name                                            Name------------                                            ----        [X] IIS Management Scripts and Tools            Web-Scripting-Tools

The "[X]" indicates it is installed.

-To add:

PS> get-windowsfeature|where{$_.name -eq "Web-Scripting-Tools"}|add-windowsfeature

If you're asking about Server 2008, then you'll have to parse the output from servermanagercmd.exe, which will be a bit tougher, but not impossible.


I don't think powershell is a good choice for automated installation because first you have to install powershell (unless this is windows 2008 R2) and then you have to enable script execution before your scripts will run.

Instead us pkgmgr or ocsetup which can be run from a regular cmd.exe console.This should work for IIS 7 (Windows 2008)

start /w pkgmgr /iu:IIS-WebServerManagementTools;IIS-ManagementConsole;start /w pkgmgr /iu:IIS-ManagementScriptingTools;IIS-ManagementService;start /w pkgmgr /iu:IIS-IIS6ManagementCompatibility;IIS-Metabase;

If you are really determined to use powershell this will install it on Windows 2008

start /w pkgmgr /iu:MicrosoftWindowsPowerShell

Keep in mind that this installs the Windows 2008 OS "Feature" and so you will get PowerShell version 1.0 not PowerShell version 2.0.

This article explains how to get PowerShell v 2 for your OS (2008 and earlier)http://support.microsoft.com/kb/968929