Created
August 22, 2016 13:27
-
-
Save sochan1/86d9c14b15d180aa06473f16f362ff6e to your computer and use it in GitHub Desktop.
pull server setup
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 NewPullServer | |
{ | |
param | |
( | |
[string[]]$ComputerName = ‘vms03’ | |
) | |
Import-DSCResource -ModuleName xPSDesiredStateConfiguration | |
Node $ComputerName | |
{ | |
WindowsFeature DSCServiceFeature | |
{ | |
Ensure = “Present” | |
Name = “DSC-Service” | |
} | |
xDscWebService PSDSCPullServer | |
{ | |
Ensure = “Present” | |
EndpointName = “PSDSCPullServer” | |
Port = 8080 | |
PhysicalPath = “$env:SystemDrive\inetpub\wwwroot\PSDSCPullServer” | |
CertificateThumbPrint = “AllowUnencryptedTraffic” | |
ModulePath = “$env:PROGRAMFILES\WindowsPowerShell\DscService\Modules” | |
ConfigurationPath = “$env:PROGRAMFILES\WindowsPowerShell\DscService\Configuration” | |
State = “Started” | |
DependsOn = “[WindowsFeature]DSCServiceFeature” | |
} | |
xDscWebService PSDSCComplianceServer | |
{ | |
Ensure = “Present” | |
EndpointName = “PSDSCComplianceServer” | |
Port = 9080 | |
PhysicalPath = “$env:SystemDrive\inetpub\wwwroot\PSDSCComplianceServer” | |
CertificateThumbPrint = “AllowUnencryptedTraffic” | |
State = “Started” | |
IsComplianceServer = $true | |
DependsOn = (“[WindowsFeature]DSCServiceFeature”,”[xDSCWebService]PSDSCPullServer”) | |
} | |
} | |
} | |
NewPullServer –ComputerName vms03 | |
Start-DscConfiguration .\NewPullServer –Wait -Verbose | |
#Test the pull server | |
Start-process -filepath iexplore.exe http://vms03:8080/PSDSCPullServer.svc | |
Configuration VMS02WEBSITE | |
{ | |
param ($MachineName) | |
Node $MachineName | |
{ | |
#Install the IIS Role | |
WindowsFeature IIS | |
{ | |
Ensure = “Present” | |
Name = “Web-Server” | |
} | |
#Install web-mgmt tools | |
WindowsFeature Web-Mgmt-Tools | |
{ | |
Ensure = “Present” | |
Name = “Web-Mgmt-Tools” | |
} | |
} | |
} | |
VMS02WEBSITE –MachineName “Vms02" | |
[guid]::NewGuid() | |
$target = "C:\Program Files\WindowsPowerShell\DscService\Configuration" | |
New-DSCCheckSum $target | |
Configuration SetPullMode | |
{ | |
param([string]$guid) | |
Node vms02 | |
{ | |
LocalConfigurationManager | |
{ | |
ConfigurationMode = ‘ApplyAndAutoCorrect’ | |
ConfigurationID = $guid | |
RefreshMode = ‘Pull’ | |
DownloadManagerName = ‘WebDownloadManager’ | |
DownloadManagerCustomData = @{ | |
ServerUrl = ‘http://vms03:8080/PSDSCPullServer.svc’; | |
AllowUnsecureConnection = ‘true’ } | |
} | |
} | |
} | |
SetPullMode –guid $Guid | |
Set-DSCLocalConfigurationManager –Computer vms02 -Path C:\SetPullMode –Verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment