Skip to content

Commit e4ffcb4

Browse files
author
Robin Stolpe
committed
Updated with .link
1 parent 95e5c7d commit e4ffcb4

5 files changed

Lines changed: 150 additions & 83 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel"
1818
# This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system.
1919
20-
.RELATED LINKS
20+
.LINK
2121
https://github.com/rstolpe/MaintainModule/blob/main/README.md
2222
2323
.NOTES

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
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
45-
.RELATED LINKS
45+
.LINK
4646
https://github.com/rstolpe/MaintainModule/blob/main/README.md
4747
4848
.NOTES
@@ -59,7 +59,7 @@
5959
[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")]
6060
[string]$Module,
6161
[ValidateSet("CurrentUser", "AllUsers")]
62-
[Parameter(Mandatory = $true, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
62+
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
6363
[string]$Scope = "CurrentUser",
6464
[Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")]
6565
[switch]$ImportModule = $false,

Help/Uninstall-RSModule.md

Lines changed: 51 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,42 @@
22
NAME
33
Uninstall-RSModule
44

5+
SYNOPSIS
6+
Uninstall older versions of your modules in a easy way.
7+
8+
59
SYNTAX
6-
Uninstall-RSModule [[-Module] <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
10+
Uninstall-RSModule [[-Module] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
11+
712

13+
DESCRIPTION
14+
This script let users uninstall older versions of the modules that are installed on the system.
815

16+
917
PARAMETERS
10-
-Confirm
18+
-Module <String>
19+
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
1120

1221
Required? false
13-
Position? Named
22+
Position? 1
23+
Default value
1424
Accept pipeline input? false
15-
Parameter set name (All)
16-
Aliases cf
17-
Dynamic? false
1825
Accept wildcard characters? false
1926

20-
-Module <string>
21-
Enter the module or modules (separated with ,) you want to uninstall
27+
-WhatIf [<SwitchParameter>]
2228

2329
Required? false
24-
Position? 0
30+
Position? named
31+
Default value
2532
Accept pipeline input? false
26-
Parameter set name (All)
27-
Aliases None
28-
Dynamic? false
2933
Accept wildcard characters? false
3034

31-
-WhatIf
35+
-Confirm [<SwitchParameter>]
3236

3337
Required? false
34-
Position? Named
38+
Position? named
39+
Default value
3540
Accept pipeline input? false
36-
Parameter set name (All)
37-
Aliases wi
38-
Dynamic? false
3941
Accept wildcard characters? false
4042

4143
<CommonParameters>
@@ -44,19 +46,42 @@ PARAMETERS
4446
OutBuffer, PipelineVariable, and OutVariable. For more information, see
4547
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
4648

47-
4849
INPUTS
49-
None
50-
5150

5251
OUTPUTS
53-
System.Object
5452

55-
ALIASES
56-
None
53+
NOTES
5754

58-
59-
REMARKS
60-
None
55+
56+
Author: Robin Stolpe
57+
Mail: robin@stolpe.io
58+
Website: https://stolpe.io
59+
GitHub: https://github.com/rstolpe
60+
Twitter: https://twitter.com/rstolpes
61+
PSGallery: https://www.powershellgallery.com/profiles/rstolpe
62+
63+
-------------------------- EXAMPLE 1 --------------------------
64+
65+
PS > Uninstall-RSModule -Module "VMWare.PowerCLI"
66+
# This will uninstall all older versions of the module VMWare.PowerCLI system.
67+
68+
69+
70+
71+
72+
73+
-------------------------- EXAMPLE 2 --------------------------
74+
75+
PS > Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel"
76+
# This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system.
77+
78+
79+
80+
81+
82+
83+
84+
RELATED LINKS
85+
https://github.com/rstolpe/MaintainModule/blob/main/README.md
6186

6287

Help/Update-RSModule.md

Lines changed: 93 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,84 +2,83 @@
22
NAME
33
Update-RSModule
44

5+
SYNOPSIS
6+
This module let you maintain your installed modules in a easy way.
7+
8+
59
SYNTAX
6-
Update-RSModule [[-Module] <string>] [-Scope] {CurrentUser | AllUsers} [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>]
10+
Update-RSModule [[-Module] <String>] [[-Scope] <String>] [-ImportModule] [-UninstallOldVersion] [-InstallMissing] [-WhatIf] [-Confirm] [<CommonParameters>]
11+
712

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.
816

17+
918
PARAMETERS
10-
-Confirm
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
1121

1222
Required? false
13-
Position? Named
23+
Position? 1
24+
Default value
1425
Accept pipeline input? false
15-
Parameter set name (All)
16-
Aliases cf
17-
Dynamic? false
1826
Accept wildcard characters? false
1927

20-
-ImportModule
21-
Import modules that has been entered in the module parameter at the end of this function
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.
2233

2334
Required? false
24-
Position? Named
35+
Position? 2
36+
Default value CurrentUser
2537
Accept pipeline input? false
26-
Parameter set name (All)
27-
Aliases None
28-
Dynamic? false
2938
Accept wildcard characters? false
3039

31-
-InstallMissing
32-
Install all of the modules that has been entered in module that are not installed on the system
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
3343

3444
Required? false
35-
Position? Named
45+
Position? named
46+
Default value False
3647
Accept pipeline input? false
37-
Parameter set name (All)
38-
Aliases None
39-
Dynamic? false
4048
Accept wildcard characters? false
4149

42-
-Module <string>
43-
Enter module or modules (separated with ,) that you want to update, if you don't enter any all of the modules will be updated
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
4452

4553
Required? false
46-
Position? 0
54+
Position? named
55+
Default value False
4756
Accept pipeline input? false
48-
Parameter set name (All)
49-
Aliases None
50-
Dynamic? false
5157
Accept wildcard characters? false
5258

53-
-Scope <string>
54-
Enter CurrentUser or AllUsers depending on what scope you want to change your modules
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.
5561

56-
Required? true
57-
Position? 1
62+
Required? false
63+
Position? named
64+
Default value False
5865
Accept pipeline input? false
59-
Parameter set name (All)
60-
Aliases None
61-
Dynamic? false
6266
Accept wildcard characters? false
6367

64-
-UninstallOldVersion
65-
Uninstalls all old versions of the modules
68+
-WhatIf [<SwitchParameter>]
6669

6770
Required? false
68-
Position? Named
71+
Position? named
72+
Default value
6973
Accept pipeline input? false
70-
Parameter set name (All)
71-
Aliases None
72-
Dynamic? false
7374
Accept wildcard characters? false
7475

75-
-WhatIf
76+
-Confirm [<SwitchParameter>]
7677

7778
Required? false
78-
Position? Named
79+
Position? named
80+
Default value
7981
Accept pipeline input? false
80-
Parameter set name (All)
81-
Aliases wi
82-
Dynamic? false
8382
Accept wildcard characters? false
8483

8584
<CommonParameters>
@@ -88,19 +87,62 @@ PARAMETERS
8887
OutBuffer, PipelineVariable, and OutVariable. For more information, see
8988
about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).
9089

91-
9290
INPUTS
93-
None
94-
9591

9692
OUTPUTS
97-
System.Object
9893

99-
ALIASES
100-
None
94+
NOTES
10195

102-
103-
REMARKS
104-
None
96+
97+
Author: Robin Stolpe
98+
Mail: robin@stolpe.io
99+
Twitter: @rstolpes
100+
Website: https://stolpe.io
101+
GitHub: https://github.com/rstolpe
102+
PSGallery: https://www.powershellgallery.com/profiles/rstolpe
103+
104+
-------------------------- EXAMPLE 1 --------------------------
105+
106+
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -Scope CurrentUser
107+
# This will update the modules PowerCLI, ImportExcel for the current user
108+
109+
110+
111+
112+
113+
114+
-------------------------- EXAMPLE 2 --------------------------
115+
116+
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion
117+
# This will update the modules PowerCLI, ImportExcel and delete all of the old versions that are installed of PowerCLI, ImportExcel.
118+
119+
120+
121+
122+
123+
124+
-------------------------- EXAMPLE 3 --------------------------
125+
126+
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -InstallMissing
127+
# 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.
128+
129+
130+
131+
132+
133+
134+
-------------------------- EXAMPLE 4 --------------------------
135+
136+
PS > Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule
137+
# 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.
138+
139+
140+
141+
142+
143+
144+
145+
RELATED LINKS
146+
https://github.com/rstolpe/MaintainModule/blob/main/README.md
105147

106148

MaintainModule/MaintainModule.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Function Uninstall-RSModule {
3333
Uninstall-RSModule -Module "VMWare.PowerCLI, ImportExcel"
3434
# This will uninstall all older versions of VMWare.PowerCLI and ImportExcel from the system.
3535
36-
.RELATED LINKS
36+
.LINK
3737
https://github.com/rstolpe/MaintainModule/blob/main/README.md
3838
3939
.NOTES
@@ -140,7 +140,7 @@ Function Update-RSModule {
140140
Update-RSModule -Module "PowerCLI, ImportExcel" -UninstallOldVersion -ImportModule
141141
# 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.
142142
143-
.RELATED LINKS
143+
.LINK
144144
https://github.com/rstolpe/MaintainModule/blob/main/README.md
145145
146146
.NOTES
@@ -157,7 +157,7 @@ Function Update-RSModule {
157157
[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")]
158158
[string]$Module,
159159
[ValidateSet("CurrentUser", "AllUsers")]
160-
[Parameter(Mandatory = $true, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
160+
[Parameter(Mandatory = $false, HelpMessage = "Enter CurrentUser or AllUsers depending on what scope you want to change your modules")]
161161
[string]$Scope = "CurrentUser",
162162
[Parameter(Mandatory = $false, HelpMessage = "Import modules that has been entered in the module parameter at the end of this function")]
163163
[switch]$ImportModule = $false,

0 commit comments

Comments
 (0)