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 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")]
60
60
[string]$Module,
61
61
[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")]
63
63
[string]$Scope="CurrentUser",
64
64
[Parameter(Mandatory=$false,HelpMessage="Import modules that has been entered in the module parameter at the end of this function")]
This script let users uninstall older versions of the modules that are installed on the system.
8
15
16
+
9
17
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
11
20
12
21
Required? false
13
-
Position? Named
22
+
Position? 1
23
+
Default value
14
24
Accept pipeline input? false
15
-
Parameter set name (All)
16
-
Aliases cf
17
-
Dynamic? false
18
25
Accept wildcard characters? false
19
26
20
-
-Module <string>
21
-
Enter the module or modules (separated with ,) you want to uninstall
27
+
-WhatIf [<SwitchParameter>]
22
28
23
29
Required? false
24
-
Position? 0
30
+
Position? named
31
+
Default value
25
32
Accept pipeline input? false
26
-
Parameter set name (All)
27
-
Aliases None
28
-
Dynamic? false
29
33
Accept wildcard characters? false
30
34
31
-
-WhatIf
35
+
-Confirm [<SwitchParameter>]
32
36
33
37
Required? false
34
-
Position? Named
38
+
Position? named
39
+
Default value
35
40
Accept pipeline input? false
36
-
Parameter set name (All)
37
-
Aliases wi
38
-
Dynamic? false
39
41
Accept wildcard characters? false
40
42
41
43
<CommonParameters>
@@ -44,19 +46,42 @@ PARAMETERS
44
46
OutBuffer, PipelineVariable, and OutVariable. For more information, see
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.
8
16
17
+
9
18
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
11
21
12
22
Required? false
13
-
Position? Named
23
+
Position? 1
24
+
Default value
14
25
Accept pipeline input? false
15
-
Parameter set name (All)
16
-
Aliases cf
17
-
Dynamic? false
18
26
Accept wildcard characters? false
19
27
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.
22
33
23
34
Required? false
24
-
Position? Named
35
+
Position? 2
36
+
Default value CurrentUser
25
37
Accept pipeline input? false
26
-
Parameter set name (All)
27
-
Aliases None
28
-
Dynamic? false
29
38
Accept wildcard characters? false
30
39
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
33
43
34
44
Required? false
35
-
Position? Named
45
+
Position? named
46
+
Default value False
36
47
Accept pipeline input? false
37
-
Parameter set name (All)
38
-
Aliases None
39
-
Dynamic? false
40
48
Accept wildcard characters? false
41
49
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
44
52
45
53
Required? false
46
-
Position? 0
54
+
Position? named
55
+
Default value False
47
56
Accept pipeline input? false
48
-
Parameter set name (All)
49
-
Aliases None
50
-
Dynamic? false
51
57
Accept wildcard characters? false
52
58
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.
55
61
56
-
Required? true
57
-
Position? 1
62
+
Required? false
63
+
Position? named
64
+
Default value False
58
65
Accept pipeline input? false
59
-
Parameter set name (All)
60
-
Aliases None
61
-
Dynamic? false
62
66
Accept wildcard characters? false
63
67
64
-
-UninstallOldVersion
65
-
Uninstalls all old versions of the modules
68
+
-WhatIf [<SwitchParameter>]
66
69
67
70
Required? false
68
-
Position? Named
71
+
Position? named
72
+
Default value
69
73
Accept pipeline input? false
70
-
Parameter set name (All)
71
-
Aliases None
72
-
Dynamic? false
73
74
Accept wildcard characters? false
74
75
75
-
-WhatIf
76
+
-Confirm [<SwitchParameter>]
76
77
77
78
Required? false
78
-
Position? Named
79
+
Position? named
80
+
Default value
79
81
Accept pipeline input? false
80
-
Parameter set name (All)
81
-
Aliases wi
82
-
Dynamic? false
83
82
Accept wildcard characters? false
84
83
85
84
<CommonParameters>
@@ -88,19 +87,62 @@ PARAMETERS
88
87
OutBuffer, PipelineVariable, and OutVariable. For more information, see
# 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 --------------------------
# 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.
# 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")]
158
158
[string]$Module,
159
159
[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")]
161
161
[string]$Scope="CurrentUser",
162
162
[Parameter(Mandatory=$false,HelpMessage="Import modules that has been entered in the module parameter at the end of this function")]
0 commit comments