PowerShell IIS †
#enull{{
&tag(PowerShell,IIS,Internet Information Services);
}}
PowerShellにてIISを扱えるようにする †
PS> Import-Module -Name WebAdministration
コマンドレット一覧 †
Get-Command -Module WebAdministration | Select-Object -Property Name
カテゴリ | コマンドレット名 | | | | |
開始 | Begin-WebCommitDelay | | | | |
終了 | End-WebCommitDelay | | | | |
消去 | Clear-WebConfiguration | Clear-WebRequestTracingSettings | | | |
変換 | ConvertTo-WebApplication | | | | |
無効化 | Disable-WebGlobalModule | Disable-WebRequestTracing | | | |
有効化 | Enable-WebGlobalModule | Enable-WebRequestTracing | | | |
取得 | Get-WebAppDomain | Get-WebApplication | Get-WebAppPoolState | Get-WebBinding | Get-WebConfigFile |
Get-WebConfiguration | Get-WebConfigurationBackup | Get-WebConfigurationLocation | Get-WebConfigurationLock | Get-WebConfigurationProperty |
Get-WebFilePath | Get-WebGlobalModule | Get-WebHandler | Get-WebItemState | Get-WebManagedModule |
Get-WebRequest | Get-Website | Get-WebsiteState | Get-WebURL | Get-WebVirtualDirectory |
作成 | New-WebApplication | New-WebAppPool | New-WebBinding | New-WebFtpSite | New-WebGlobalModule |
New-WebHandler | New-WebManagedModule | New-Website | New-WebVirtualDirectory | |
削除 | Remove-WebApplication | Remove-WebAppPool | Remove-WebBinding | Remove-WebConfigurationBackup | Remove-WebConfigurationLocation |
Remove-WebConfigurationLock | Remove-WebConfigurationProperty | Remove-WebGlobalModule | Remove-WebHandler | Remove-WebManagedModule |
Remove-Website | Remove-WebVirtualDirectory | | | |
追加 | Add-WebConfiguration | Add-WebConfigurationLock | Add-WebConfigurationProperty | | |
リネーム | Rename-WebConfigurationLocation | | | | |
設定 | Set-WebBinding | Set-WebConfiguration | Set-WebConfigurationProperty | Set-WebGlobalModule | Set-WebHandler |
Set-WebManagedModule | | | | |
選択 | Select-WebConfiguration | | | | |
保存 | Backup-WebConfiguration | | | | |
復元 | Restore-WebConfiguration | | | | |
起動 | Start-WebAppPool | Start-WebCommitDelay | Start-WebItem | Start-Website | |
停止 | Stop-WebAppPool | Stop-WebCommitDelay | Stop-WebItem | Stop-Website | |
再起動 | Restart-WebAppPool | Restart-WebItem | | | |
取得 †
Webアプリケーションの一覧を取得する †
- 全てのWebサイトの、全てのWebアプリケーションを取得する
PS> Get-WebApplication
- "Default Web Site"Webサイトに関連付けられたWebアプリケーション一覧を取得する
PS> Get-WebApplication -Site "Default Web Site"
- "Default Web Site"Webサイトに関連付けられた"Test"Webアプリケーションを取得する
PS> Get-WebApplication -Site "Default Web Site" -Name Test
- "Default Web Site"Webサイトに関連付けられた"Test"Webアプリケーションの物理パスを取得する
PS> (Get-WebApplication -Site "Default Web Site" -Name Test).PhysicalPath
IISアプリケーションプールの実行時の状態を取得する †
Webサイトの物理パスを取得する †
Webサイトの起動状態を確認する †
作成 †
アプリケーションプールを作成する †
バインド情報を作成する †
Webサイトを作成する †
- "NewSite1"という名前のWebサイトを作成する
PS> New-WebSite -Name NewSite1
- "NewSite1"という名前のWebサイトを、ID 100、ポート番号 8080、物理パス C:\inetpub\NewSite1 として作成する
PS> New-WebSite -Name NewSite1 -Id 100 -Port 8080 -PhysicalPath C:\inetpub\NewSite1
- "NewSite1"という名前のWebサイトを、ホストヘッダー TestSite、IPアドレス 1.2.3.4 として作成する
PS> New-WebSite -Name NewSite1 -HostHeader TestSite -IpAddress 1.2.3.4
- "NewSite1"という名前のWebサイトを、アプリケーションプール NewAppPool1、SSLバインド有効、SSLポート番号 4433 として作成する
PS> New-WebSite -Name NewSite1 -ApplicationPool NewAppPool1 -Ssl -Port 4433 <- この場合、http バインドは作成されない
削除 †
アプリケーションプールを削除する †
Webサイトを削除する †
起動 †
アプリケーションプールを起動する †
Webサイトを起動する †
停止 †
アプリケーションプールを停止する †
Webサイトを停止する †
再起動 †
アプリケーションプールをリサイクルする †