PowerTip: Use PowerShell to Install Modules on Your System

Summary: Learn how to use Windows PowerShell to install modules on your system.

Hey, Scripting Guy! Question How can I use Windows PowerShell to roll out a new set of modules that are used extensively in my organization?

Hey, Scripting Guy! Answer When Windows PowerShell 5.0 is available, you can use PowerShellGet against an internal repository
           to install your modules.

  For systems running Windows PowerShell 4.0 or earlier, create a central repository of modules on a network share
  and use a scheduled task to check for updated modules. Then copy any new or updated modules to your system.

Comments (1)

  1. TheGhost82 says:

    Nice one, I do this for my own modules a little different: I have a folder in my dropbox where I keep the modules and create a PSDrive in my profile called "PSScripts" that points to the dropbox folder, I also wrote an update function to update the modules:

    Function Update-Module {
    Write-Host "Updating Modules…" -ForegroundColor Yellow
    Copy-Item PSScripts:Modules* $path -Recurse -Force
    Write-Host "Reloading Modules…" -ForegroundColor Yellow
    Get-Module -ListAvailable | Import-Module -Force -ErrorAction SilentlyContinue

    I can now manually update the modules or even schedule it if I want. I use Dropbox on all of the machines I work on so this makes it easy for me to always have the up-to-date version with me, no matter where I go!

Skip to main content