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 commit adds a new type and provider for managing the PowerShellGet
package providers. **Note** The official API at this time does not allow
removing PowerShellGet PackageProviders. There is a way to delete the
source_location to remove a PackageProvider, but this is an unsupported
method that may cause side effects. Thus this provider only implements
create and update.
Copy file name to clipboardexpand all lines: README.md
+97-5
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,7 @@
11
11
*[Use the PowerShell Gallery](#use-the-powershell-gallery)
12
12
*[Side by side installation](#side-by-side-installation)
13
13
*[The provider](#the-provider)
14
+
*[Full working example](#full-working-example)
14
15
1.[Reference](#reference)
15
16
*[Types](#types)
16
17
*[Providers](#providers)
@@ -31,16 +32,43 @@ For Windows PowerShell the PowerShellGet PowerShell module must be installed as
31
32
the NuGet package provider. PowerShellGet is included with WMF5 or can be installed for earlier
32
33
versions here http://go.microsoft.com/fwlink/?LinkID=746217&clcid=0x409
33
34
34
-
NuGet can be installed by running
35
-
36
-
`Install-PackageProvider Nuget –Force`
37
-
38
35
### PowerShell Core
39
36
40
37
PowerShellGet is included in PowerShell Core so no additional setup is necessary.
41
38
42
39
## Usage
43
40
41
+
### Install PowerShellGet PackageProviders
42
+
43
+
44
+
You can install PackageProviders for PowerShelLGet using the `pspackageprovider` type.
45
+
46
+
```puppet
47
+
pspackageprovider {'ExampleProvider':
48
+
ensure => 'present',
49
+
provider => 'windowspowershell',
50
+
}
51
+
```
52
+
53
+
In order to use this module to to get packages from a PSRepository like the `PSGallery`, you will have to ensure the `Nuget` provider is installed:
54
+
55
+
```puppet
56
+
pspackageprovider {'Nuget':
57
+
ensure => 'present',
58
+
provider => 'windowspowershell',
59
+
}
60
+
```
61
+
62
+
You can optionally specify the version of a PackageProvider using the `version` parameter.
63
+
64
+
```puppet
65
+
pspackageprovider {'Nuget':
66
+
ensure => 'present',
67
+
version => '2.8.5.208',
68
+
provider => 'windowspowershell',
69
+
}
70
+
```
71
+
44
72
### Register an internal PowerShell repository
45
73
46
74
```puppet
@@ -102,15 +130,79 @@ package { 'PSExcel-psc':
102
130
103
131
The provider to use will either be `windowspowershell` or `powershellcore`. Nodes using `powershell.exe` will use `windowspowershell`, and nodes that have PowerShell core (`pwsh.exe`) will use the `powershellcore` provider with both the `psrepository` and `package` types.
104
132
133
+
### Full Working example
134
+
135
+
This complete example shows how to bootstrap the system with the Nuget package provider, ensure the PowerShell Gallery repository is configured and trusted, and install two modules (one using the WindowsPowerShell provider and one using the PowerShellCore provider).
Note that PowerShell modules can be installed side by side so installing a newer
108
164
version of a module will not remove any previous versions.
109
165
166
+
- As detailed in https://github.com/OneGet/oneget/issues/308, installing PackageProviders from a offline location instead of online is currently not working. A workaround is to use the Puppet file resource to ensure the prescence of the file before attempting to use the NuGet PackageProvider.
167
+
168
+
The following is an incompelete example that copies the NuGet provider dll to the directory that PowerShellGet expects. You would have to modify this declaration to complete the permissions for the target and the location of the source file.
`puppet-powershellmodule` implements a [package type](http://docs.puppet.com/references/latest/type.html#package) with a resource provider, which is built into Puppet.
189
+
190
+
### pspackageprovider
191
+
192
+
#### Properties/Parameters
193
+
194
+
##### `ensure`
195
+
196
+
Specifies what state the PowerShellGet provider should be in. Valid options: `present` and `absent`. Default: `present`.
197
+
198
+
##### `name`
199
+
200
+
Specifies the name of the PowerShellGet provider to install.
201
+
202
+
##### `version`
203
+
204
+
Specifies the version of the PowerShellGet provider to install
205
+
114
206
### psrepository
115
207
116
208
Allows you to specify and configure a repository. The type expects a valid OneGet package provider source over an HTTP or HTTPS url.
@@ -140,4 +232,4 @@ The provider for systems that use PowerShell core via `pwsh.exe`.
0 commit comments