I have been investigating using PowerShell to administer IIS 7. Using the
Microsoft.Web.Administration namespace I have sucessfully created and deleted
sites, applications and applicationpools - see recent posts on my blog for
details.
This code also works very nicely through the remoting features of PowerShell
V2. Hurrah we're 2 for 2
Now comes the problem - IIS 7 also exposes a WMI provider
I have managed to do a certain amount through WMI and PowerShell
$site = Get-WmiObject -Namespace "root\webadministration" -Class Site
-Filter "Name = 'WTest1'"
$site | Set-WmiInstance -Argument @{ServerAutoStart = "False"}
$site.Stop()
$site.Start()
$site.psbase.Delete()
Such as changing properties of the site stoppping & starting & deleting
sites. The one point where I have hit a wall is creating a site using WMI.
I have found a reference to doing it with VBScript
http://www.iis.net/articles/view.asp...s-WMI-Provider
but I cannot duplicate this in PowerShell. I am open to suggestions (within
resaon ;-) ) and would be extremely grateful if someone can point out what I
am missing
--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog:
http://richardsiddaway.spaces.live.com/
PowerShell User Group:
http://www.get-psuguk.org.uk