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!