Script Resources aren't running...

I’ve create a DSC MOF to install Zabbix Agent and I get the files and a config to move via 2 File resources, but to install it as a service requires running the EXE itself. The commands work fine when running at a PS prompt on the server, but nothing seems to happen via DSC. Also, I created a Script resource to delete a file. This also doesn’t seem to work, but works fine when running manually. I did remember to remove the file from my File source location as well :slight_smile:

The File resource doesn’t seem to delete files that no longer exist in the source, but still exist in the destination, correct?

Any ideas why these Script resources don’t seem to run? Test-DSCConfiguration doesn’t seem to show any issues. Update-DSCConfiguration works and pulls the new MOF as far as I can tell. Start-DSCConfiguration -UseExisting seems to work as well.

note: I’m using this via a LCM Pull server and using ConfigurationNames

Script resource is not deleting file because TestScript is returning true, hence SetScript was never called. For installation of zabbix, check if your SetScript is Getting executed by looking into the DSC logs for this operation. You can use xDScDiagnostics (DSC Diagnostics Module– Analyze DSC Logs instantly now! - PowerShell Team) to get the logs.

It’s possible the delete is failing because the EXE is running, or because the LCM is somehow being denied permission. You’re not catching/logging any errors from Remove-Item, so it’s tough to tell.

In terms of the installer, try running it as an unattended scheduled task. It’s possible the installer is attempting to access something in a user profile, or some other component that doesn’t exist when the LCM runs. SchTasks runs similarly, so it’s a good troubleshooting step.

Dogh. Thanks Nitin. I even looked at that specifically, but just brain farted over it.

Don; I will give a scheduled task a shot. thanks.

I created a scheduled task running as SYSTEM that ran the .exe with the command line options. It created the service without issue.

Dogh #2. The agent install was also a True / False switcharoo. Thanks for your pointers everyone.