Many times, we need to ensure whether our SQL Server service account (or any other domain account) is locked or not. Here is the command which will help us to get that confirmation for us.
For example: I would like to perform this test for account named mydomin.com\sqsqlserver.
SQL Server service account name: mydomin.com\sqsqlserver.
Imp Note: We have to logged in to domain whether our account exist as this command run on primary domain controller. I always run this command from database server which belongs to same domain.
-------------------------------------------------------------------------------------------------------
C:\Users\Chhavi>net user sqsqlserver /domain
The request will be processed at a domain controller for domain mydomin.com.
User name sqsqlserver
Full Name sqsqlserver
Comment SQL Server service account , Chhavinath Mishra
User's comment
Country/region code 000 (System Default)
Account active Locked
Account expires Never
Password last set 2015-05-07 5:41:32 AM
Password expires Never
Password changeable 2015-05-08 5:41:32 AM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon 2015-05-07 5:45:33 AM
Logon hours allowed All
Local Group Memberships *ADM_Test1
Global Group memberships *Domain Users *User_ServiceAccountNo
The command completed successfully.
For example: I would like to perform this test for account named mydomin.com\sqsqlserver.
SQL Server service account name: mydomin.com\sqsqlserver.
Imp Note: We have to logged in to domain whether our account exist as this command run on primary domain controller. I always run this command from database server which belongs to same domain.
-------------------------------------------------------------------------------------------------------
C:\Users\Chhavi>net user sqsqlserver /domain
The request will be processed at a domain controller for domain mydomin.com.
User name sqsqlserver
Full Name sqsqlserver
Comment SQL Server service account , Chhavinath Mishra
User's comment
Country/region code 000 (System Default)
Account active Locked
Account expires Never
Password last set 2015-05-07 5:41:32 AM
Password expires Never
Password changeable 2015-05-08 5:41:32 AM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon 2015-05-07 5:45:33 AM
Logon hours allowed All
Local Group Memberships *ADM_Test1
Global Group memberships *Domain Users *User_ServiceAccountNo
The command completed successfully.
Warm Regards,
Chhavinath Mishra
Sr. Specialist Database Administrator