-
Notifications
You must be signed in to change notification settings - Fork 0
/
JoinDomain.ps1
53 lines (39 loc) · 1.2 KB
/
JoinDomain.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
Configuration JoinDomain
{
param
(
[string[]]$NodeName='localhost',
[Parameter(Mandatory)]
[string]$MachineName,
[Parameter(Mandatory)]
[string]$Domain,
[Parameter(Mandatory)]
[PSCredential]$Credential
)
#Import the required DSC Resources
Import-DscResource -Module xComputerManagement
Node $NodeName
{
LocalConfigurationManager
{
RefreshMode = 'Push'
ConfigurationMode = 'ApplyAndAutoCorrect'
ConfigurationModeFrequencyMins = 15
}
xComputer JoinDomain
{
Name = $MachineName
DomainName = $Domain
Credential = $Credential
}
}
}
$ConfigData = @{
AllNodes = @(
@{
NodeName = 'localhost'
PSDscAllowPlainTextPassword = $true
}
)
}
JoinDomain -ConfigurationData $ConfigData -MachineName 'mem1' -Credential (Get-Credential) -Domain toms.local