Ideas on forcing users to update a module, what are your thoughts?

I updated my module and instructed my team on how to install the update (I use a network DFS share as my repo), but I want a more aggressive method of updating their modules. I would like to get your thoughts on how you do this in your environment.

My thoughts are:

  1. Add an update Function to the PSM1 that outputs a message to the screen each time the module loads. At least they will be aware of the update and then can update themselves, however, if they don’t reload the module they might not notice the message.

  2. Add an update Function to the Begin and possibly the End blocks of each Public function that outputs a “need to update” message. The users will see the nag message everytime they run a function.

  3. Add a function to the Begin block to Return if it is not the latest version. This would force them to update or they don’t get to use the function. I’m not sure how I feel about this one, but it would be the most aggressive.

  4. Instruct the team to set up a Profile with a function to check the version, but I don’t like this method as I would have to figure out a way to make them use a profile and support it as well as the module.

Thank you for your thoughts!

Maybe a combination. Create a function to check the module version against the repository that does a Write-Warning if there is a newer version. You could also have it check for a flag file (ForceUpdate.txt) and if it sees that to force the update if there is a critical bug without the new code, then it would automatically perform the update. Then you would call that function during module load and begin blocks in other functions. Most of my modules are talking to APIs, so I have a proxy Invoke-WebRequest typically that is used for all calls to put the check in.

So the flag file would reside in the repo directory? If the module sees the flag, it can be more aggressive otherwise it would just nag the user? The modules are not installed under the local scope so an elevated console would be required, which makes self-updating impossible unless the user opens an elevated console.

I do like the idea of adding the check at the module load and begin blocks.

If that is the case, you could Write-Warning unless certain criteria is met (more than 1 version behind), otherwise do a Throw or Write-Error and kill the code until updated. You could attempt to use something like this to perform elevation:

Outside of that, you could setup a query with SCCM or inventory tool to see who has the module and do a push. This would be managing like anything else in the enterprise.