Skip to content

Commit 21941c8

Browse files
author
Robin Stolpe
authored
Merge pull request #24 from rstolpe/dev
changed parameter
2 parents 1044828 + 74896ee commit 21941c8

File tree

8 files changed

+40
-40
lines changed

8 files changed

+40
-40
lines changed

.src/Public/Function/Uninstall-RSModule.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# This will uninstall all older versions of the module VMWare.PowerCLI system.
1515
1616
.EXAMPLE
17-
Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel"
17+
Uninstall-RSModule -Module "VMWare.PowerCLI", "ImportExcel"
1818
# This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system.
1919
2020
.LINK
@@ -33,7 +33,7 @@
3333
[CmdletBinding(SupportsShouldProcess)]
3434
Param(
3535
[Parameter(Mandatory = $false, HelpMessage = "Enter the module or modules (separated with ,) you want to uninstall")]
36-
[string]$Module
36+
[string[]]$Module
3737
)
3838

3939
Write-Output "`n=== Starting to uninstall older versions of modules ===`n"
@@ -64,7 +64,7 @@
6464
}
6565
}
6666

67-
foreach ($m in $Module.Split()) {
67+
foreach ($m in $Module) {
6868
Write-Verbose "Collecting all installed version of the module $($m)"
6969
$GetAllInstalledVersions = Get-InstalledModule -Name $m -AllVersions | Sort-Object { $_.Version -as [version] } -Descending | Select-Object -ExpandProperty Version
7070

.src/Public/Function/Update-RSModule.ps1

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@
2727
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.
2828
2929
.EXAMPLE
30-
Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser
30+
Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser
3131
# This will update the modules PowerCLI, ImportExcel for the current user
3232
3333
.EXAMPLE
34-
Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion
34+
Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion
3535
# This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel.
3636
3737
.EXAMPLE
38-
Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing
38+
Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing
3939
# 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.
4040
4141
.EXAMPLE
42-
Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule
42+
Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule
4343
# 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.
4444
4545
.LINK
@@ -57,10 +57,10 @@
5757

5858
[CmdletBinding(SupportsShouldProcess)]
5959
Param(
60-
[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")]
61-
[string]$Module,
60+
[Parameter(Mandatory = $false, HelpMessage = "Enter module or modules that you want to update, if you don't enter any, all of the modules will be updated")]
61+
[string[]]$Module,
62+
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules, default is CurrentUser")]
6263
[ValidateSet("CurrentUser", "AllUsers")]
63-
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
6464
[string]$Scope = "CurrentUser",
6565
[Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")]
6666
[switch]$ImportModule = $false,
@@ -125,7 +125,7 @@
125125

126126

127127
# Start looping trough every module that are stored in the string Module
128-
foreach ($m in $Module.Split()) {
128+
foreach ($m in $Module) {
129129
Write-Verbose "Checks if $($m) are installed"
130130
if ($m -in $InstalledModules.Name) {
131131

@@ -188,7 +188,7 @@
188188

189189
# Import module if it's not imported
190190
Write-Verbose "Starting to import the modules..."
191-
foreach ($m in $Module.Split()) {
191+
foreach ($m in $Module) {
192192
if ($m -in $ImportedModules.Name) {
193193
Write-Verbose "$($m) are already imported!"
194194
}

MaintainModule/MaintainModule.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
RootModule = '.\MaintainModule.psm1'
3737

3838
# Version number of this module.
39-
ModuleVersion = '0.1.3'
39+
ModuleVersion = '0.1.4'
4040

4141
# Supported PSEditions
4242
# CompatiblePSEditions = @()

MaintainModule/MaintainModule.psm1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Function Uninstall-RSModule {
3737
# This will uninstall all older versions of the module VMWare.PowerCLI system.
3838
3939
.EXAMPLE
40-
Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel"
40+
Uninstall-RSModule -Module "VMWare.PowerCLI", "ImportExcel"
4141
# This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system.
4242
4343
.LINK
@@ -56,7 +56,7 @@ Function Uninstall-RSModule {
5656
[CmdletBinding(SupportsShouldProcess)]
5757
Param(
5858
[Parameter(Mandatory = $false, HelpMessage = "Enter the module or modules (separated with ,) you want to uninstall")]
59-
[string]$Module
59+
[string[]]$Module
6060
)
6161

6262
Write-Output "`n=== Starting to uninstall older versions of modules ===`n"
@@ -87,7 +87,7 @@ Function Uninstall-RSModule {
8787
}
8888
}
8989

90-
foreach ($m in $Module.Split()) {
90+
foreach ($m in $Module) {
9191
Write-Verbose "Collecting all installed version of the module $($m)"
9292
$GetAllInstalledVersions = Get-InstalledModule -Name $m -AllVersions | Sort-Object { $_.Version -as [version] } -Descending | Select-Object -ExpandProperty Version
9393

@@ -144,19 +144,19 @@ Function Update-RSModule {
144144
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.
145145
146146
.EXAMPLE
147-
Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser
147+
Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser
148148
# This will update the modules PowerCLI, ImportExcel for the current user
149149
150150
.EXAMPLE
151-
Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion
151+
Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion
152152
# This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel.
153153
154154
.EXAMPLE
155-
Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing
155+
Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing
156156
# 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.
157157
158158
.EXAMPLE
159-
Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule
159+
Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule
160160
# 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.
161161
162162
.LINK
@@ -174,10 +174,10 @@ Function Update-RSModule {
174174

175175
[CmdletBinding(SupportsShouldProcess)]
176176
Param(
177-
[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")]
178-
[string]$Module,
177+
[Parameter(Mandatory = $false, HelpMessage = "Enter module or modules that you want to update, if you don't enter any, all of the modules will be updated")]
178+
[string[]]$Module,
179+
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules, default is CurrentUser")]
179180
[ValidateSet("CurrentUser", "AllUsers")]
180-
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
181181
[string]$Scope = "CurrentUser",
182182
[Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")]
183183
[switch]$ImportModule = $false,
@@ -242,7 +242,7 @@ Function Update-RSModule {
242242

243243

244244
# Start looping trough every module that are stored in the string Module
245-
foreach ($m in $Module.Split()) {
245+
foreach ($m in $Module) {
246246
Write-Verbose "Checks if $($m) are installed"
247247
if ($m -in $InstalledModules.Name) {
248248

@@ -305,7 +305,7 @@ Function Update-RSModule {
305305

306306
# Import module if it's not imported
307307
Write-Verbose "Starting to import the modules..."
308-
foreach ($m in $Module.Split()) {
308+
foreach ($m in $Module) {
309309
if ($m -in $ImportedModules.Name) {
310310
Write-Verbose "$($m) are already imported!"
311311
}

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ If you want you can update specific modules, you can do that with the following
5757
````
5858
Update-RSModule -Module "VMWare.PowerCLI"
5959
````
60-
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"```
60+
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"```
6161
You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"```
6262
If -Scope parameter are empty it will set it as CurrentUser as default.
6363

@@ -75,7 +75,7 @@ If you want to uninstall old versions of only a specific module you can run
7575
````
7676
Update-RSModule -Module "ImportExcel" -UninstallOldVersion
7777
````
78-
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"```
78+
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"```
7979
You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"```
8080
If -Scope parameter are empty it will set it as CurrentUser as default.
8181

@@ -85,7 +85,7 @@ If the module are installed already this will not have any effect and the module
8585
````
8686
Update-RSModule -Module "VMWare.PowerCLI" -InstallMissing
8787
````
88-
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"```
88+
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"```
8989
You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"```
9090
If -Scope parameter are empty it will set it as CurrentUser as default.
9191

@@ -94,7 +94,7 @@ You can choose to import all of the modules at the end of the script, this only
9494
````
9595
Update-RSModule -Module "VMWare.PowerCLI" -ImportModule
9696
````
97-
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"```
97+
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"```
9898
You can also use the -Scope parameter if you want to change from CurrentUser to AllUsers, for example ```-Scope "AllUser"```
9999
If -Scope parameter are empty it will set it as CurrentUser as default.
100100

@@ -111,4 +111,4 @@ If you want to uninstall all older version of a specific module
111111
````
112112
Uninstall-RSModule -Module "ImportExcel"
113113
````
114-
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel, VMWare.PowerCLI"```
114+
The parameter Module has support for multiple inputs, separate them with , for example ```-Module "ImportExcel", "VMWare.PowerCLI"```

RSModuleBuilder.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[string]$apiKey = ""
1010
#
1111
# Changes on every build
12-
[string]$Version = "0.1.3"
12+
[string]$Version = "0.1.4"
1313
[string]$PowerShellVersion = "5.1"
1414
[string]$Tags = '"PowerShell", "macOS", "Windows", "Linux", "support-tool", "sysadmin-tool", "it-tool", "maintain-module", "module-maintenance", "multi-platform", "multiOS"'
1515
[string]$ProcessorArchitecture = ""

help/Uninstall-RSModule.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ SYNOPSIS
77

88

99
SYNTAX
10-
Uninstall-RSModule [[-Module] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
10+
Uninstall-RSModule [[-Module] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
1111

1212

1313
DESCRIPTION
1414
This script let users uninstall older versions of the modules that are installed on the system.
1515

1616

1717
PARAMETERS
18-
-Module <String>
18+
-Module <String[]>
1919
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
2020

2121
Required? false
@@ -73,7 +73,7 @@ NOTES
7373

7474
-------------------------- EXAMPLE 2 --------------------------
7575

76-
PS > Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel"
76+
PS > Uninstall-RSModule -Module "VMWare.PowerCLI", "ImportExcel"
7777
# This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system.
7878

7979

help/Update-RSModule.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SYNOPSIS
77

88

99
SYNTAX
10-
Update-RSModule [[-Module] <String>] [[-Scope] <String>] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>]
10+
Update-RSModule [[-Module] <String[]>] [[-Scope] <String>] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>]
1111

1212

1313
DESCRIPTION
@@ -16,7 +16,7 @@ DESCRIPTION
1616

1717

1818
PARAMETERS
19-
-Module <String>
19+
-Module <String[]>
2020
Specify the module or modules that you want to update, if you don't specify any module all installed modules are updated
2121

2222
Required? false
@@ -104,7 +104,7 @@ NOTES
104104

105105
-------------------------- EXAMPLE 1 --------------------------
106106

107-
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser
107+
PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -Scope CurrentUser
108108
# This will update the modules PowerCLI, ImportExcel for the current user
109109

110110

@@ -114,7 +114,7 @@ NOTES
114114

115115
-------------------------- EXAMPLE 2 --------------------------
116116

117-
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion
117+
PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion
118118
# This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel.
119119

120120

@@ -124,7 +124,7 @@ NOTES
124124

125125
-------------------------- EXAMPLE 3 --------------------------
126126

127-
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing
127+
PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -InstallMissing
128128
# 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.
129129

130130

@@ -134,7 +134,7 @@ NOTES
134134

135135
-------------------------- EXAMPLE 4 --------------------------
136136

137-
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule
137+
PS > Update-RSModule -Module "PowerCLI", "ImportExcel" -UninstallOldVersion -ImportModule
138138
# 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.
139139

140140

0 commit comments

Comments
 (0)