
PowerShell Basics: AD User Information
Below is a list of basic PowerShell scripts to run for functions within an on-premise Active Directory environment. These are simple but useful tools to have.
My favorite, and the most useful daily script is checking the users basic info. Handy if you get the typical “I’m having issues logging in” after a long holiday.
Run PowerShell as admin:
net user dave.test /domain
The exports a nice list of important user account items such as password expiration, last time password was updated, group membership and more.
Example output:
PS C:\Windows\system32> net user dave.test /domain
User name dave.test
Full Name Dave Test
Comment Dave Testing SSO
User's comment
Country/region code 000 (System Default)
Account active Yes
Account expires Never
Password last set 5/16/2024 12:28:13 PM
Password expires Never
Password changeable 5/16/2024 12:28:13 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon 4/9/2024 10:55:06 AM
Logon hours allowed All
Local Group Memberships
Global Group memberships *intune-apps-base *docusign-users
*linkedin-learning *rapid7-users
*Domain Users *azure-intune-users
*azuresync *Domain Admins
The command completed successfully.
Hope you find this helpful!
Categories
Recent Posts
- PowerShell: How to Add an Alias to Every Users Mailbox and Groups in Microsoft 365
- Slack: Disable Entra ID User using a slash command.
- Slack: Retrieve Entra ID (MS365) User Information with a slash command.
- Jira Cloud: Disabling Entra ID User Accounts via Automation and Microsoft Runbook
- Jira Cloud: Restart an Azure VM using JSM Assets and Automation