DSC resource run once

This topic contains 2 replies, has 2 voices, and was last updated by  Bjørn Roalkvam 1 year, 10 months ago.

  • Author
  • #52668

    Bjørn Roalkvam

    Hi Using Server 2012R2 with WMF 5.

    The LCM settings set to ApplyandAutocorrect and pull mode.

    Is it possible to make sure a dscresource runs 1 time only. Even though the mof file reruns after restart to finish all configuration?

    The custom resource I am talking about runs the SharePoint configuration Wizard (psconfig), which upgrades databases after installing specific SharePoint updates. I want each node to run psconfig once after joining the SharePoint farm.
    Simply put I want the psconfig resource to run only if the joinfarm resource runs 'Set', which it will only do once, to join the farm.

    I guess I could modify the xsharepoint joining resource to also run psconfig, but I'd rather not mess with Github resources that work great already.

    Can I use the ApplyandMonitor setting in the LCM? Will this make the node finish its mof before monitoring? Though if this works, the problem is still that a change in the configuration and rerun of the mof will launch the psconfig again which I dont want.

    Any suggestions or other steps to make this happen?



  • #52686

    Ryan Bartram

    there is no way within dsc to say run this once. The proper way to do this would be to build a db schema check into the test function of the psconfig resource you wrote and when the schema is already on the correct version then return true.

  • #52731

    Bjørn Roalkvam

    Hi Ryan,
    Sounds like a good idea. Ill look into it.



You must be logged in to reply to this topic.