Common command using in Active Directory

Require Change user password at next logon by selective Group:

Run the following commands in Windows PowerShell:

Get-ADGroupMember “cn=Technical Dept,ou=KLgroup,ou=KL,dc=enfrasys,dc=com” | Set-ADUser -PasswordNeverExpires $false

 

Get-ADGroupMember “cn=Technical Dept,ou=KLgroup,ou=KL,dc=enfrasys,dc=com” | Set-ADUser -ChangePasswordAtLogon $true

 

Require change user password at next logon by selective User:

Run the following commands in Windows PowerShell:

Set-ADUser -Identity Trevor -PasswordNeverExpires $false

 

Set-ADUser -Identity Trevor -ChangePasswordAtNextLogon $true

 

 

List Active Directory Group member users:

Run the following command in Windows PowerShell:

Get-ADGroupMember “cn=Technical Dept,ou=KLgroup,ou=KL,dc=enfrasys,dc=com”

 

List Domain Controller(s) in a Domain:

Run the following command in Windows PowerShell:

Netdom query /d:enfrasys.com dc

 

 

Note to verify for above command:

cn=Technical Dept, – this is name of the Group of users in my domain

ou=KLgroup,ou=KL,dc=enfrasys,dc=com – this is the OU path in domain.

Share this post

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on print
Share on email

Recent News

Close Menu
Bitnami