Skip to content

Commit b1067ce

Browse files
markroloffsdwheeler
authored andcommitted
Added documentation for MaximumVersion key used with #Requires (#4772)
* Added MaximumVersion key to about_Requires.md Documented use of the MaximumVersion key for specifying the maximum allowable version of a module. * Added MaximumVersion key to v6 about_Requires.md Documented use of the MaximumVersion key for specifying the maximum allowable version of a module. * Added MaximumVersion key to v7 about_Requires.md Documented use of the MaximumVersion key for specifying the maximum allowable version of a module. * Update about_Requires.md Amend quantity of required hashtable keys that can be used in addition to ModuleName * Update about_Requires.md Amend quantity of required hashtable keys that can be used in addition to ModuleName * Update about_Requires.md Amend quantity of required hashtable keys that can be used in addition to ModuleName * Update about_Requires.md * Update about_Requires.md * Update about_Requires.md
1 parent 261341b commit b1067ce

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

reference/5.1/Microsoft.PowerShell.Core/About/about_Requires.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ following keys.
9393

9494
- `ModuleName` - **Required** Specifies the module name.
9595
- `GUID` - **Optional** Specifies the GUID of the module.
96-
- It is also **Required** to specify one of the two below keys. These keys
96+
- It is also **Required** to specify one of the three below keys. These keys
9797
cannot be used together.
9898
- `ModuleVersion` - Specifies a minimum acceptable version of the module.
9999
- `RequiredVersion` - Specifies an exact, required version of the module.
100+
- `MaximumVersion` - Specifies the maximum acceptable version of the module.
100101

101102
> [!NOTE]
102103
> `RequiredVersion` was added in Windows PowerShell 5.0.
104+
> `MaximumVersion` was added in Windows PowerShell 5.1.
103105
104106
For example:
105107

@@ -115,6 +117,12 @@ Requires that `Hyper-V` (**only** version `1.1`) is installed.
115117
#Requires -Modules @{ ModuleName="Hyper-V"; RequiredVersion="1.1" }
116118
```
117119

120+
Requires that `Hyper-V` (version `1.1` or lesser) is installed.
121+
122+
```powershell
123+
#Requires -Modules @{ ModuleName="Hyper-V"; MaximumVersion="1.1" }
124+
```
125+
118126
Requires that any version of `PSScheduledJob` and `PSWorkflow`, is installed.
119127

120128
```powershell
@@ -205,4 +213,4 @@ Param
205213

206214
[about_PSSnapins](about_PSSnapins.md)
207215

208-
[Get-PSSnapin](../Get-PSSnapin.md)
216+
[Get-PSSnapin](../Get-PSSnapin.md)

reference/6/Microsoft.PowerShell.Core/About/about_Requires.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ following keys.
9393

9494
- `ModuleName` - **Required** Specifies the module name.
9595
- `GUID` - **Optional** Specifies the GUID of the module.
96-
- It is also **Required** to specify one of the two below keys. These keys
96+
- It is also **Required** to specify one of the three below keys. These keys
9797
cannot be used together.
9898
- `ModuleVersion` - Specifies a minimum acceptable version of the module.
9999
- `RequiredVersion` - Specifies an exact, required version of the module.
100+
- `MaximumVersion` - Specifies the maximum acceptable version of the module.
100101

101102
> [!NOTE]
102103
> `RequiredVersion` was added in Windows PowerShell 5.0.
104+
> `MaximumVersion` was added in Windows PowerShell 5.1.
103105
104106
For example:
105107

@@ -115,6 +117,12 @@ Require that `AzureRM.Netcore` (**only** version `0.12.0`) is installed.
115117
#Requires -Modules @{ ModuleName="AzureRM.Netcore"; RequiredVersion="0.12.0" }
116118
```
117119

120+
Requires that `AzureRM.Netcore` (version `0.12.0` or lesser) is installed.
121+
122+
```powershell
123+
#Requires -Modules @{ ModuleName="AzureRM.Netcore"; MaximumVersion="0.12.0" }
124+
```
125+
118126
Require that any version of `AzureRM.Netcore` and `PowerShellGet` is installed.
119127

120128
```powershell

reference/7/Microsoft.PowerShell.Core/About/about_Requires.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ following keys.
9393

9494
- `ModuleName` - **Required** Specifies the module name.
9595
- `GUID` - **Optional** Specifies the GUID of the module.
96-
- It is also **Required** to specify one of the two below keys. These keys
96+
- It is also **Required** to specify one of the three below keys. These keys
9797
cannot be used together.
9898
- `ModuleVersion` - Specifies a minimum acceptable version of the module.
9999
- `RequiredVersion` - Specifies an exact, required version of the module.
100+
- `MaximumVersion` - Specifies the maximum acceptable version of the module.
100101

101102
> [!NOTE]
102103
> `RequiredVersion` was added in Windows PowerShell 5.0.
104+
> `MaximumVersion` was added in Windows PowerShell 5.1.
103105
104106
For example:
105107

@@ -115,6 +117,12 @@ Require that `AzureRM.Netcore` (**only** version `0.12.0`) is installed.
115117
#Requires -Modules @{ ModuleName="AzureRM.Netcore"; RequiredVersion="0.12.0" }
116118
```
117119

120+
Requires that `AzureRM.Netcore` (version `0.12.0` or lesser) is installed.
121+
122+
```powershell
123+
#Requires -Modules @{ ModuleName="AzureRM.Netcore"; MaximumVersion="0.12.0" }
124+
```
125+
118126
Require that any version of `AzureRM.Netcore` and `PowerShellGet` is installed.
119127

120128
```powershell

0 commit comments

Comments
 (0)