Skip to content

Powershell module to check and install module updates

Notifications You must be signed in to change notification settings

yubu/ps.checkModuleUpdates

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

ps.checkModuleUpdates

Powershell module to check and install module updates. Will also create scheduled task which will run weekly and send toast notification with list of outdated modules.

Default scopes

  • For Windows Powershell: AllUsers
  • For Powershell Core: CurrentUser
  • It could be changed by -Scope and/or -ScopeCore parameters

Installation from Github

cd $env:Userprofile\Documents\WindowsPowerShell\Modules\
git clone https://github.com/yubu/ps.checkModuleUpdates.git
Import-Module ps.checkModuleUpdates

or

cd c:\temp
git clone https://github.com/yubu/ps.checkModuleUpdates.git
Import-Module c:\temp\ps.checkModuleUpdates\ps.checkModuleUpdates.psm1

Installation from PowerShell Gallery

Install-Module ps.checkModuleUpdates

Getting Started

Use powershell help to get commands and examples
gcm -module ps.checkModuleUpdates
help -ex Check-ModuleUpdates
Examples
Check-ModuleUpdates -all -sendToast
Check-ModuleUpdates -all -sendToast -allowPrerelease -skipUpdate "posh-git|ps.checkModuleUpdates"
Check-ModuleUpdates "posh-git|ps.checkModuleUpdates" -sendToast -allowPrerelease
Check-ModuleUpdates -createSchedTask
Check-ModuleUpdates -createSchedTaskWithTranscript

cmu "posh-git|ps.checkModuleUpdates" -update -allowPrerelease -skipScan
"posh-git|ps.checkModuleUpdates" | cmu -allowPrerelease -update -skipScan
Will install/update modules right away with no scanning their installed versions

cmu -compressTranscriptDir 
Will save the space by set the compression attribute to log/transcript directory ($env:USERPROFILE\.ps.checkModuleUpdate)
Scheduled task
cmu -createSchedTask
Will create scheduled task to run the script every Friday at 5am. SchedTask will be created for powershell edition, the command was ran from

cmu -createSchedTaskWithTranscript
Will create scheduled task with transcript enabled

cmu -getLastUpdateCommand | iex
Retrieve and execute the update command from the transcript file of latest scheduled task run

When scheduled task is created, it will send the toast notification with list of outdated modules. This notification will disappear after few seconds. To make it's appearance permanent in the action center (WinKey+A) you'll need to do the following:

  1. Go to Settings (WinKey+I)
  2. In the search field ("Find a setting") type "notification"
  3. Select "Notifications & actions"
  4. Scroll down to the section "Get notification from these senders"
  5. Find Windows Powershell and/or Powershell 6 (x64)
  6. Click on it and enable "Notifications" and "Show notification in action center"

The toast notification will stay in the action center (WinKey+A) until it will be manually dismissed

Then you can run the update command on modules of your choice:

cmu -allowPrerelease -all -update "module1|module2|module3"
cmu -getLastUpdateCommand | iex
Delete multiple old module versions
.Example
    cmu "aws|psreadline" -getModuleAllVersions | ? count -gt 1
    Get-InstalledModule AWSPowerShell -AllVersions | ? version -notmatch "version1|version2" | Uninstall-Module -force -AllowPrerelease
    Get the list of all installed module versions and then uninstall the older ones except two latest versions
.Example
    Start-ThreadJob {Get-InstalledModule VMware.VimAutomation.Srm -AllVersions  | ? version -NotMatch 1.5.0.14899557 | Uninstall-Module -force}
    Get-Job | Receive-Job -Keep
    Remove old module versions and then check job results

About

Powershell module to check and install module updates

Resources

Stars

Watchers

Forks

Packages

No packages published