This is not the most obvious process, but here's what worked for me.
$AppPoolSettings = [wmiclass]'root\MicrosoftIISv2:IISApplicationPoolSetting' $NewPool = $AppPoolSettings.CreateInstance() $NewPool.Name = 'W3SVC/AppPools/MyAppPool' $Result = $NewPool.Put()
You may get an error with a call to the Put () method, but calling it the second (or third) time should make it work. This is due to a problem with PowerShell V1 and WMI.
Steven murawski
source share