How to create file on UNC share with DSC?

Welcome Forums DSC (Desired State Configuration) How to create file on UNC share with DSC?

Viewing 3 reply threads
  • Author
    Posts
    • #170521
      Participant
      Topics: 12
      Replies: 38
      Points: 261
      Helping Hand
      Rank: Contributor

      I’m trying to write up a small DSC PoC (vs Ansible), and as part of that, I want to show that DSC can create files on a share.
      I can happily create files locally, but not remotely. (This question follows on from a previous question about copying from a UNC path)
      This is my code Configuration Data:

      The Configuration:

      Then I run:

      Which outputs my MOF.

      I then get this When running the DSC Configuration:

      I am entirely stumped, and nothing relevant comes up when I try to google this

      Any ideas what I am doing wrong?
      I can copy from the share fine, and using New-Item from a console is fine too…

    • #170557
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,781
      Helping Hand
      Rank: Community Hero

      hmmm, never tried creating a file in a network share with credential.

      just for testing, can you add code for mapping that network share using a script resource. Use DependsOn property for File resource to script resource to make sure file resource executes only after script resource.

    • #170566
      Participant
      Topics: 12
      Replies: 38
      Points: 261
      Helping Hand
      Rank: Contributor

      hmmm, never tried creating a file in a network share with credential.

      just for testing, can you add code for mapping that network share using a script resource. Use DependsOn property for File resource to script resource to make sure file resource executes only after script resource.

      Do you think I would have to map a drive to write to a UNC path? That seems a bit odd, no?
      I will try to find how to do that, thanks.

    • #170572
      Senior Moderator
      Topics: 9
      Replies: 1309
      Points: 4,781
      Helping Hand
      Rank: Community Hero

      no, that should not be the solution, but just to nail down the issue.

Viewing 3 reply threads
  • The topic ‘How to create file on UNC share with DSC?’ is closed to new replies.