Warning: This can be a pretty destructive way to do things. YMMV!
Code by Jack Fruh (https://sharepointjack.com).
write-host "this will remove all old versions of installed modules"
write-host "be sure to run this as an admin" -foregroundcolor yellow
write-host "(You can update all your Azure RM modules with update-module Azurerm -force)"