Unfortunately, there isn't a built-in way in Group Policy or Intune to automatically revoke USB access after a specific period of inactivity for Windows 10.
You can also use the PowerShell command Get-ADUser -filter * -Properties "LastLogonDate" | select name, LastLogonDate
to get the last logon date for all domain users.
If the difference is greater than 3 months (convert to desired timeframe in seconds), the script re-enables USB access for that user by disabling the "Do not allow mass storage devices" policy usingSet-ItemProperty
.
Save the PowerShell script.
Use Task Scheduler to schedule the script to run periodically.