This topic contains 5 replies, has 3 voices, and was last updated by
April 12, 2016 at 3:29 pm #37608
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
April 12, 2016 at 3:57 pm #37610ParticipantPoints: 0Rank: 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.
April 12, 2016 at 3:59 pm #37611KeymasterPoints: 1,785Rank: 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.
April 12, 2016 at 4:08 pm #37613
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.
April 12, 2016 at 4:35 pm #37614
I created a scheduled task running as SYSTEM that ran the .exe with the command line options. It created the service without issue.
April 13, 2016 at 7:35 am #37671
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.