Created
February 2, 2016 14:22
-
-
Save duffney/c50a011e1b2a08e90a6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuration HTTPSPull { | |
param ( | |
[string[]]$NodeName, | |
[string]$MachineName, | |
[string]$IPAddress, | |
[string]$DefaultGateway, | |
[string[]]$DNSIPAddress, | |
[string]$DomaniName | |
) | |
Import-DscResource –Module PSDesiredStateConfiguration | |
Import-DscResource -Module cNetworking | |
Import-DscResource -Module xNetworking | |
Import-DscResource -Module xComputerManagement | |
Import-DscResource -Module xTimeZone | |
Node $AllNodes.Where{$_.Role -eq "HTTPSPull"}.Nodename { | |
LocalConfigurationManager | |
{ | |
ActionAfterReboot = 'ContinueConfiguration' | |
ConfigurationMode = 'ApplyAndAutoCorrect' | |
RebootNodeIfNeeded = $true | |
} | |
xTimeZone SystemTimeZone { | |
TimeZone = 'Central Standard Time' | |
IsSingleInstance = 'Yes' | |
} | |
If ((gwmi win32_computersystem).partofdomain -eq $false){ | |
xComputer NewName { | |
Name = $Node.MachineName | |
DomainName = $Node.DomainName | |
Credential = $Node.Credential | |
DependsOn = '[cDNSServerAddress]DnsServerAddress' | |
} | |
} | |
xIPAddress NewIPAddress | |
{ | |
IPAddress = $Node.IPAddress | |
InterfaceAlias = "Ethernet" | |
SubnetMask = 24 | |
AddressFamily = "IPV4" | |
} | |
xDefaultGatewayAddress NewDefaultGateway | |
{ | |
AddressFamily = 'IPv4' | |
InterfaceAlias = 'Ethernet' | |
Address = $Node.DefaultGateway | |
DependsOn = '[xIPAddress]NewIpAddress' | |
} | |
cDNSServerAddress DnsServerAddress | |
{ | |
Address = $Node.DNSIPAddress | |
InterfaceAlias = 'Ethernet' | |
AddressFamily = 'IPV4' | |
} | |
} | |
} | |
$ConfigData = @{ | |
AllNodes = @( | |
@{ | |
Nodename = $env:COMPUTERNAME | |
MachineName = 'ZPull01' | |
Role = "HTTPSPull" | |
DomainName = "Zephyr" | |
PsDscAllowPlainTextPassword = $true | |
PSDscAllowDomainUser = $true | |
IPAddress = '192.168.2.5' | |
DefaultGateway = '192.168.2.1' | |
DNSIPAddress = '192.168.2.2' | |
Credential = (Get-Credential -UserName 'zephyr\administrator' -message 'Enter admin pwd') | |
} | |
) | |
} | |
HTTPSPull -ConfigurationData $ConfigData | |
Set-DscLocalConfigurationManager -Path .\HTTPSPull -Verbose -Force | |
Start-DscConfiguration -Path .\HTTPSPull -Wait -Force -Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment