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
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.
21
28
22
29
## EXAMPLES
23
30
24
31
### Example 1
32
+
33
+
This example return all versions of modules and scripts installed on the machine.
34
+
25
35
```powershell
26
-
PS C:\> Get-PSResource Az
36
+
Get-PSResource
27
37
```
28
38
29
-
This will return versions (stable and prerelease) of the Az module installed via PowerShellGet.
30
-
31
39
### Example 2
40
+
41
+
This example returns all versions of the **Az** module installed using **PowerShellGet**.
42
+
32
43
```powershell
33
-
PS C:\> Get-PSResource Az -version "1.0.0"
44
+
Get-PSResource Az
34
45
```
35
46
36
-
This will return version 1.0.0 of the Az module.
37
-
38
47
### Example 3
48
+
49
+
This example return all versions of the **Az** module installed in the current directory.
50
+
39
51
```powershell
40
-
PS C:\> Get-PSResource Az -version "(1.0.0, 3.0.0)"
52
+
Get-PSResource Az -Path .
41
53
```
42
54
43
-
This will return all versions of the Az module within the specified range.
44
-
45
55
### Example 4
56
+
57
+
This example returns a specific version of the Az module if it's installed on the system..
58
+
46
59
```powershell
47
-
PS C:\> Get-PSResource Az -version "4.0.1-preview"
60
+
Get-PSResource Az -Version 1.0.0
48
61
```
49
62
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
-
52
63
### Example 5
64
+
65
+
This example return all installed versions of the Az module within the specified version range.
66
+
53
67
```powershell
54
-
PS C:\> Get-PSResource Az -version "4.0.1"
68
+
Get-PSResource Az -Version "(1.0.0, 3.0.0)"
55
69
```
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.
57
70
58
71
### Example 6
72
+
73
+
This example returns a specific preview version of the **PowerShellGet** module if it's installed
74
+
on the system.
75
+
59
76
```powershell
60
-
PS C:\> Get-PSResource Az -Version "[4.0.1, 4.0.2-preview]
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
+
```
65
85
66
86
### 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
+
67
92
```powershell
68
-
PS C:\> Get-PSResource Az -Path .
93
+
Get-PSResource PowerShellGet -Version 3.0.14
69
94
```
70
95
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.
72
97
73
98
### 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
+
74
103
```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
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,
0 commit comments