5 replies

Last post Apr 25, 2008 11:44 AM by sergeia

  • Microsoft.Web.Administration.ServerManager

    Apr 22, 2008 11:30 AM|Kanien|LINK

    I've looked all over and I can't find any example on how to delete a site in IIS using the Microsoft.Web.Administration.ServerManager.  Any suggestions on where to look for some guidance?


  • Re: Microsoft.Web.Administration.ServerManager

    Apr 22, 2008 11:57 AM|thomad|LINK

    ServerManager sm = new ServerManager();



    Hope this helps

    Thomas Deml
    Group Program Manager
    Internet Information Services
    Microsoft Corp.
  • Re: Microsoft.Web.Administration.ServerManager

    Apr 22, 2008 03:33 PM|marcoshaw|LINK

    Note: This is C# syntax in a PowerShell sub-forum... ;-)

    I'll try to find time to confirm the exact syntax in PowerShell (once I fire up an IIS7 VM), unless someone else beats me to it. 

  • Re: Microsoft.Web.Administration.ServerManager

    Apr 23, 2008 01:29 PM|sergeia|LINK

    I don't advise to use Microsoft.Web.Administration classes returned from the provider, we could drop this dependence in future. If you want to use this namespace in Powershell, you have to program it without dependency on provider.

    $sm = new-object Microsoft.Web.Administration.ServerManager


  • Re: Microsoft.Web.Administration.ServerManager

    Apr 23, 2008 01:56 PM|Kanien|LINK

    Thanks for the assistance sergeia.

     I was using this to provision accounts, however this was before the IIS provider for PS came out.  Are you saying that I should not use this class?

  • Re: Microsoft.Web.Administration.ServerManager

    Apr 25, 2008 11:44 AM|sergeia|LINK

    No, you could use it any way you want. But don't rely on objects, returned from IIS provider always being types from Microsoft.Web.Administration. I wasn't clear enough about it in my previous remark. Currently, if you run get-item "iis:\sites\default web site" | gm, you will see, that returned object is Microsoft.Web.Administration.ConfigurationElement and theoretically you could use it in the script that expects this type.

    But in the future those objects will not be from Microsoft.Web.Administration.