Active Directory
Useful Active Directory PowerShell commands for common administration workflows.
Group Membership
Add AD group members from one group to another:
| |
Password Reset
Prompt for password securely and reset:
| |
Example with plain text conversion:
| |
Unlock Account
| |
Check lock status:
| |
User Queries
Search AD users:
| |
View all user properties:
| |
Get all groups for a user:
| |
Find login scripts for all users and export:
| |
Setting Up Active Directory
Reference for AD domain naming best practices:
Before creating the domain, ensure time and date settings on the primary domain controller are correct.
Hybrid AD Password Reset Fix
Re-sync AD Account with Azure AD
Issues may occur when accounts are created incorrectly or are deleted and restored.
You may need to manually re-sync AD objects between on-prem AD and Azure AD using ImmutableID.
Get the account in AD and convert objectGUID to Base64:
| |
Set the ImmutableID on the Azure account:
| |
Reference: https://www.theictguy.co.uk/ad-connect-and-hard-matching-immutableid/
Domain/AD Ports
- UDP 88: Kerberos authentication.
- TCP and UDP 135: Domain controller communication and client/DC operations.
- TCP 139 and UDP 138: File Replication Service between domain controllers.
- UDP 389: LDAP queries from clients to domain controllers.
- TCP and UDP 445: Replication, authentication, and Group Policy.
- TCP and UDP 464: Kerberos password change.
- TCP 3268 and 3269: Global Catalog access.
- TCP and UDP 53: DNS traffic between clients and domain controllers.
- Ephemeral ports: TCP/UDP 1025-5000 and 49152-65535.
DHCP in Active Directory
Get all DHCP servers registered to the domain:
| |