Script Resources aren't running...

Welcome Forums DSC (Desired State Configuration) Script Resources aren't running...

This topic contains 5 replies, has 3 voices, and was last updated by

 
Participant
2 years, 9 months ago.

  • Author
    Posts
  • #37608

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Keymaster
    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    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

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

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

  • #37671

    Participant
    Points: 0
    Rank: Member

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

The topic ‘Script Resources aren't running...’ is closed to new replies.