What is dsmgr and how to use it?
dsmgr is a command-line tool that allows you to manage devices that are registered with Azure Active Directory (Azure AD). You can use dsmgr to perform various tasks, such as:
Dsmgr
What is dsmgr and how to use it?
dsmgr is a command-line tool that allows you to manage devices that are registered with Azure Active Directory (Azure AD). You can use dsmgr to perform various tasks, such as:
Dsmgr
View the device registration status and details.
Join or leave a device from Azure AD.
Reset the device registration state.
Enable or disable device management features, such as Windows Hello for Business or Enterprise State Roaming.
dsmgr is available on Windows 10 devices that are Azure AD joined, hybrid Azure AD joined, or Azure AD registered. You can run dsmgr from an elevated command prompt or PowerShell window. To open an elevated command prompt, right-click the Start button and select Command Prompt (Admin). To open an elevated PowerShell window, right-click the Start button and select Windows PowerShell (Admin).
How to use dsmgr?
To use dsmgr, you need to specify one or more parameters that indicate the action you want to perform. The general syntax of dsmgr is:
dsmgr /parameter1:value1 /parameter2:value2 ...
The following table lists some of the most common parameters and values that you can use with dsmgr:
Parameter
Value
Description
/status
N/A
Displays the device registration status and details, such as the device ID, tenant ID, user ID, domain name, and device management features.
/join
AAD AADJ Hybrid Workplace
Joins the device to Azure AD, Azure AD Join, hybrid Azure AD Join, or Azure AD registered (Workplace Join), respectively. You need to provide your credentials when prompted.
/leave
AAD AADJ Hybrid Workplace
Leaves the device from Azure AD, Azure AD Join, hybrid Azure AD Join, or Azure AD registered (Workplace Join), respectively. You need to provide your credentials when prompted.
/debug
N/A
Enables debug mode and generates a log file (dsregcmd.log) in the current directory.
/leave /forget
N/A
Leaves the device from Azure AD and removes the device object from Azure AD. You need to provide your credentials when prompted.
Examples of using dsmgr
The following are some examples of how to use dsmgr for different scenarios:
To view the device registration status and details, run:
dsmgr /status
To join the device to Azure AD Join, run:
dsmgr /join:AADJ
To leave the device from hybrid Azure AD Join, run:
dsmgr /leave:Hybrid
To enable Windows Hello for Business on the device, run:
dsmgr /deviceManagement:enable /deviceManagementFeature:WHFBKeyTrust
To disable Enterprise State Roaming on the device, run:
dsmgr /deviceManagement:disable /deviceManagementFeature:ESR
References
For more information about dsmgr and its parameters and values, you can refer to the following sources:
[Troubleshoot devices by using the dsregcmd command]
[Dsregcmd command-line reference](https://docs.microsoft.com/en-us/windows/security/identity-protection/hello-for-business/dsregcmd)
a104e7fe7e