Skip to content

Commit 862ab3c

Browse files
authored
Editorial pass on cmdlet ref (#743)
1 parent 51256a3 commit 862ab3c

17 files changed

+2201
-1339
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ src/code/obj
33
srcOld/code/bin
44
srcOld/code/obj
55
out
6+
test/**/obj
7+
test/**/bin

help/Find-PSResource.md

Lines changed: 190 additions & 123 deletions
Large diffs are not rendered by default.

help/Get-PSResource.md

Lines changed: 106 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,159 @@
11
---
22
external help file: PowerShellGet.dll-Help.xml
33
Module Name: PowerShellGet
4+
ms.date: 08/03/2022
45
online version:
56
schema: 2.0.0
67
---
78

89
# Get-PSResource
910

1011
## SYNOPSIS
11-
Returns resources (modules and scripts) installed on the machine via PowerShellGet.
12+
Returns modules and scripts installed on the machine via **PowerShellGet**.
1213

1314
## SYNTAX
1415

16+
### __AllParameterSets
17+
1518
```
16-
Get-PSResource [[-Name] <String[]>] [-Version <String>] [-Path <String>] [-Scope <ScopeType>] [<CommonParameters>]
19+
Get-PSResource [[-Name] <string[]>] [-Version <string>] [-Path <string>] [-Scope <ScopeType>]
20+
[<CommonParameters>]
1721
```
1822

1923
## DESCRIPTION
20-
The Get-PSResource cmdlet combines the Get-InstalledModule, Get-InstalledScript cmdlets from V2. It performs a search within module or script installation paths based on the -Name parameter argument. It returns PSResourceInfo objects which describes each resource item found. Other parameters allow the returned results to be filtered by version and path.
24+
25+
This cmdlet searches the module and script installation paths and returns **PSResourceInfo** objects
26+
that describes each resource item found. This is equivalent to the combined output of the
27+
`Get-InstalledModule` and `Get-InstalledScript` cmdlets from **PowerShellGet** v2.
2128

2229
## EXAMPLES
2330

2431
### Example 1
32+
33+
This example return all versions of modules and scripts installed on the machine.
34+
2535
```powershell
26-
PS C:\> Get-PSResource Az
36+
Get-PSResource
2737
```
2838

29-
This will return versions (stable and prerelease) of the Az module installed via PowerShellGet.
30-
3139
### Example 2
40+
41+
This example returns all versions of the **Az** module installed using **PowerShellGet**.
42+
3243
```powershell
33-
PS C:\> Get-PSResource Az -version "1.0.0"
44+
Get-PSResource Az
3445
```
3546

36-
This will return version 1.0.0 of the Az module.
37-
3847
### Example 3
48+
49+
This example return all versions of the **Az** module installed in the current directory.
50+
3951
```powershell
40-
PS C:\> Get-PSResource Az -version "(1.0.0, 3.0.0)"
52+
Get-PSResource Az -Path .
4153
```
4254

43-
This will return all versions of the Az module within the specified range.
44-
4555
### Example 4
56+
57+
This example returns a specific version of the Az module if it's installed on the system..
58+
4659
```powershell
47-
PS C:\> Get-PSResource Az -version "4.0.1-preview"
60+
Get-PSResource Az -Version 1.0.0
4861
```
4962

50-
Assume that the package Az version 4.0.1-preview is already installed. This will return version 4.0.1-preview of the Az module.
51-
5263
### Example 5
64+
65+
This example return all installed versions of the Az module within the specified version range.
66+
5367
```powershell
54-
PS C:\> Get-PSResource Az -version "4.0.1"
68+
Get-PSResource Az -Version "(1.0.0, 3.0.0)"
5569
```
56-
Assume that the package Az version 4.0.1-preview is already installed. This will not return Az version 4.0.1-preview as the full version (including prerelease label, i.e "4.0.1-preview") was not specified.
5770

5871
### Example 6
72+
73+
This example returns a specific preview version of the **PowerShellGet** module if it's installed
74+
on the system.
75+
5976
```powershell
60-
PS C:\> Get-PSResource Az -Version "[4.0.1, 4.0.2-preview]
77+
Get-PSResource PowerShellGet -Version 3.0.14-beta14
6178
```
6279

63-
Assume that the following versions are already installed for package Az: 4.0.1-preview and 4.0.2-preview. This will only return version 4.0.2-preview as it is the only one which falls within the specified version range. Per NuGetVersion rules, a prerelease version is less than a stable version, so 4.0.1-preview is less than the 4.0.1 specified version so 4.0.1-preview does not fall within the specified version range and won't be returned.
64-
80+
```Output
81+
Name Version Prerelease Repository Description
82+
---- ------- ---------- ---------- -----------
83+
PowerShellGet 3.0.14 beta14 PSGallery PowerShell module with commands for discovering, installing, updating and …
84+
```
6585

6686
### Example 6
87+
88+
The previous example showed that **PowerShellGet** version 3.0.14-beta14 was installed on the
89+
system. This example shows that you must provide the full version, including the **Prerelease**
90+
label to identify the installed module by **Version**.
91+
6792
```powershell
68-
PS C:\> Get-PSResource Az -Path .
93+
Get-PSResource PowerShellGet -Version 3.0.14
6994
```
7095

71-
This will return all versions of the Az module that have been installed in the current directory.
96+
There is no output from this command.
7297

7398
### Example 7
99+
100+
In this example you see that there are four version of **PSReadLine** installed on the system. The
101+
second command searches for a range of version between `2.2.0` and `2.3.0`.
102+
74103
```powershell
75-
PS C:\> Get-PSResource
104+
Get-PSResource PSReadLine
105+
```
106+
107+
```Output
108+
Name Version Prerelease Repository Description
109+
---- ------- ---------- ---------- -----------
110+
PSReadLine 2.2.6 PSGallery Great command line editing in the PowerShell console host
111+
PSReadLine 2.2.5 PSGallery Great command line editing in the PowerShell console host
112+
PSReadLine 2.2.2 PSGallery Great command line editing in the PowerShell console host
113+
PSReadLine 2.2.0 beta4 PSGallery Great command line editing in the PowerShell console host
114+
```
115+
116+
```powershell
117+
Get-PSResource PSReadLine -Version '[2.2.0, 2.3.0]'
118+
```
119+
120+
```Output
121+
Name Version Prerelease Repository Description
122+
---- ------- ---------- ---------- -----------
123+
PSReadLine 2.2.6 PSGallery Great command line editing in the PowerShell console host
124+
PSReadLine 2.2.5 PSGallery Great command line editing in the PowerShell console host
125+
PSReadLine 2.2.2 PSGallery Great command line editing in the PowerShell console host
76126
```
77127

78-
This will return all versions and scripts installed on the machine.
128+
According to NuGet version rules a prerelease version is less than a stable version, so
129+
`2.2.0-beta4` is less than the `2.2.0` version in the specified version range.
79130

80131
## PARAMETERS
81132

82133
### -Name
83-
Name of a resource or resources to find. Accepts wild card characters or a null value.
134+
135+
Name of a resource to find. Wildcards are supported but NuGet only accepts the `*` character. NuGet
136+
does not support wildcard searches of local (file-based) repositories.
84137

85138
```yaml
86139
Type: System.String[]
87-
Parameter Sets: NameParameterSet
140+
Parameter Sets: (All)
88141
Aliases:
89142

90143
Required: False
91144
Position: 0
92145
Default value: None
93-
Accept pipeline input: True
146+
Accept pipeline input: True (ByValue)
94147
Accept wildcard characters: True
95148
```
96149
97150
### -Path
151+
98152
Specifies the path to search in.
99153
100154
```yaml
101155
Type: System.String
102-
Parameter Sets: NameParameterSet
156+
Parameter Sets: (All)
103157
Aliases:
104158

105159
Required: False
@@ -109,37 +163,40 @@ Accept pipeline input: False
109163
Accept wildcard characters: False
110164
```
111165
112-
### -Version
113-
Specifies the version of the resource to be returned. The value can be an exact version or a version
114-
range using the NuGet versioning syntax.
115-
116-
For more information about NuGet version ranges, see [Package versioning](/nuget/concepts/package-versioning#version-ranges)
166+
### -Scope
117167
118-
PowerShellGet supports all but the _minimum inclusive version_ listed in the NuGet version range
119-
documentation. So inputting "1.0.0.0" as the version doesn't yield versions 1.0.0.0 and higher
120-
(minimum inclusive range). Instead, the values is considered as the required version and yields
121-
version 1.0.0.0 only (required version). To use the minimum inclusive range, provide `[1.0.0.0, ]` as
122-
the version range.
168+
Specifies the scope of the resource.
123169
124170
```yaml
125-
Type: System.String
126-
Parameter Sets: NameParameterSet
171+
Type: Microsoft.PowerShell.PowerShellGet.UtilClasses.ScopeType
172+
Parameter Sets: (All)
127173
Aliases:
174+
Accepted values: CurrentUser, AllUsers
128175

129176
Required: False
130177
Position: Named
131178
Default value: None
132179
Accept pipeline input: False
133180
Accept wildcard characters: False
134181
```
135-
### -Scope
136-
Specifies the scope of the resource.
182+
183+
### -Version
184+
185+
Specifies the version of the resource to be returned. The value can be an exact version or a version
186+
range using the NuGet versioning syntax.
187+
188+
For more information about NuGet version ranges, see
189+
[Package versioning](/nuget/concepts/package-versioning#version-ranges).
190+
191+
PowerShellGet supports all but the _minimum inclusive version_ listed in the NuGet version range
192+
documentation. Using `1.0.0.0` as the version doesn't yield versions 1.0.0.0 and higher (minimum
193+
inclusive range). Instead, the value is considered to be the required version. To search for a
194+
minimum inclusive range, use `[1.0.0.0, ]` as the version range.
137195

138196
```yaml
139-
Type: Microsoft.PowerShell.PowerShellGet.UtilClasses.ScopeType
197+
Type: System.String
140198
Parameter Sets: (All)
141199
Aliases:
142-
Accepted values: CurrentUser, AllUsers
143200
144201
Required: False
145202
Position: Named
@@ -149,7 +206,11 @@ Accept wildcard characters: False
149206
```
150207

151208
### CommonParameters
152-
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
209+
210+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
211+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
212+
-WarningAction, and -WarningVariable. For more information, see
213+
[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
153214

154215
## NOTES
155216

0 commit comments

Comments
 (0)