2

I am about to have a nervous breakdown as I've been researching and trying solution after solution for a long time now, so I hope someone here can help me..

For continuous deployment I use Powershell (5.1) Desired State Configuration (DSC) to perform various actions during deployment. I fetch an archive from an internal server and extract it's contents to a network share. All is fine. I can copy/write there perfectly, using an SA account with the required permissions for the PsDscRunAsCredential. I also try to make a start-file (BAT-script) with the File Resource.

No matter what I try (double and triple checking the permissions for the SA account, giving the Computer-account permissions on the network folder, double passing the SA account as Credential on top of the PsDscRunAsCredential, etc.) I always get a "Permission denied" error when trying to create the file. If I try to explicitly create a folder in the same way I also get an Access Denied error, even though with the Extract/copy that folder is created without problems.

I think it has to do with the way the File Resource creates new items, up to the point that I might think there's a bug in it. I've also looked for the source of the File Resource, but haven't been able to find it anywhere, including the PsDscConfiguration-module on my PC.

    File LaunchScript
    {
        PsDscRunAsCredential   = $DeployCredential;
        Credential             = $DeployCredential;
        DestinationPath        = $launchScript
        Ensure                 = 'Present'
        Type                   = 'File'
        Contents               = $scriptContents
        DependsOn              = '[File]VersionFolder'
    }

Thanks in advance!

Devvox93
  • 166
  • 1
  • 3
  • 14
  • In my testing, this worked with `Credential`, `PsDscRunAsCredential`, and both (note my testing was with `Invoke-DscResource`). I'm not sure why you would need both though. Have you tried this with different credentials? Have If it's a domain account, did you specify the domain (`Domain\User`) in your `$DeployCredential`'s `UserName`? What's the actual, specific error? – briantist Nov 24 '17 at 21:40
  • Yes, I did. Copying using the same credentials works fine. Account is specified with domain. The error is "Permission denied" when creating a file and "Access denied: operating system error 5" when creating a directory. – Devvox93 Nov 26 '17 at 01:01
  • Used a workaround now of creating the file in a temp folder and use RoboCopy to copy the file to the final destination (the share). That works, but like I said, it's a workaround and not a solution. – Devvox93 Nov 27 '17 at 17:50

0 Answers0