Script Resources aren't running...

This topic contains 5 replies, has 3 voices, and was last updated by  Henrik Hudson 2 years, 1 month ago.

  • Author
  • #37608

    Henrik Hudson

    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 🙂

    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

  • #37610

    Nitin Gupta

    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 ( to get the logs.

  • #37611

    Don Jones

    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.

  • #37613

    Henrik Hudson

    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.

  • #37614

    Henrik Hudson

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

  • #37671

    Henrik Hudson

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

You must be logged in to reply to this topic.