I have just started going through some tutorials of Powershell – for I want to write scripts to create website/virtual dir/appPool
However I am confused about these terms –
- Powershell
- Powershell SnapIn
- AppCmd.exe
It seems they all can be used for IIS 7.0 administration tasks.
Can please share some knowledge about how these three differ with each other?
Thanks a lot!
Powershell itself cannot really be used for IIS administration – it is “just” a shell. However, it is extensible, by way of snapins and modules, such as the IIS module “WebAdministration”. You can load this by using the Import-Module command in powershell. This will make available many commands relevant to IIS administration, such as
New-Websiteand friends. You also get access to a new PSDrive, which is a logical representation of your IIS configuration. It is available bycd IIS:\, and here you can browse your app pools and web sites. Check out this MSDN article for more info.AppCmd fulfills basically the same role, but without requiring powershell. You can use either for most tasks. I prefer Powershell with the IIS module though, as the scripts are much easier to read, and the PSDrive makes it possible to do a lot of checks that are not easy to do with AppCmd (for instance, check weather a WebSite exists before creating it, in setup scripts)