Skip to content

Commit

Permalink
Merge pull request #1286 from ministryofjustice/dave/tm-988-vss-backu…
Browse files Browse the repository at this point in the history
…ps-for-dc-and-rdl

TM-988: vss-backups-for-dc-and-rdl
  • Loading branch information
davekentmoj authored Feb 25, 2025
2 parents fa4325a + 5c26db0 commit b92de78
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if (Add-ModPlatformADComputer -ModPlatformADConfig $ADConfig -ModPlatformADCrede
}

$DFSReplicationStatus = Get-Service "DFS Replication" -ErrorAction SilentlyContinue
if ($DFSReplicationStatus -eq $null) {
if ($null -eq $DFSReplicationStatus) {
$ADAdminCredential = Get-ModPlatformADAdminCredential -ModPlatformADConfig $ADConfig -ModPlatformADSecret $ADSecret
$ADSafeModeAdministratorPassword = Get-ModPlatformADSafeModeAdministratorPassword -ModPlatformADConfig $ADConfig -ModPlatformADSecret $ADSecret
Install-WindowsFeature -Name AD-Domain-Services -IncludeAllSubFeature -IncludeManagementTools
Expand Down
15 changes: 15 additions & 0 deletions powershell/Scripts/UserDataScripts/DomainController.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,18 @@
if ($LASTEXITCODE -ne 0) {
Exit $LASTEXITCODE
}

# Get the InstanceId
$Token = Invoke-RestMethod -TimeoutSec 10 -Headers @{"X-aws-ec2-metadata-token-ttl-seconds"=3600} -Method PUT -Uri http://169.254.169.254/latest/api/token
$InstanceId = Invoke-RestMethod -TimeoutSec 10 -Headers @{"X-aws-ec2-metadata-token" = $Token} -Method GET -Uri http://169.254.169.254/latest/meta-data/instance-id

# Install the AWS VSS Components via SSM
$documentName = "AWS-ConfigureAWSPackage"
$parameters = @{
"action" = "Install"
"name" = "AwsVssComponents"
}
Send-SSMCommand -InstanceId $instanceId -DocumentName $documentName -Parameters $parameters

# Install the Cloudwatch Agent with out baseline config
. ../AmazonCloudWatchAgent/Install-AmazonCloudWatchAgent.ps1
15 changes: 15 additions & 0 deletions powershell/Scripts/UserDataScripts/RDLicensing.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,18 @@ Install-WindowsFeature RDS-Licensing -IncludeAllSubFeature -IncludeManagementToo
Import-Module ModPlatformRemoteDesktop -Force
$CompanyInformation = Get-ModPlatformRDLicensingCompanyInformation
Add-ModPlatformRDLicensingActivation $CompanyInformation

# Get the InstanceId
$Token = Invoke-RestMethod -TimeoutSec 10 -Headers @{"X-aws-ec2-metadata-token-ttl-seconds"=3600} -Method PUT -Uri http://169.254.169.254/latest/api/token
$InstanceId = Invoke-RestMethod -TimeoutSec 10 -Headers @{"X-aws-ec2-metadata-token" = $Token} -Method GET -Uri http://169.254.169.254/latest/meta-data/instance-id

# Install the AWS VSS Components via SSM
$documentName = "AWS-ConfigureAWSPackage"
$parameters = @{
"action" = "Install"
"name" = "AwsVssComponents"
}
Send-SSMCommand -InstanceId $instanceId -DocumentName $documentName -Parameters $parameters

# Install the Cloudwatch Agent with out baseline config
. ../AmazonCloudWatchAgent/Install-AmazonCloudWatchAgent.ps1

0 comments on commit b92de78

Please sign in to comment.