Skip to content

Instantly share code, notes, and snippets.

@hpaul-osi
Last active December 19, 2017 20:47
Show Gist options
  • Save hpaul-osi/0b07765c86e526bf1c6839f0f303bd45 to your computer and use it in GitHub Desktop.
Save hpaul-osi/0b07765c86e526bf1c6839f0f303bd45 to your computer and use it in GitHub Desktop.
DSC Configuration which enables virtualization based security features in Windows Server 2016 via Registry keys.
Configuration EnableVBSFeatures
{
param(
[System.String]
$NodeName = 'localhost'
)
Import-DSCResource -ModuleName 'PSDesiredStateConfiguration'
Node $NodeName
{
#region Enable Device Guard
# https://docs.microsoft.com/en-us/windows/device-security/device-guard/deploy-device-guard-enable-virtualization-based-security
$DGRegistryKey = 'HKLM\SYSTEM\CurrentControlSet\Control\DeviceGuard'
Registry "$DGRegistryKey\EnableVirtualizationBasedSecurity"
{
Ensure = 'Present'
Key = $DGRegistryKey
ValueName = 'EnableVirtualizationBasedSecurity'
ValueData = 1
ValueType = 'DWORD'
}
Registry "$DGRegistryKey\RequirePlatformSecurityFeatures"
{
Ensure = 'Present'
Key = $DGRegistryKey
ValueName = 'RequirePlatformSecurityFeatures'
ValueData = 1
ValueType = 'DWORD'
}
Registry "$DGRegistryKey\Locked"
{
Ensure = 'Present'
Key = $DGRegistryKey
ValueName = 'Locked'
ValueData = 0
ValueType = 'DWORD'
}
#endregion
#region HVCI
$HVCIRegistryKey = $DGRegistryKey + '\Scenarios\HypervisorEnforcedCodeIntegrity'
Registry "$HVCIRegistryKey\Enabled"
{
Ensure = 'Present'
Key = $DGRegistryKey
ValueName = 'Enabled'
ValueData = 1
ValueType = 'DWORD'
}
Registry "$HVCIRegistryKey\Locked"
{
Ensure = 'Present'
Key = $DGRegistryKey
ValueName = 'Locked'
ValueData = 0
ValueType = 'DWORD'
}
#endregion
#region Enable Credential Guard
# https://docs.microsoft.com/en-us/windows/access-protection/credential-guard/credential-guard-manage
$LSARegistryKey = 'HKLM\SYSTEM\CurrentControlSet\Control\LSA'
Registry "$LSARegistryKey\LsaCfgFlags"
{
Ensure = 'Present'
Key = $LSARegistryKey
ValueName = 'LsaCfgFlags'
ValueData = 1
ValueType = 'DWORD'
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment