« Previous Next »

Thread: Use IIS 7 extension from script invoked in custom host

Last post 11-12-2008 11:19 PM by spencer205. 1 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (2 items)

Sort Posts:

  • 11-11-2008, 5:16 PM

    Use IIS 7 extension from script invoked in custom host

    Hi All,

    I've written a WCF service that hosts PowerShell in it.  When certain sys-admin-ie operations on the service are invoked, it calls a PowerShell script via this custom host.  This is done, so that sys admins can modify the PowerShell script without the Web service needing to be recompiled or redeployed.

    One of the sys-admin-ie things that the service needs to do is create some Web sites in IIS.  To this end, I was looking to use the IIS 7 PowerShell Provider.  However, using this tool requires that a special console file be invoked in order to make the extensions available.  Is there a way to do the same things that the PSC1 file is doing in C# on my custom host in the Web service, so that the cmdlets (e.g., New-WebSite) are available from within the script?

    TIA!

    --

    Regards,


    Travis Spencer
     

  • 11-12-2008, 11:19 PM In reply to

    Re: Use IIS 7 extension from script invoked in custom host

    Got it.It seems that running this from the script invoked by the service will do the trick:

    add-pssnapin IIsProviderSnapIn

    See http://forums.iis.net/p/1148874/1867336.aspx for more info.

     

Page 1 of 1 (2 items)
Microsoft Communities