forked from dsccommunity/xPSDesiredStateConfiguration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sample_xDscWebService_Client.ps1
86 lines (74 loc) · 2.32 KB
/
Sample_xDscWebService_Client.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<#PSScriptInfo
.VERSION 1.0.0
.GUID 119f0689-7410-4b2d-a805-d5df9f582cad
.AUTHOR Microsoft Corporation
.COMPANYNAME Microsoft Corporation
.COPYRIGHT
.TAGS DSCConfiguration
.LICENSEURI https://github.com/dsccommunity/xPSDesiredStateConfiguration/blob/main/LICENSE
.PROJECTURI https://github.com/dsccommunity/xPSDesiredStateConfiguration
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
#>
<#
.SYNOPSIS
The Sample_xDscWebService_Client registers
a DSC client node with the pull server.
.PARAMETER NodeName
The name of the node being configured as a DSC Pull Server.
.PARAMETER RegistrationKey
This key will be used by client nodes as a shared key to authenticate
during registration. This should be a string with enough entropy
(randomness) to protect the registration of clients to the pull server.
The example creates a new GUID for the registration key.
.PARAMETER ServerName
The HostName to use when configuring the Pull Server URL on the DSC
client.
.PARAMETER Port
The port on which the PullServer is listening for connections
.EXAMPLE
$registrationKey = [System.Guid]::NewGuid()
Sample_xDscWebService_Client -RegistrationKey $registrationKey
#>
[DSCLocalConfigurationManager()]
Configuration Sample_xDscWebService_Client
{
param
(
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.String]
$NodeName = 'localhost',
[Parameter(Mandatory = $true)]
[System.String]
$RegistrationKey,
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.String]
$ServerName = 'localhost',
[Parameter()]
[ValidateRange(1, 65535)]
[System.UInt16]
$Port = 8080
)
Node $NodeName
{
Settings
{
RefreshMode = 'Pull'
}
ConfigurationRepositoryWeb CONTOSO-PullSrv
{
ServerURL = "https://$ServerName`:$Port/PSDSCPullServer.svc"
RegistrationKey = $RegistrationKey
ConfigurationNames = @('ClientConfig')
}
ReportServerWeb CONTOSO-PullSrv
{
ServerURL = "https://$ServerName`:$Port/PSDSCPullServer.svc"
RegistrationKey = $RegistrationKey
}
}
}