presumably, psexec.exe is not found on the $env:PATH variable for the LocalSystem account (which is what DSC runs under).
However, all “psexec.exe -s” does is run something in the systme context anyway, so you can probably get away with just: & c:\TestBat.bat .
However, that’s going to run the batch file every time DSC applies its configuration, and I’m not sure that’s something I’d ever want to happen. Instead I’d be looking into converting whatever’s in that batch file over to PowerShell and DSC resources that can be set up individually.
I am running a bat file by powershell dsc as below. It was working fine few days back but suddenly it stopped working and throwing below error.
Please hellp me to get it resolve.
Error:
The PowerShell DSC resource MSFT_ScriptResource threw one or more non-terminating errors while running the
Set-TargetResource functionality. These errors are logged to the ETW channel called
Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
Job {31CFD051-F015-11E5-80DC-0050568F384F} :
This event indicates that a non-terminating error was thrown when DSCEngine was executing Set-TargetResource on MSFT_ScriptResource DSC resource. FullyQualifiedErrorId is NativeCommandError. ErrorMessage is ‘rmqservice’ is not recognized as an internal or external command,.