Introduction
IIS PowerShell Provider cmdlets can be grouped into three categories:
- Cmdlets required by the Provider Hierarchy
- low-level configuratioin cmdlets
- Task-based cmdlets
This walkthrough introduces the task-based IIS cmdlet and gives some examples how to use them.
Cmdlets Required by the Provider Hierarchy
IIS decided early on to make IIS configuration available as an hierarchy of Sites, Applications, Virtual Directories and Application Pools. The benefit is that customers can navigate to a location, e.g. a Site or Application, in the hierarchy and set settings in this context. To support a navigation hierarchy certain pre-defined PowerShell cmdlets like New-Item, Set-ItemProperty etc. have to be implemented. The hierarchy and these built-in cmdlets were shipped in Tech Preview 1 in April 2008.
Low-level Configuration Cmdlets
The IIS configuration system was completely revised in version 7. The new configuration system is fully XML-based, schema-driven and completely extensible. The new IIS FTP Server (FTP7) and many other IIS7 modules like the URL Rewriter, WebDAV etc. leverage this extensibilty to plug into the IIS7 configuration system.
This extensibilty makes it hard to ship cmdlets with static arguments. Imagine the case where somebody extends an existing configuration section, for example somebody adds a myFancyNewBehavior property to the virtualDirectory configuration section. Without revising the IIS cmdlets fancyNewBehavior setting wouldn't be settable via the PowerShell Provider cmdlets.
Technical Preview 1 of the IIS PowerShell Provider included only low-level cmdlets that took the total configuration extensibility in account. Every IIS configuration setting (more than 100 configuration sections with collections, enumerations etc.) can be configured using these cmdlets. These low-level cmdlets also work against custom configuration, for example if you extended IIS configuration with your own configuration section.
Here is the list of low-level cmdlets we shipped in Tech Preview 1 back in April 2008:
Add-WebConfiguration
Add-WebConfigurationProperty
Begin-CommitDelay
Clear-WebConfiguration
End-CommitDelay
Get-URL
Get-WebConfiguration
Get-WebConfigurationProperty
Get-WebItemState
Remove-WebConfigurationProperty
Restart-WebItem
Set-WebConfiguration
Set-WebConfigurationProperty
Start-WebItem
Stop-WebItem
Task-based Cmdlets
Here comes the exciting news. Tech Preview 2 ships with 40 new cmdlets. All of these cmdlets are for day-to-day IIS tasks like creating web-sites, enabled request tracing, adding a handler or a module. Here is a list of the new cmdlets:
Backup-WebConfiguration
Clear-FrebData
ConvertTo-WebApplication
Disable-Freb
Disable-WebModule
Enable-Freb
Enable-WebModule
Get-AppDomain
Get-AppPoolState
Get-ConfigurationBackup
Get-WebHandler
Get-WebModule
Get-WebRequest
Get-WebSiteState
New-AppPool
New-FtpSite
New-ManagedWebModule
New-VirtualDirectory
New-WebApplication
New-WebBinding
New-WebHandler
New-WebModule
New-WebSite
Remove-AppPool
Remove-ConfigurationBackup
Remove-VirtualDirectory
Remove-WebApplication
Remove-WebBinding
Remove-WebHandler
Remove-WebModule
Remove-WebSite
Restart-AppPool
Set-WebBinding
Set-WebHandler
Set-WebModule
Start-AppPool
Start-WebSite
Stop-AppPool
Stop-WebSite
Summary
The new task-based cmdlets in Tech Preview 2 will give Administrators an easy way to accomplish day-to-day IIS task with PowerShell. The low-level IIS cmdlets shipped in Tech Preview 1 will still allow more advanced IIS Administration tasks.
Comments