You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This program is free software: you can redistribute it and/or modify
6050
+
it under the terms of the GNU General Public License as published by
6051
+
the Free Software Foundation, either version 3 of the License, or
6052
+
(at your option) any later version.
6053
+
This program is distributed in the hope that it will be useful,
6054
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
6055
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6056
+
GNU General Public License for more details.
6057
+
You should have received a copy of the GNU General Public License
6058
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
6059
+
#>
6060
+
#
6061
+
#
6062
+
FunctionUninstall-RSModule {
6063
+
<#
6064
+
.SYNOPSIS
6065
+
Uninstall older versions of your modules in a easy way.
6066
+
6067
+
.DESCRIPTION
6068
+
This script let users uninstall older versions of the modules that are installed on the system.
6069
+
6070
+
.PARAMETERModule
6071
+
Specify modules that you want to uninstall older versions from, if this is left empty all of the older versions of the systems modules will be uninstalled
6072
+
6073
+
.EXAMPLE
6074
+
Uninstall-RSModule -Module "VMWare.PowerCLI"
6075
+
# This will uninstall all older versions of the module VMWare.PowerCLI system.
Write-Output"Version $($Version) of $($m) are now uninstalled!"
6140
+
}
6141
+
catch {
6142
+
Write-Error"$($PSItem.Exception)"
6143
+
continue
6144
+
}
6145
+
}
6146
+
# bygga in en check så att den verkligen kan verifiera detta
6147
+
Write-Output"All older versions of $($m) are now uninstalled, the only installed version of $($m) is $($MostRecentVersion)"
6148
+
}
6149
+
else {
6150
+
Write-Verbose"$($m) don't have any older versions installed then $($GetAllInstalledVersions), no need to uninstall anything."
6151
+
}
6152
+
}
6153
+
Write-Output"`n---/// Script Finished! ///---"
6154
+
}
6155
+
FunctionUpdate-RSModule {
6156
+
<#
6157
+
.SYNOPSIS
6158
+
This module let you maintain your installed modules in a easy way.
6159
+
6160
+
.DESCRIPTION
6161
+
This function let you update all of your installed modules and also uninstall the old versions to keep things clean.
6162
+
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.
6163
+
6164
+
.PARAMETERModule
6165
+
Specify the module or modules that you want to update, if you don't specify any module all installed modules are updated
6166
+
6167
+
.PARAMETERScope
6168
+
Need to specify scope of the installation/update for the module, either AllUsers or CurrentUser. Default is CurrentUser.
6169
+
If this parameter is empty it will use CurrentUser
6170
+
The parameter -Scope don't effect the uninstall-module function this is because of limitation from Microsoft.
6171
+
- Scope effect Install/update module function.
6172
+
6173
+
.PARAMETERImportModule
6174
+
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.
6175
+
This only works if you have specified modules in the Module parameter
6176
+
6177
+
.PARAMETERUninstallOldVersion
6178
+
If this switch are used all of the old versions of your modules will get uninstalled and only the current version will be installed
6179
+
6180
+
.PARAMETERInstallMissing
6181
+
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.
# 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.
# 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.
[Parameter(Mandatory=$false,HelpMessage="Enter module or modules (separated with ,) that you want to update, if you don't enter any all of the modules will be updated")]
6214
+
[string]$Module,
6215
+
[ValidateSet("CurrentUser","AllUsers")]
6216
+
[Parameter(Mandatory=$false,HelpMessage="Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
6217
+
[string]$Scope="CurrentUser",
6218
+
[Parameter(Mandatory=$false,HelpMessage="Import modules that has been entered in the module parameter at the end of this function")]
6219
+
[switch]$ImportModule=$false,
6220
+
[Parameter(Mandatory=$false,HelpMessage="Uninstalls all old versions of the modules")]
6221
+
[switch]$UninstallOldVersion=$false,
6222
+
[Parameter(Mandatory=$false,HelpMessage="Install all of the modules that has been entered in module that are not installed on the system")]
0 commit comments