RichS wrote:
Quote:
> 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
> Any particular reason you *must* do this with WMI? Using the v2
remoting, you could just use appcmd.exe.
I am trying it out though. No luck so far either here, but I've thought
of a few things since last night, but I've not time to try them until
tomorrow evening or so.
--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp
PowerGadgets MVP
http://www.powergadgets.com/mvp
Blog:
http://marcoshaw.blogspot.com