環境:Windows Server 2008 R2 (IIS7.5)

Windows Server 2008 R2 には標準でIIS の PowerShell プロバイダが入っていますので、 PowerShellから簡単にIISの管理を行うことができます。

今回は、IISマネージャーの「サイトの管理」で表示される「サイト名」「アプリケーションプール」「物理パス」を変更してみます。

 

管理者権限で Windows PowerShell を実行し、実行ポリシーの変更、IIS WebAdministration モジュールをインポートします。

Set-ExecutionPolicy RemoteSigned
import-module WebAdministration

 

サイトの編集は下記のコマンドで行うことができます。既存の値を変更しますので、「Set-ItemProperty」を使用します。

物理パスの変更

Set-ItemProperty "IIS:\Sites\Default Web Site" -name PhysicalPath -value "C:\inetpub\wwwroot2"

アプリケーションプールの変更

Set-ItemProperty "IIS:\Sites\Default Web Site" -name Applicationpool -value "Classic .NET AppPool"

サイト名の変更

Set-ItemProperty "IIS:\Sites\Default Web Site" -name name -value "New Web Site"

 

変更前(デフォルト)

変更前

変更後

02

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading