dsregcmd is a command-line tool used on Windows operating systems primarily for managing device or user enrollment status and troubleshooting Azure Active Directory and Active Directory issues. This tool is particularly useful in environments utilizing modern managed services and is often used by IT administrators to verify and configure join statuses, work accounts, and tenant information.


The basic syntax for using the dsregcmd command is as follows:

dsregcmd [options]


  • /status: Displays the current status of the device registration and Azure AD or Active Directory join status.
  • /join: Manually triggers a join operation to Azure AD.
  • /leave: Disconnects the device from Azure AD or a local Active Directory, removing the device from management and control.
  • /debug: Enables debugging mode to provide more detailed error information, which can be useful for troubleshooting complex issues.
  • /forcerecoverykeyrotation: Forces a rotation of the BitLocker recovery key in Azure AD, which is a security measure typically employed after an administrative credential change.


  1. Check the status of device registration:

    dsregcmd /status

    This command prints out detailed information about the device’s connection to Azure AD, including user MDM (Mobile Device Management) and MAM (Mobile Application Management) enrollment statuses.

  2. Manually trigger Azure AD join:

    dsregcmd /join

    Use this to enroll a device into Azure AD, typically for new devices or devices that were unenrolled accidentally.

  3. Manually trigger leave from Azure AD:

    dsregcmd /leave

    This is used to unenroll a device from Azure AD, which may be necessary before transferring the device to a new owner or decommissioning it.

  4. Using debug mode to troubleshoot enrollment issues:

    dsregcmd /debug

    This option will offer more verbose output, helping in diagnosing problems during the join or leave operations.

Common Issues

  • Network Issues: If dsregcmd cannot reach Azure AD services, it will fail. Ensure that the device has a proper internet connection and access to Microsoft services.
  • Permission Errors: Running dsregcmd without sufficient privileges can lead to failures, especially with /join and /leave operations. Ensure you run the command prompt as an administrator.
  • Service Interruptions: Azure AD interruptions can affect dsregcmd. Verify Azure service status via the Azure Service Health dashboard if suspicions arise.


dsregcmd can be scripted with PowerShell or integrated with batch files to automate Azure AD tasks. For example, a script might periodically check the enrollment status and trigger alerts if a device becomes unenrolled:

@echo off
dsregcmd /status > status.txt
REM -- Insert script to send status.txt contents if the device is unenrolled --
  • gpupdate: Force a policy update from Group Policy.
  • netdom: Used for managing Active Directory domains and trust relationships.

For advanced usage and troubleshooting of dsregcmd, refer to the official Microsoft Documentation at Azure Active Directory documentation.