Hello all!
What is the best approach to referencing and copying over files in a script resource? Does DSC actually store anything on the host that I can pull from? My development file structure looks like:
Git repo > DSCResources > MyResource > myConfiguration.psd1 > myConfiguration.psm1 > myFolderOfFiles > randomFile.txt
My script resource looks something like:
$dscWorkingFolder = $PSScriptRoot Script FooBar { SetScript = { $dscWorkingFolder = $using:dscWorkingFolder $pathToFile = "$($dscWorkingFolder)\myFolderOfFiles\randomFile.txt" ...use pathToFile variable... } }
The error I am getting is:
PowerShell DSC resource MSFT_ScriptResource failed to execute Set-TargetResource functionality with error message: Exception calling \"ReadAllText\" with \"1\" argument(s): \"Could not find a part of the path...
I visit the file path in the error message (without revealing personal info the path starts with "C:\Modules\User") and the Modules folder on the C drive doesn’t even exist! Any ideas?
Thanks in advance!