Description: Prevent Write and Execute access to all but allow specific approved USBs
Device Type: Windows Removable Device
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 | Disk Read | Disk Write | Disk Execute | File Read | File Write | File Execute | ||||
Audit Write and Execute access to aproved USBs |
|
|
Allow | - | ✅ | ✅ | - | ✅ | ✅ | None (0) | - |
Audit Allowed | - | 📄 | 📄 | - | 📄 | 📄 | Send event (2) | - | |||
Block Write and Execute Access |
|
|
Deny | - | ❌ | ❌ | - | - | - | None (0) | - |
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 |
---|---|
InstancePathId | USBSTOR\DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00\03003324080520232521&0 |
View XML
<Group Id="{65fa649a-a111-4912-9294-fb6337a25038}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B65fa649a-a111-4912-9294-fb6337a25038%7D/GroupData -->
<Name>Approved USBs Group_1</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<InstancePathId>USBSTOR\DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00\03003324080520232521&0</InstancePathId>
</DescriptorIdList>
</Group>
This is a group of type Device. The match type for the group is MatchAny.
Property | Value |
---|---|
PrimaryId | RemovableMediaDevices |
PrimaryId | CdRomDevices |
PrimaryId | WpdDevices |
View XML
<Group Id="{9b28fae8-72f7-4267-a1a5-685f747a7146}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B9b28fae8-72f7-4267-a1a5-685f747a7146%7D/GroupData -->
<Name>Any Removable Storage and CD-DVD and WPD Group_1</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<PrimaryId>RemovableMediaDevices</PrimaryId>
<PrimaryId>CdRomDevices</PrimaryId>
<PrimaryId>WpdDevices</PrimaryId>
</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/Approved USBs Group.xml
- Group Policy/Any Removable Storage and CD-DVD and WPD Group.xml
- Group Policy/Scenario 1 GPO Policy - Prevent Write and Execute access to all but allow specific approved USBs.xml
Device control policy rules and groups can be deployed through the following management tools:
Intune UX is not supported for this policy because:
- File Write (16) is an unsupported access mask
- File Execute (32) is an unsupported access mask
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="{65fa649a-a111-4912-9294-fb6337a25038}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B65fa649a-a111-4912-9294-fb6337a25038%7D/GroupData -->
<Name>Approved USBs Group_1</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<InstancePathId>USBSTOR\DISK&VEN__USB&PROD__SANDISK_3.2GEN1&REV_1.00\03003324080520232521&0</InstancePathId>
</DescriptorIdList>
</Group>
<Group Id="{9b28fae8-72f7-4267-a1a5-685f747a7146}" Type="Device">
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B9b28fae8-72f7-4267-a1a5-685f747a7146%7D/GroupData -->
<Name>Any Removable Storage and CD-DVD and WPD Group_1</Name>
<MatchType>MatchAny</MatchType>
<DescriptorIdList>
<PrimaryId>RemovableMediaDevices</PrimaryId>
<PrimaryId>CdRomDevices</PrimaryId>
<PrimaryId>WpdDevices</PrimaryId>
</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="{36ae1037-a639-4cff-946b-b36c53089a4c}" >
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7B36ae1037-a639-4cff-946b-b36c53089a4c%7D/RuleData -->
<Name>Audit Write and Execute access to aproved USBs</Name>
<IncludedIdList>
<GroupId>{65fa649a-a111-4912-9294-fb6337a25038}</GroupId>
</IncludedIdList>
<ExcludedIdList>
</ExcludedIdList>
<Entry Id="{a0bcff88-b8e4-4f48-92be-16c36adac930}">
<Type>Allow</Type>
<AccessMask>54</AccessMask>
<Options>0</Options>
</Entry>
<Entry Id="{4a17df0b-d89d-430b-9cbe-8e0721192281}">
<Type>AuditAllowed</Type>
<AccessMask>54</AccessMask>
<Options>2</Options>
</Entry>
</PolicyRule>
<PolicyRule Id="{c544a991-5786-4402-949e-a032cb790d0e}" >
<!-- ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Bc544a991-5786-4402-949e-a032cb790d0e%7D/RuleData -->
<Name>Block Write and Execute Access</Name>
<IncludedIdList>
<GroupId>{9b28fae8-72f7-4267-a1a5-685f747a7146}</GroupId>
</IncludedIdList>
<ExcludedIdList>
<GroupId>{65fa649a-a111-4912-9294-fb6337a25038}</GroupId>
</ExcludedIdList>
<Entry Id="{f8ddbbc5-8855-4776-a9f4-ee58c3a21414}">
<Type>Deny</Type>
<AccessMask>6</AccessMask>
<Options>0</Options>
</Entry>
<Entry Id="{07e22eac-8b01-4778-a567-a8fa6ce18a0c}">
<Type>AuditDenied</Type>
<AccessMask>6</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 Audit Write and Execute access to aproved USBs
-
Click "Add"
-
For Name, enter Audit Write and Execute access to aproved USBs
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7B36ae1037-a639-4cff-946b-b36c53089a4c%7D/RuleData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/device/Intune OMA-URI/audit_write_and_execute_access_to_aproved_usbs{36ae1037-a639-4cff-946b-b36c53089a4c}.xml
-
Click "Save"
Add a row for Block Write and Execute Access
-
Click "Add"
-
For Name, enter Block Write and Execute Access
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyRules/%7Bc544a991-5786-4402-949e-a032cb790d0e%7D/RuleData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/device/Intune OMA-URI/block_write_and_execute_access{c544a991-5786-4402-949e-a032cb790d0e}.xml
-
Click "Save"
Add a row for Approved USBs Group_0
-
Click "Add"
-
For Name, enter Approved USBs Group_0
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B65fa649a-a111-4912-9294-fb6337a25038%7D/GroupData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/device/Intune OMA-URI/Approved USBs Group.xml
-
Click "Save"
Add a row for Any Removable Storage and CD-DVD and WPD Group_0
-
Click "Add"
-
For Name, enter Any Removable Storage and CD-DVD and WPD Group_0
-
For Description, enter **
-
For OMA-URI, enter ./Vendor/MSFT/Defender/Configuration/DeviceControl/PolicyGroups/%7B9b28fae8-72f7-4267-a1a5-685f747a7146%7D/GroupData
-
For Data type, select String (XML File)
-
For Custom XML, select windows/device/Intune OMA-URI/Any Removable Storage and CD-DVD and WPD Group.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"