We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Re: Microsoft.Web.Administration Get a unique persitent key per siteRSS

1 reply

Last post Aug 09, 2017 05:54 AM by Yuk Ding

  • Re: Microsoft.Web.Administration Get a unique persitent key per site

    Aug 08, 2017 09:06 AM|Paul Lynch|LINK

    Hi,

    I can't comment on this thread (https://forums.iis.net/post/2126963.aspx) as it's already closed but I wanted to add that you *can* in fact set your own custom site ID in IIS using the following :

    $SiteName = "SITENAME"
    $iisSite = "IIS:\Sites\" + $SiteName
    $website = get-item $iisSite
    Stop-WebSite -Name $SiteName
    $website.id = 54321
    $website | set-item
    Start-WebSite -Name $SiteName

    Regards,

    Paul Lynch
    MCSE
  • Re: Microsoft.Web.Administration Get a unique persitent key per site

    Aug 09, 2017 05:54 AM|Yuk Ding|LINK

    Hi Paul,

    Of course, we could set the custom site ID. In fact, the command could be more simple:

    Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST'  -filter "system.applicationHost/sites/site[@name='TestSite5']" -name "id" -value 8
    

    Best Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.