|
| 1 | + |
| 2 | +NAME |
| 3 | + Update-RSModule |
| 4 | + |
| 5 | +SYNOPSIS |
| 6 | + This module let you maintain your installed modules in a easy way. |
| 7 | + |
| 8 | + |
| 9 | +SYNTAX |
| 10 | + Update-RSModule [[-Module] <String[]>] [[-Scope] <String>] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>] |
| 11 | + |
| 12 | + |
| 13 | +DESCRIPTION |
| 14 | + This function let you update all of your installed modules and also uninstall the old versions to keep things clean. |
| 15 | + You can also specify module or modules that you want to update. It's also possible to install the module if it's missing and import the modules in the end of the script. |
| 16 | + |
| 17 | + |
| 18 | +PARAMETERS |
| 19 | + -Module <String[]> |
| 20 | + Specify the module or modules that you want to update, if you don't specify any module all installed modules are updated |
| 21 | + |
| 22 | + Required? false |
| 23 | + Position? 1 |
| 24 | + Default value |
| 25 | + Accept pipeline input? false |
| 26 | + Accept wildcard characters? false |
| 27 | + |
| 28 | + -Scope <String> |
| 29 | + Need to specify scope of the installation/update for the module, either AllUsers or CurrentUser. Default is CurrentUser. |
| 30 | + If this parameter is empty it will use CurrentUser |
| 31 | + The parameter -Scope don't effect the uninstall-module function this is because of limitation from Microsoft. |
| 32 | + - Scope effect Install/update module function. |
| 33 | + |
| 34 | + Required? false |
| 35 | + Position? 2 |
| 36 | + Default value CurrentUser |
| 37 | + Accept pipeline input? false |
| 38 | + Accept wildcard characters? false |
| 39 | + |
| 40 | + -ImportModule [<SwitchParameter>] |
| 41 | + If this switch are used the module will import all the modules that are specified in the Module parameter at the end of the script. |
| 42 | + This only works if you have specified modules in the Module parameter |
| 43 | + |
| 44 | + Required? false |
| 45 | + Position? named |
| 46 | + Default value False |
| 47 | + Accept pipeline input? false |
| 48 | + Accept wildcard characters? false |
| 49 | + |
| 50 | + -UninstallOldVersion [<SwitchParameter>] |
| 51 | + If this switch are used all of the old versions of your modules will get uninstalled and only the current version will be installed |
| 52 | + |
| 53 | + Required? false |
| 54 | + Position? named |
| 55 | + Default value False |
| 56 | + Accept pipeline input? false |
| 57 | + Accept wildcard characters? false |
| 58 | + |
| 59 | + -InstallMissing [<SwitchParameter>] |
| 60 | + If you use this switch and the modules that are specified in the Module parameter are not installed on the system they will be installed. |
| 61 | + |
| 62 | + Required? false |
| 63 | + Position? named |
| 64 | + Default value False |
| 65 | + Accept pipeline input? false |
| 66 | + Accept wildcard characters? false |
| 67 | + |
| 68 | + -WhatIf [<SwitchParameter>] |
| 69 | + |
| 70 | + Required? false |
| 71 | + Position? named |
| 72 | + Default value |
| 73 | + Accept pipeline input? false |
| 74 | + Accept wildcard characters? false |
| 75 | + |
| 76 | + -Confirm [<SwitchParameter>] |
| 77 | + |
| 78 | + Required? false |
| 79 | + Position? named |
| 80 | + Default value |
| 81 | + Accept pipeline input? false |
| 82 | + Accept wildcard characters? false |
| 83 | + |
| 84 | + <CommonParameters> |
| 85 | + This cmdlet supports the common parameters: Verbose, Debug, |
| 86 | + ErrorAction, ErrorVariable, WarningAction, WarningVariable, |
| 87 | + OutBuffer, PipelineVariable, and OutVariable. For more information, see |
| 88 | + about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216). |
| 89 | + |
| 90 | +INPUTS |
| 91 | + |
| 92 | +OUTPUTS |
| 93 | + |
| 94 | +NOTES |
| 95 | + |
| 96 | + |
| 97 | + Author: Robin Stolpe |
| 98 | + Mail: robin@stolpe.io |
| 99 | + Twitter: https://twitter.com/rstolpes |
| 100 | + Linkedin: https://www.linkedin.com/in/rstolpe/ |
| 101 | + Website/Blog: https://stolpe.io |
| 102 | + GitHub: https://github.com/rstolpe |
| 103 | + PSGallery: https://www.powershellgallery.com/profiles/rstolpe |
| 104 | + |
| 105 | + -------------------------- EXAMPLE 1 -------------------------- |
| 106 | + |
| 107 | + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser |
| 108 | + # This will update the modules PowerCLI, ImportExcel for the current user |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + -------------------------- EXAMPLE 2 -------------------------- |
| 116 | + |
| 117 | + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion |
| 118 | + # This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel. |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + -------------------------- EXAMPLE 3 -------------------------- |
| 126 | + |
| 127 | + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing |
| 128 | + # This will install the modules PowerCLI and/or ImportExcel on the system if they are missing, if the modules are installed already they will only get updated. |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + -------------------------- EXAMPLE 4 -------------------------- |
| 136 | + |
| 137 | + PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule |
| 138 | + # This will update the modules PowerCLI and ImportExcel and delete all of the old versions that are installed of PowerCLI and ImportExcel and then import the modules. |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | +RELATED LINKS |
| 147 | + https://github.com/rstolpe/MaintainModule/blob/main/README.md |
| 148 | + |
| 149 | + |
0 commit comments