Trying to push DSC I'm hitting the following error:
Failure to get a valid result from the execution of TestScript. The Test script should return True or False.
Here's the TestScript:
return (Test-Path -Path "FullPath:\To\File")
A couple things I've tried:
- The Script resource has a (unmanaged) service account's credentials specified in the Credential parameter. Thinking it might not have permissions to the directory, causing Test-Path to error, I launched powershell as the user on the target machine and ran the cmdlet. It returned False (as expected). I've since made sure that the configuration gives the account permissions to the folder anyways.
- Thinking it might be some weird idiosyncrasy with returning the cmdlet, I tried assigning the cmdlet to a variable and returning that. No dice.
Any ideas would be appreciated.
Edit: Here's the full resource, for those curious. It's basically just a couple quick lines to pull a script out of source control and place it locally so that I can create a scheduled task to run said script. Casting the result to a bool didn't work (same error). I'm wondering if it's even getting inside the TestScript at this point...checking get-executionpolicy shows it as undefined for the account but at the userpolicy, machinepolicy and localmachine level they're all bypass.
Script NameOfScript {
DependsOn = "[cNtfsPermissionEntry]DirectoryPermissions"
Credential = $serviceAccountPSCredentialObject
SetScript = {
Import-Module -Name Subversion
New-SvnWorkingCopy -Url "https://svnrepourl/script.ps1" -Path "E:\Scripts\"
}
TestScript = {
[bool]$result
$result = Test-Path -Path "E:\Scripts\script.ps1" -ErrorAction Stop
return $result
}
GetScript = { }
}