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

  • Question

  • User1632528892 posted


    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


    Tuesday, August 8, 2017 9:06 AM

All replies

  • User-460007017 posted

    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

    Wednesday, August 9, 2017 5:54 AM