Script Resources aren't running...

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Henrik Hudson Henrik Hudson 5 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37608
    Profile photo of Henrik Hudson
    Henrik Hudson
    Participant

    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
    Profile photo of Nitin Gupta
    Nitin Gupta
    Participant

    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 (https://blogs.msdn.microsoft.com/powershell/2014/02/11/dsc-diagnostics-module-analyze-dsc-logs-instantly-now/) to get the logs.

    #37611
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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
    Profile photo of Henrik Hudson
    Henrik Hudson
    Participant

    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
    Profile photo of Henrik Hudson
    Henrik Hudson
    Participant

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

    #37671
    Profile photo of Henrik Hudson
    Henrik Hudson
    Participant

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

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.