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

Welcome Forums General PowerShell Q&A Ideas on forcing users to update a module, what are your thoughts?

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

 
Participant
3 months, 3 weeks ago.

  • Author
    Posts
  • #105181

    Participant
    Points: 22
    Rank: Member

    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!

  • #105188

    Participant
    Points: 160
    Helping Hand
    Rank: Participant

    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.

  • #105193

    Participant
    Points: 22
    Rank: Member

    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.

  • #105197

    Participant
    Points: 160
    Helping Hand
    Rank: Participant

    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:

    https://gallery.technet.microsoft.com/scriptcenter/63fd1c0d-da57-4fb4-9645-ea52fc4f1dfb

    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.

The topic ‘Ideas on forcing users to update a module, what are your thoughts?’ is closed to new replies.