Windows 10 Security: Device Guard and Credential Guard – Part 2

This part two of a blog about Device Guard. For part one, which configures only Credential Guard, see this post: Windows 10 Security: Device Guard and Credential Guard – Part 1 – (

In this part, we are going to configure a Device Guard rule. Device Guard rules protect your machine from un-verified code. Device Guard, like Credential Guard, runs from a protected Hyper-V container, ensuring that your devices remain from malware.

Enabling Device Guard

At the end of part one, we configured Credential Guard using this registry key:


To enable Device Guard, set the middle selection box to “Enabled without Lock”.


Next, you need feed the setting “Deploy Code Integrity Policy” a policy. This policy can be in a .bin format (unsigned file) or a .p7 format (signed file). Open this setting, and type in the path and file name. The file can exist on the local computer, or a network share.


Create Device Guard Policy

Creating a Device Guard policy is pretty simple, actually. You start with a gold master. This master should have the software that can run installed on it, and only that software. From this computer, run this series of PowerShell commands. The path in lines three and four must exist prior to executing those commands. The commands will not create the path, and will error if its not there.

$dg_policy = “c:\dg\dg_policy.xml”

$dg_policyBIN = “c:\dg\dg_policy.bin”

new-cipolicy -level pcacertificate -filepath $dg_policy -userpes

convertfrom-cipolicy $dg_policy $dg_policyBIN

Note that the new-cipolicy step takes quite a while to run. After it completes, you should have your BIN file at C:\dg.

Remember that a device can only have one policy applied to it. I recommend keeping your gold master in a VM that you power on and regenerate this policy if needed. It is possible to merge policies, but that is out of the scope of this post. Additional documentation is available here:


All content provided on this blog is for information purposes only. Windows Management Experts, Inc makes no representation as to accuracy or completeness of any information on this site. Windows Management Experts, Inc will not be liable for any errors or omission in this information nor for the availability of this information. It is highly recommended that you consult one of our technical consultants, should you need any further assistance.



Contact Us

On Key

More Posts

WME Cybersecurity Briefings No. 004
Cyber Security

WME Security Briefing 11 April 2024

Mispadu Trojan Exploits Windows Vulnerability to Target Financial Data Overview The Mispadu banking trojan has intensified its operations as it’s exploiting an already patched Windows SmartScreen flaw. Since its initial identification in 2019, Mispadu has primarily preyed on

Read More »
WME Cybersecurity Briefings No. 003
Cyber Security

WME Security Briefing 29 March 2024

Russian hackers escalating their cyber warfare, deploying TinyTurla-NG to breach European NGOs. Cisco Talos reveals a targeted attack against organizations advocating democracy and supporting Ukraine. With their sophisticated methods, these cyber attackers are bypassing antivirus defenses

Read More »
Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.