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
7330
+
it under the terms of the GNU General Public License as published by
7331
+
the Free Software Foundation, either version 3 of the License, or
7332
+
(at your option) any later version.
7333
+
This program is distributed in the hope that it will be useful,
7334
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
7335
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7336
+
GNU General Public License for more details.
7337
+
You should have received a copy of the GNU General Public License
7338
+
along with this program. If not, see <https://www.gnu.org/licenses/>.
7339
+
#>
7340
+
#
7341
+
#
7342
+
FunctionUninstall-RSModule {
7343
+
<#
7344
+
.SYNOPSIS
7345
+
Uninstall older versions of your modules in a easy way.
7346
+
7347
+
.DESCRIPTION
7348
+
This script let users uninstall older versions of the modules that are installed on the system.
7349
+
7350
+
.PARAMETERModule
7351
+
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
7352
+
7353
+
.EXAMPLE
7354
+
Uninstall-RSModule -Module "VMWare.PowerCLI"
7355
+
# This will uninstall all older versions of the module VMWare.PowerCLI system.
Write-Output"Version $($Version) of $($m) are now uninstalled!"
7420
+
}
7421
+
catch {
7422
+
Write-Error"$($PSItem.Exception)"
7423
+
continue
7424
+
}
7425
+
}
7426
+
# bygga in en check så att den verkligen kan verifiera detta
7427
+
Write-Output"All older versions of $($m) are now uninstalled, the only installed version of $($m) is $($MostRecentVersion)"
7428
+
}
7429
+
else {
7430
+
Write-Verbose"$($m) don't have any older versions installed then $($GetAllInstalledVersions), no need to uninstall anything."
7431
+
}
7432
+
}
7433
+
Write-Output"`n---/// Script Finished! ///---"
7434
+
}
7435
+
FunctionUpdate-RSModule {
7436
+
<#
7437
+
.SYNOPSIS
7438
+
This module let you maintain your installed modules in a easy way.
7439
+
7440
+
.DESCRIPTION
7441
+
This function let you update all of your installed modules and also uninstall the old versions to keep things clean.
7442
+
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.
7443
+
7444
+
.PARAMETERModule
7445
+
Specify the module or modules that you want to update, if you don't specify any module all installed modules are updated
7446
+
7447
+
.PARAMETERScope
7448
+
Need to specify scope of the installation/update for the module, either AllUsers or CurrentUser. Default is CurrentUser.
7449
+
If this parameter is empty it will use CurrentUser
7450
+
The parameter -Scope don't effect the uninstall-module function this is because of limitation from Microsoft.
7451
+
- Scope effect Install/update module function.
7452
+
7453
+
.PARAMETERImportModule
7454
+
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.
7455
+
This only works if you have specified modules in the Module parameter
7456
+
7457
+
.PARAMETERUninstallOldVersion
7458
+
If this switch are used all of the old versions of your modules will get uninstalled and only the current version will be installed
7459
+
7460
+
.PARAMETERInstallMissing
7461
+
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")]
7494
+
[string]$Module,
7495
+
[ValidateSet("CurrentUser","AllUsers")]
7496
+
[Parameter(Mandatory=$false,HelpMessage="Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
7497
+
[string]$Scope="CurrentUser",
7498
+
[Parameter(Mandatory=$false,HelpMessage="Import modules that has been entered in the module parameter at the end of this function")]
7499
+
[switch]$ImportModule=$false,
7500
+
[Parameter(Mandatory=$false,HelpMessage="Uninstalls all old versions of the modules")]
7501
+
[switch]$UninstallOldVersion=$false,
7502
+
[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