forked from dsccommunity/ActiveDirectoryDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dsccommunity#2 from Hindy-UK/working
Working
- Loading branch information
Showing
9 changed files
with
496 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<# | ||
.EXAMPLE | ||
This example will create a site link containing the requested list of sites. The cost and replication frequency will also be set. | ||
The requested sites must already exist. As other optional settings are not specified for the resource, the site link will be created | ||
with some default settings. Specifically: | ||
- Inter Site Transport Protocol will be IP | ||
- Replication Schedule will be 24 x 7 | ||
Note that while SitesIncluded, Cost and ReplicationFrequencyInMinutes are optional as they are not required to create a site | ||
link using this DSC Resource; failing to specify them will essentially result in a non-functioning site link. | ||
The account credentials must have the necessary permissions. Without additional delegation; this would mean an account with | ||
Enterprise Admins, or Domain Admins in the forest root domain. | ||
#> | ||
|
||
configuration xADSiteLink_CreateBasicSiteLink | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential] | ||
$DomainCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[System.String] | ||
$SiteLinkName, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$Cost, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ReplicationFrequencyInMinutes, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$SitesIncluded | ||
) | ||
|
||
|
||
Import-DscResource -Name MSFT_xADSiteLink -ModuleName xActiveDirectory | ||
|
||
|
||
Node $nodeName | ||
{ | ||
xADSiteLink CreateSiteLink | ||
{ | ||
Ensure = 'Present' | ||
DomainAdministratorCredential = $DomainCreds | ||
SiteLinkName = $SiteLinkName | ||
SitesIncluded = $SitesIncluded | ||
Cost = $Cost | ||
ReplicationFrequencyInMinutes = $ReplicationFrequency | ||
} | ||
} | ||
} | ||
|
||
<# | ||
Sample use: | ||
$credential = Get-Credential | ||
xADSiteLink_DeleteSiteLink -DomainAdministratorCredential $credential -SiteLinkName 'MyNewSiteLink' -SitesIncluded @('HubSite1','HubSite2') ` | ||
-Cost 100 -ReplicationFrequencyInMinutes 15 | ||
#> |
102 changes: 102 additions & 0 deletions
102
Examples/xADSiteLink/xADSiteLink_CreateComplexScheduleSiteLink.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<# | ||
.EXAMPLE | ||
This example will create a new site link with a replication schedule that allows replication at different times each day. | ||
The ReplicationSchedule for the xADSiteLink resource can handle 3 different types of schedule: | ||
- where replication is needed 24x7. For this scenario, specify a single string in an array as '24x7' | ||
- where replication is needed at specific times throughout the day, but every day has the same schedule. This is covered in the | ||
xADSiteLink_CreateDailyScheduleSiteLink example | ||
- where replication is needed at specific times throughout the day, but each day needs a different schedule. For this scenario | ||
ReplicationSchedule needs to be an array of strings in the format: | ||
@('<day of week>','<from hour>','<from minute>','<to hour>','<to minute>') | ||
'Day of week' needs to be specified as a value between 'Monday' to 'Sunday'. 'From' and 'to' hours need to be specified as a value | ||
between 'Zero' and 'TwentyThree'. 'From' and 'to' minutes need to be specified as one of 'Zero', 'Fifteen', 'Thirty' or 'FortyFive'. | ||
Please be aware that the 'to' values need to be for the block prior to when you want it to stop. If you wanted to allow replication | ||
on a Monday between 22h00 and 23h59 it would be: | ||
@('Monday','TwentyTwo','Zero','TwentyThree','FortyFive') | ||
Where you need to enable multiple blocks of replication throughout the day, or replication on different days, you can specify | ||
additional sets of from & to hours & minutes. This is shown in the sample usage section below | ||
The account credentials must have the necessary permissions. Without additional delegation; this would mean an account with | ||
Enterprise Admins, or Domain Admins in the forest root domain. | ||
#> | ||
|
||
configuration xADSiteLink_CreateComplexScheduleSiteLink | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential] | ||
$DomainCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[System.String] | ||
$SiteLinkName, | ||
|
||
[parameter()] | ||
[System.String] | ||
$Description, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$Cost, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ReplicationFrequencyInMinutes, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$SitesIncluded, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ChangeNotification, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$ReplicationSchedule | ||
) | ||
|
||
|
||
Import-DscResource -Name MSFT_xADSiteLink -ModuleName xActiveDirectory | ||
|
||
|
||
Node $nodeName | ||
{ | ||
xADSiteLink CreateTurboSiteLink | ||
{ | ||
Ensure = 'Present' | ||
DomainAdministratorCredential = $DomainCreds | ||
SiteLinkName = $SiteLinkName | ||
SitesIncluded = $SitesIncluded | ||
Description = $Description | ||
Cost = $Cost | ||
ReplicationFrequencyInMinutes = $ReplicationFrequencyInMinutes | ||
ReplicationSchedule = $ReplicationSchedule | ||
} | ||
} | ||
} | ||
|
||
<# | ||
Sample use: | ||
$credential = Get-Credential | ||
xADSiteLink_CreateComplexScheduleSiteLink -DomainAdministratorCredential $credential -SiteLinkName 'MyNewSiteLink' -SitesIncluded @('HubSite1','HubSite2') ` | ||
-Description 'Site link between HubSite1 and HubSite2 (DSC)' -Cost 100 -ReplicationFrequencyInMinutes 15 ` | ||
-ReplicationSchedule @('Monday','Zero','Zero','Three','FortyFive','Monday','Five','Zero','Five','FortyFive','Monday','Seven','Zero','Seven','FortyFive','Monday','Nine','Zero','Fifteen','FortyFive','Monday','Seventeen','Zero','TwentyThree','FortyFive', | ||
'Tuesday','Zero','Zero','Three','FortyFive','Tuesday','Seven','Zero','Nine','FortyFive','Tuesday','Thirteen','Zero','Thirteen','FortyFive','Tuesday','Seventeen','Zero','Seventeen','FortyFive','Tuesday','Nineteen','Zero','Nineteen','FortyFive','Tuesday','TwentyOne','Zero','TwentyThree','FortyFive', | ||
'Wednesday','Zero','Zero','Three','FortyFive','Wednesday','Five','Zero','Five','FortyFive','Wednesday','Seven','Zero','Seven','FortyFive','Wednesday','Nine','Zero','Nine','FortyFive','Wednesday','Eleven','Zero','Eleven','FortyFive','Wednesday','Thirteen','Zero','Thirteen','FortyFive','Wednesday','Fifteen','Zero','Fifteen','FortyFive','Wednesday','Seventeen','Zero','Seventeen','FortyFive','Wednesday','Nineteen','Zero','Nineteen','FortyFive','Wednesday','TwentyOne','Zero','TwentyThree','FortyFive', | ||
'Thursday','Zero','Zero','Three','FortyFive','Thursday','Five','Zero','Five','FortyFive','Thursday','Seven','Zero','Seven','FortyFive','Thursday','Nine','Zero','Nine','FortyFive','Thursday','Eleven','Zero','Eleven','FortyFive','Thursday','Thirteen','Zero','Thirteen','FortyFive','Thursday','Seventeen','Zero','Seventeen','FortyFive','Thursday','TwentyOne','Zero','TwentyThree','FortyFive', | ||
'Friday','Zero','Zero','Nineteen','FortyFive','Friday','TwentyOne','Zero','TwentyThree','FortyFive', | ||
'Saturday','Zero','Zero','Seventeen','FortyFive','Saturday','TwentyOne','Zero','TwentyThree','FortyFive', | ||
'Sunday','Zero','Zero','Three','FortyFive','Sunday','Five','Zero','Five','FortyFive','Sunday','Seven','Zero','Fifteen','FortyFive','Sunday','Seventeen','Zero','TwentyThree','FortyFive') | ||
#> |
90 changes: 90 additions & 0 deletions
90
Examples/xADSiteLink/xADSiteLink_CreateDailyScheduleSiteLink.ps1
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<# | ||
.EXAMPLE | ||
This example will create a new site link with a daily replication schedule that only allows replication outside of the hours of | ||
08h30 to 18h00. | ||
The ReplicationSchedule for the xADSiteLink resource can handle 3 different types of schedule: | ||
- where replication is needed 24x7. For this scenario, specify a single string in an array as '24x7' | ||
- where replication is needed at specific times throughout the day, but every day has the same schedule. For this scenario | ||
ReplicationSchedule needs to be an array of strings in the format: | ||
@('<from hour>','<from minute>','<to hour>','<to minute>') | ||
'From' and 'to' hours need to be specified as a value between 'Zero' and 'TwentyThree'. 'From' and 'to' minutes need to be specified | ||
as one of 'Zero', 'Fifteen', 'Thirty' or 'FortyFive'. | ||
Where you need to enable multiple blocks of replication throughout the day, you can specify additional sets of from & to hours & minutes. | ||
This is shown in the sample usage section below | ||
- where replication is needed at specific times throughout the day, but each day needs a different schedule. This is covered in the | ||
xADSiteLink_CreateComplexScheduleSiteLink example | ||
The account credentials must have the necessary permissions. Without additional delegation; this would mean an account with | ||
Enterprise Admins, or Domain Admins in the forest root domain. | ||
#> | ||
|
||
configuration xADSiteLink_CreateDailyScheduleSiteLink | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential] | ||
$DomainCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[System.String] | ||
$SiteLinkName, | ||
|
||
[parameter()] | ||
[System.String] | ||
$Description, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$Cost, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ReplicationFrequencyInMinutes, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$SitesIncluded, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ChangeNotification, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$ReplicationSchedule | ||
) | ||
|
||
|
||
Import-DscResource -Name MSFT_xADSiteLink -ModuleName xActiveDirectory | ||
|
||
|
||
Node $nodeName | ||
{ | ||
xADSiteLink CreateTurboSiteLink | ||
{ | ||
Ensure = 'Present' | ||
DomainAdministratorCredential = $DomainCreds | ||
SiteLinkName = $SiteLinkName | ||
SitesIncluded = $SitesIncluded | ||
Description = $Description | ||
Cost = $Cost | ||
ReplicationFrequencyInMinutes = $ReplicationFrequencyInMinutes | ||
ReplicationSchedule = $ReplicationSchedule | ||
} | ||
} | ||
} | ||
|
||
<# | ||
Sample use: | ||
$credential = Get-Credential | ||
xADSiteLink_CreateDailyScheduleSiteLink -DomainAdministratorCredential $credential -SiteLinkName 'MyNewSiteLink' -SitesIncluded @('HubSite1','HubSite2') ` | ||
-Description 'Site link between HubSite1 and HubSite2 (DSC)' -Cost 100 -ReplicationFrequencyInMinutes 15 ` | ||
-ReplicationSchedule @('Zero','Zero','Eight','Thirty','Eighteen','Zero','TwentyThree','FortyFive') | ||
#> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<# | ||
.EXAMPLE | ||
This example will create a new site link based on best practices for organisations with modern network topology and available bandwidth | ||
who want to reduce AD replication latency. You can read more about some of these settings at: | ||
https://blogs.technet.microsoft.com/ashleymcglone/2011/06/29/report-and-edit-ad-site-links-from-powershell-turbo-your-ad-replication/ | ||
As sites have a 24x7 replication schedule by default, it is not strictly necessary to include the ReplicationSchedule item. However, | ||
this is DSC and it will ensure that the site link's schedule does not drift from the 24x7 schedule due to unauthorised manual changes. | ||
ChangeNotification is set to 5, which will enable change notification between the sites in the link and also disable compression. This | ||
will reduce CPU overhead on the bridgehead servers at the expense of network bandwidth. You can also enable change notification by setting this | ||
to 1, which will leave compression enabled. Setting ChangeNotification to 0 would disable change notification. | ||
As a best practice, a site link should contain only two sites. | ||
The account credentials must have the necessary permissions. Without additional delegation; this would mean an account with | ||
Enterprise Admins, or Domain Admins in the forest root domain. | ||
#> | ||
|
||
configuration xADSiteLink_CreateTurboSiteLink | ||
{ | ||
param | ||
( | ||
[Parameter(Mandatory)] | ||
[System.Management.Automation.PSCredential] | ||
$DomainCreds, | ||
|
||
[Parameter(Mandatory)] | ||
[System.String] | ||
$SiteLinkName, | ||
|
||
[parameter()] | ||
[System.String] | ||
$Description, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$Cost, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ReplicationFrequencyInMinutes, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$SitesIncluded, | ||
|
||
[parameter()] | ||
[System.UInt32] | ||
$ChangeNotification, | ||
|
||
[parameter()] | ||
[System.String[]] | ||
$ReplicationSchedule | ||
) | ||
|
||
|
||
Import-DscResource -Name MSFT_xADSiteLink -ModuleName xActiveDirectory | ||
|
||
|
||
Node $nodeName | ||
{ | ||
xADSiteLink CreateTurboSiteLink | ||
{ | ||
Ensure = 'Present' | ||
DomainAdministratorCredential = $DomainCreds | ||
SiteLinkName = $SiteLinkName | ||
SitesIncluded = $SitesIncluded | ||
Description = $Description | ||
Cost = $Cost | ||
ReplicationFrequencyInMinutes = $ReplicationFrequencyInMinutes | ||
ChangeNotification = $ChangeNotification | ||
ReplicationSchedule = $ReplicationSchedule | ||
} | ||
} | ||
} | ||
|
||
<# | ||
Sample use: | ||
$credential = Get-Credential | ||
xADSiteLink_CreateTurboSiteLink -DomainAdministratorCredential $credential -SiteLinkName 'MyNewSiteLink' -SitesIncluded @('HubSite1','HubSite2') ` | ||
-Description 'Site link between HubSite1 and HubSite2 (DSC)' -Cost 100 -ReplicationFrequencyInMinutes 15 -ChangeNotification 5 -ReplicationSchedule @('24x7') | ||
#> |
Oops, something went wrong.