Thread: WMI in IIS 6.0
View Single Post
Old 10-02-2007   #6 (permalink)
Oisin Grehan


 
 

Re: WMI in IIS 6.0

On Oct 2, 10:25 am, Marco Shaw <marco.shaw@_NO_SPAM_gmail.com> wrote:
Quote:

> NJC wrote:
Quote:

> > Hello,
>
Quote:

> > I am trying to create a new website on IIS 6.0. I have successfully
> > completed this task using VBScript, but I'm struggling converting the code
> > into Powershell, because I am newbie to WMI and fairly new to Powershell. My
> > VBScript code is as follows:
>
> Seems to apply:http://www.vistax64.com/powershell/3...ing-iis-wmi-me...
>
> Marco
>
> --
> ----------------
> PowerGadgets MVPhttp://www.powergadgets.com/mvp
>
> Blog:http://marcoshaw.blogspot.com
It might be worth adding that if you have converted some scripts
already and don't feel like changing the whole thing, you can quickly
get a powershell "adapted" version using the [wmi] accelerator against
the path, e.g.
Quote:

> ...
> $serviceObj = $providerObj.Get("IIsWebService='W3SVC'")
# get adaptedr version
Quote:

> $so = [wmi]$serviceObj.Path_.path
> $so | get-member
TypeName: System.Management.ManagementObj...

Name MemberType Definiti
---- ---------- --------
AddDependency Method System.M...
AddExtensionFile Method System.M...
Change Method System.M...
ChangeStartMode Method System.M...
Create Method System.M...
CreateNewSite Method System.M...
DeleteExtensionFileRecord Method System.M...

As you can see, the methods are now available in "direct" style
(without needing psbase it appears)?

- Oisin

My System SpecsSystem Spec