How do I create a credential parameter for a custom PowerShell 5 DSC-Resource

This topic contains 1 reply, has 1 voice, and was last updated by  Bjørn Roalkvam 1 year, 11 months ago.

  • Author
  • #41995

    Bjørn Roalkvam

    Background: I have written 8-10 custom PowerShell class 5 Dsc Resources up to now. Mostly checking configurations in sql and SharePoint and installation of SharePoint prerequisites (without the prerequisiteinstaller.exe :-))

    I now want to create a Installation DSCresource that finds its binary-files on a network share. To do this I will need a "Credential" parameter that is used to access the network share. How would I go about defining this parameter in my DSCresource?

    I'm thinking i can create a normal parameter of type PSCredential, then somehow make my DSCresource use this credential to access the share..
    Any tips or pointers are welcome!



  • #42002

    Bjørn Roalkvam

    I noticed that i could probably use the :
    New-PSDrive -Name P -PSProvider FileSystem -Root \\Server01\Public -Credential user\domain -Persist

    It always helps shouting it out loud :f



You must be logged in to reply to this topic.