Add Users to IIS using PSDSC

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Arie H Arie H 1 month, 1 week ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #50978
    Profile photo of TommyQuality
    TommyQuality
    Participant

    Hi,

    Im using PSDSC to build webservers, part of this build installs msdeploy and creates a local user. I need PSDSC to add this local user to the IIS Manager Permissions within IIS.

    Just can't find a way to do this. Any ideas?

    Thanks

    Tommy

    #50984
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Unfortunately, that functionality hasn't been added to a PowerShell cmdlet, which means it isn't easily doable in DSC. You'd need to code up the necessary command, and then create your own resource around it.

    #50987
    Profile photo of Arie H
    Arie H
    Participant

    In general, when you need certain action done that isn't found natively in the DSC resources, try finding
    a way to do that action in normal powershell and then try using the built-in Script DSC resource for this.

    Based on my search, this is something you can do:

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Management") 
    [Microsoft.Web.Management.Server.ManagementAuthentication]::CreateUser("MyUser", "ThePassword")
    [Microsoft.Web.Management.Server.ManagementAuthorization]::Grant("MyUser", "Default Web Site", $FALSE)

    so try doing that inside a Script resource
    https://msdn.microsoft.com/en-us/powershell/dsc/scriptresource

    • This reply was modified 1 month, 1 week ago by Profile photo of Arie H Arie H.
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.