How to Enable Web Service Extension and Set Web Site AppPool with PowerShell / Comment activer une extension de site web ou modifier l’Application Pool d’un site web en PowerShell

[English]

PowerShell is very powerful and allows you to script and manage easily your IT. The following scripts show you how you can use WMI to manage IIS 6.

Set App Pool

$newVDir =[wmi] 'root\MicrosoftIISv2:IIsWebVirtualDirSetting.Name="W3SVC/1/ROOT/MaxVirtDir"' $newVDir.AppPoolId = "MaxAppPool" $newVDir.Put()

Enable Web Service Extension (WebDav for example)

$Sites=[wmi]'root/MicrosoftIISv2:IISWebService="W3SVC"' $Sites.EnableWebServiceExtension('WEBDAV')

[Français]

PowerShell est très puissant et vous permets de scripter et gérer facilement votre infrastructure. Les scripts suivants illustre comment utiliser WMI pour configurer IIS 6

Modification de l’application pool

$newVDir =[wmi] 'root\MicrosoftIISv2:IIsWebVirtualDirSetting.Name="W3SVC/1/ROOT/MaxVirtDir"' $newVDir.AppPoolId = "MaxAppPool" $newVDir.Put()

Activer une extension de site web (WebDav par exemple)

$Sites=[wmi]'root/MicrosoftIISv2:IISWebService="W3SVC"' $Sites.EnableWebServiceExtension('WEBDAV')