Description: An example showing how device control can restrict access to printers based on device properties, network, and VPN connection.
Device Type: Windows Printer
A device control policy is a combination of policy rules, groups and settings.
This sample is based on the sample files.
To configure the sample, follow the deployment instructions.
Name | Devices | Rule Type | Access | Notification | Conditions | |
---|---|---|---|---|---|---|
Included | Excluded | |||||
Allow PDF and XPS Printing |
|
|
Allow | ✅ | None (0) | - |
Audit Allowed | 📄 | Send event (2) | - | |||
Allow approved USB Printer |
|
|
Allow | ✅ | None (0) | |
Audit Allowed | 📄 | Send event (2) | - | |||
Default Deny |
|
|
Audit Denied | 📄 | Show notification and Send event (3) | - |
This is a group of type Device. The match type for the group is MatchAny.
Property | Value |
---|---|
PrinterConnectionId | File |
View XML
<Group Id="{e5170dfb-19a9-4466-8109-d36c9c912b4e}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7Be5170dfb-19a9-4466-8109-d36c9c912b4e%7D/GroupData -->
<Name>PDF_XPS Printer</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<PrinterConnectionId>File</PrinterConnectionId>
</DescriptorIdList>
</Group>
This is a group of type Device. The match type for the group is MatchAny.
Property | Value |
---|---|
VID_PID | 03F0_ |
VID_PID | 035E_0872 |
View XML
<Group Id="{05b56e90-e682-48ff-a6c0-5602c9638182}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B05b56e90-e682-48ff-a6c0-5602c9638182%7D/GroupData -->
<Name>Authorized USB Printer</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<VID_PID>03F0_</VID_PID>
<VID_PID>035E_0872</VID_PID>
</DescriptorIdList>
</Group>
This is a group of type Network. The match type for the group is MatchAll.
Property | Value |
---|---|
NameId | corp.microsoft.com |
NetworkCategoryId | DomainAuthenticated |
View XML
<Group Id="{83d4b74a-af7c-4399-812c-fb9037e2c2b7}" Type="Network">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B83d4b74a-af7c-4399-812c-fb9037e2c2b7%7D/GroupData -->
<Name>Corporate Network</Name>
<MatchType>MatchAll</MatchType>
<DescriptorIdList>
<NameId>corp.microsoft.com</NameId>
<NetworkCategoryId>DomainAuthenticated</NetworkCategoryId>
</DescriptorIdList>
</Group>
This is a group of type VPNConnection. The match type for the group is MatchAll.
Property | Value |
---|---|
NameId | MSFTVPN |
VPNServerAddressId | msftvpn.*.microsoft.com |
VPNDnsSuffixId | corp.microsoft.com |
VPNConnectionStatusId | Connected |
View XML
<Group Id="{d633d17d-d1d1-4c73-aa27-c545c343b6d7}" Type="VPNConnection">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7Bd633d17d-d1d1-4c73-aa27-c545c343b6d7%7D/GroupData -->
<Name>Corporate VPN</Name>
<MatchType>MatchAll</MatchType>
<DescriptorIdList>
<NameId>MSFTVPN</NameId>
<VPNServerAddressId>msftvpn.*.microsoft.com</VPNServerAddressId>
<VPNDnsSuffixId>corp.microsoft.com</VPNDnsSuffixId>
<VPNConnectionStatusId>Connected</VPNConnectionStatusId>
</DescriptorIdList>
</Group>
Setting Name | Setting Value | Description | Documentation |
---|---|---|---|
DefaultEnforcement | Deny | Control Device Control default enforcement. This is the enforcement applied if there are no policy rules present or at the end of the policy rules evaluation none were matched. | documentation |
DeviceControlEnabled | True | Enables/disables device control | documentation |
This policy is based on information in the following files:
- Group Policy/Printer_Groups.xml
- Group Policy/Printer_Policies.xml
- Intune OMA-URI/PDF_XPS Printer.xml
Device control policy rules and groups can be deployed through the following management tools:
Intune UX is not supported for this policy because:
- Windows VPN Connection groups not supported.
- Windows Network groups not supported.
- Parameters are not supported
Use Intune custom settings to deploy the policy instead.
Define device control policy groups
- Go to Computer Configuration > Administrative Templates > Windows Components > Microsoft Defender Antivirus > Device Control > Define device control policy groups.
- Save the XML below to a network share.
<Groups>
<Group Id="{e5170dfb-19a9-4466-8109-d36c9c912b4e}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7Be5170dfb-19a9-4466-8109-d36c9c912b4e%7D/GroupData -->
<Name>PDF_XPS Printer</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<PrinterConnectionId>File</PrinterConnectionId>
</DescriptorIdList>
</Group>
<Group Id="{05b56e90-e682-48ff-a6c0-5602c9638182}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B05b56e90-e682-48ff-a6c0-5602c9638182%7D/GroupData -->
<Name>Authorized USB Printer</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<VID_PID>03F0_</VID_PID>
<VID_PID>035E_0872</VID_PID>
</DescriptorIdList>
</Group>
<Group Id="{83d4b74a-af7c-4399-812c-fb9037e2c2b7}" Type="Network">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B83d4b74a-af7c-4399-812c-fb9037e2c2b7%7D/GroupData -->
<Name>Corporate Network</Name>
<MatchType>MatchAll</MatchType>
<DescriptorIdList>
<NameId>corp.microsoft.com</NameId>
<NetworkCategoryId>DomainAuthenticated</NetworkCategoryId>
</DescriptorIdList>
</Group>
<Group Id="{d633d17d-d1d1-4c73-aa27-c545c343b6d7}" Type="VPNConnection">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7Bd633d17d-d1d1-4c73-aa27-c545c343b6d7%7D/GroupData -->
<Name>Corporate VPN</Name>
<MatchType>MatchAll</MatchType>
<DescriptorIdList>
<NameId>MSFTVPN</NameId>
<VPNServerAddressId>msftvpn.*.microsoft.com</VPNServerAddressId>
<VPNDnsSuffixId>corp.microsoft.com</VPNDnsSuffixId>
<VPNConnectionStatusId>Connected</VPNConnectionStatusId>
</DescriptorIdList>
</Group>
</Groups>
- In the Define device control policy groups window, select Enabled and specify the network share file path containing the XML groups data.
Define device control policy rules
- Go to Computer Configuration > Administrative Templates > Windows Components > Microsoft Defender Antivirus > Device Control > Define device control policy rules.
- Save the XML below to a network share.
<PolicyRules>
<PolicyRule Id="{f5877f47-78ab-4f33-94e4-c44f18ec6dca}" >
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Bf5877f47-78ab-4f33-94e4-c44f18ec6dca%7D/RuleData -->
<Name>Allow PDF and XPS Printing</Name>
<IncludedIdList>
<GroupId>{e5170dfb-19a9-4466-8109-d36c9c912b4e}</GroupId>
</IncludedIdList>
<ExcludedIdList>
</ExcludedIdList>
<Entry Id="{12bd5f8e-94e8-4205-a990-635c24e43c59}">
<Type>Allow</Type>
<AccessMask>64</AccessMask>
<Options>0</Options>
</Entry>
<Entry Id="{0fef09f8-7a68-4827-841b-d48afef6ba4c}">
<Type>AuditAllowed</Type>
<AccessMask>64</AccessMask>
<Options>2</Options>
</Entry>
</PolicyRule>
<PolicyRule Id="{f7e75634-7eec-4e67-bec5-5e7750cb9e02}" >
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Bf7e75634-7eec-4e67-bec5-5e7750cb9e02%7D/RuleData -->
<Name>Allow approved USB Printer</Name>
<IncludedIdList>
<GroupId>{05b56e90-e682-48ff-a6c0-5602c9638182}</GroupId>
</IncludedIdList>
<ExcludedIdList>
</ExcludedIdList>
<Entry Id="{27c79875-25d2-4765-aec2-cb2d1000613f}">
<Type>Allow</Type>
<AccessMask>64</AccessMask>
<Options>0</Options>
<Parameters MatchType="MatchAny">
<Network MatchType="MatchAny">
<GroupId>{83d4b74a-af7c-4399-812c-fb9037e2c2b7}</GroupId>
</Network>
<VPNConnection MatchType="MatchAny">
<GroupId>{d633d17d-d1d1-4c73-aa27-c545c343b6d7}</GroupId>
</VPNConnection>
</Parameters>
</Entry>
<Entry Id="{b280c2bf-ca5d-46a1-afc9-7e34d8098ca7}">
<Type>AuditAllowed</Type>
<AccessMask>64</AccessMask>
<Options>2</Options>
</Entry>
</PolicyRule>
<PolicyRule Id="{e6ccf2cb-20d6-4478-bf2d-66f247ced6f3}" >
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Be6ccf2cb-20d6-4478-bf2d-66f247ced6f3%7D/RuleData -->
<Name>Default Deny</Name>
<IncludedIdList>
</IncludedIdList>
<ExcludedIdList>
</ExcludedIdList>
<Entry Id="{6b9cf286-ec70-4463-bfaf-29f32bb5f0dc}">
<Type>AuditDenied</Type>
<AccessMask>64</AccessMask>
<Options>3</Options>
</Entry>
</PolicyRule>
</PolicyRules>
- In the Define device control policy rules window, select Enabled, and enter the network share file path containing the XML rules data.
Create custom intune configuration
- Navigate to Devices > Configuration profiles
- Click Create (New Policy)
- Select Platform "Windows 10 and Later"
- Select Profile "Templates"
- Select Template Name "Custom"
- Click "Create"
- Under Name, enter **
- Optionally, enter a description
- Click "Next"
Add a row for Allow PDF and XPS Printing
-
Click "Add"
-
For Name, enter Allow PDF and XPS Printing
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Bf5877f47-78ab-4f33-94e4-c44f18ec6dca%7D/RuleData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/allow_pdf_and_xps_printing{f5877f47-78ab-4f33-94e4-c44f18ec6dca}.xml
-
Click "Save"
Add a row for Allow approved USB Printer
-
Click "Add"
-
For Name, enter Allow approved USB Printer
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Bf7e75634-7eec-4e67-bec5-5e7750cb9e02%7D/RuleData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/allow_approved_usb_printer{f7e75634-7eec-4e67-bec5-5e7750cb9e02}.xml
-
Click "Save"
Add a row for Default Deny
-
Click "Add"
-
For Name, enter Default Deny
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Be6ccf2cb-20d6-4478-bf2d-66f247ced6f3%7D/RuleData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/default_deny{e6ccf2cb-20d6-4478-bf2d-66f247ced6f3}.xml
-
Click "Save"
Add a row for PDF_XPS Printer
-
Click "Add"
-
For Name, enter PDF_XPS Printer
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7Be5170dfb-19a9-4466-8109-d36c9c912b4e%7D/GroupData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/PDF_XPS Printer.xml
-
Click "Save"
Add a row for Authorized USB Printer
-
Click "Add"
-
For Name, enter Authorized USB Printer
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B05b56e90-e682-48ff-a6c0-5602c9638182%7D/GroupData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/Authorized USB Printer.xml
-
Click "Save"
Add a row for Corporate Network
-
Click "Add"
-
For Name, enter Corporate Network
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B83d4b74a-af7c-4399-812c-fb9037e2c2b7%7D/GroupData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/Corporate Network.xml
-
Click "Save"
Add a row for Corporate VPN
-
Click "Add"
-
For Name, enter Corporate VPN
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7Bd633d17d-d1d1-4c73-aa27-c545c343b6d7%7D/GroupData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/printer/Intune OMA-URI/Corporate VPN.xml
-
Click "Save"
Add a row for DefaultEnforcement
-
Click "Add"
-
For Name, enter DefaultEnforcement
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DefaultEnforcement
-
For Data type, select Integer
-
For Value, enter 2
-
Click "Save"
Add a row for DeviceControlEnabled
-
Click "Add"
-
For Name, enter DeviceControlEnabled
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControlEnabled
-
For Data type, select Integer
-
For Value, enter 1
-
Click "Save"