A help-desk analyst asks why a newly hired employee cannot reach a shared folder. One possibility is a disabled account; another is missing group membership, and a third is that the user can authenticate but the file permissions do not allow access. Opening Active Directory Users and Computers and clicking through several dialogs may reveal the answer, but a small set of read-only PowerShell commands can establish the facts much faster.
The six Active Directory cmdlets below cover user records, computer objects, group membership, stale-account discovery and one carefully controlled user-attribute change. They work with Active Directory Domain Services (AD DS) through the Windows PowerShell ActiveDirectory module; they are not generic Microsoft Entra ID commands. Examples use fictitious accounts, computer names and groups. Test them in an authorized directory environment and change identifiers to match your own domain.
Prepare the shell and choose a safe search boundary
The Active Directory module is available through appropriate Windows administrative tooling, including RSAT, or on management hosts where the feature is installed. Load it with Import-Module ActiveDirectory, confirm domain connectivity and use an account with appropriate read permissions. Most reporting tasks need no elevated write privilege. For a multi-domain forest, specify an appropriate -Server or -SearchBase when the default directory scope is not the one you intend to inspect.
Start with a small organizational unit or a named object rather than returning the entire forest. Avoid exposing personal information in tickets or exported reports: a display name and account status may be sufficient when an incident does not require email addresses, employee IDs or group inventories. Each command’s output is a point-in-time observation, not an automatic instruction to change an account.
1. Get-ADUser: inspect an account and its directory attributes
Get-ADUser returns a user object by identity or search criteria. A common mistake is assuming that every useful property appears in the default output. Ask explicitly for the attributes you need, then select only those columns for a ticket or report.
Get-ADUser -Identity 'jdoe' -Properties Department,Enabled,LastLogonDate |
Select-Object SamAccountName,Department,Enabled,LastLogonDate
This is a sensible first check when an onboarding request claims the account is active but an application cannot authenticate. A disabled directory account is a finding; a successful directory lookup is not evidence that the user’s password, conditional access, application assignment or network path is correct. LastLogonDate is a convenient calculated value based on replicated information and should not be interpreted as a precise security-audit timestamp. For sensitive investigations, consult the relevant domain-controller and authentication logs.
2. Get-ADComputer: inventory devices before taking action
Get-ADComputer returns computer accounts, which lets you compare inventory records with the devices that actually belong to the domain. Filter by a meaningful naming pattern or a dedicated organizational unit rather than running a forest-wide query with unnecessary attributes.
Get-ADComputer -Filter 'Name -like "LAP-*"' -Properties OperatingSystem,LastLogonDate |
Select-Object Name,OperatingSystem,LastLogonDate
In this fictional example, the result provides a starting list of laptop account objects. Use it to investigate stale device records, operating-system reporting or mismatches between the asset database and directory. Do not automatically delete computers that appear inactive: replication, offline devices, imaging workflows and incomplete logon data can all change the interpretation. Correlate the directory record with endpoint management and device ownership before decommissioning anything.
3. Get-ADGroupMember: find who belongs to a particular group
Get-ADGroupMember answers a group-centered question: which principals are members of a named AD group? This is useful when investigating access to a shared folder or reviewing an administrative role. The -Recursive switch expands membership through nested groups, but the report still needs context because directory membership is not identical to effective file, application or cloud permissions.
Get-ADGroupMember -Identity 'Finance-Readers' -Recursive |
Select-Object Name,SamAccountName,ObjectClass
Read the output by object class. A nested group, a user and a computer can have different meanings for downstream authorization. If a person can still read the folder after you remove a membership, investigate other groups, direct ACL entries, token refresh and application-specific authorization. A group listing should inform troubleshooting; it is not a guarantee of effective access. During an audit, compare the group identifier as well as its friendly display name: names can be renamed, and duplicate or similar labels across domains can mislead a ticket investigation. If there are nested groups, preserve enough context to reconstruct which membership path grants the relationship instead of exporting only an undifferentiated list of names.
4. Get-ADPrincipalGroupMembership: inspect membership from the user’s side
Get-ADPrincipalGroupMembership reverses the direction of the previous query. Instead of asking who belongs to Finance-Readers, it asks which Active Directory groups contain a specified principal. This makes it a useful companion to Get-ADGroupMember during onboarding, transfers and permission reviews.
Get-ADPrincipalGroupMembership -Identity 'jdoe' |
Select-Object Name,GroupScope,GroupCategory
Run this after confirming the person’s account identity; common display names are not unique enough for safe administration. Microsoft documents a global-catalog dependency for this command, so directory topology and permissions can affect results. Remember that indirect memberships, resource-domain local groups and effective access require additional investigation. Treat the output as directory group evidence, not as a complete record of every permission the user has.
5. Search-ADAccount: produce a review list of inactive accounts
Search-ADAccount supports purpose-built account status searches. A review of accounts with no recent observed activity is a good example of why finding potential candidates and performing a change must be separate steps.
Search-ADAccount -AccountInactive -TimeSpan '90.00:00:00' -UsersOnly |
Select-Object Name,SamAccountName,Enabled
The ninety-day window is an example for investigation, not a universal lifecycle policy. An account may represent a leave of absence, a service identity, a rarely used break-glass identity or an employee whose login attributes have not replicated as expected. Decide which populations and exceptions belong in the review before making policy decisions. Confirm with HR or system owners and current authentication evidence; do not pipe the output directly into disabling or removal commands.
6. Set-ADUser: preview a narrowly scoped attribute change
Set-ADUser is the one mutating cmdlet in this list. It can update attributes such as department, description and contact information, but a single incorrect identifier can modify the wrong employee record. Use -WhatIf first to preview what would happen without carrying out the modification.
Set-ADUser -Identity 'jdoe' -Department 'Finance' -WhatIf
After an approved request, a privileged operator can repeat the exact, narrowly reviewed change without -WhatIf and then use Get-ADUser to verify the new value. Approval, a recorded ticket reference, the correct domain controller and change tracking matter more than script brevity. Never make a broad edit through Get-ADUser -Filter * or treat a sample command as permission to change production accounts. A successful command response is not a substitute for independent readback.
Turn command output into a defensible investigation
Consider the original file-share incident. First use Get-ADUser to confirm the exact account and enabled state, then Get-ADPrincipalGroupMembership to inspect group relationships. If the required group appears missing, Get-ADGroupMember can show the group’s current membership and nested composition. Only after confirming the intended authorization should an approved identity administrator consider a group change, which is not among the six write examples here. If the report concerns a device instead, Get-ADComputer grounds the investigation in the registered computer object, and Search-ADAccount can produce candidates for a separate stale-account review.
Prefer saved, repeatable filters and small auditable outputs over ad hoc exports of every directory attribute. Write down what the query actually proves: an AD object exists, an attribute has a particular value, or a membership relationship is present. It does not independently prove that a login succeeded, a network path is available, or an application granted access. The sixth command illustrates the boundary between gathering facts and making changes; preserving that boundary is what turns useful PowerShell commands into safe operational practice.
What a successful query still cannot establish
A directory read may be technically correct and operationally insufficient. A user’s group list can show membership in Finance-Readers while a file server still denies access because share permissions, NTFS ACLs, account token state or a separate application authorization rule also applies. A computer may have an AD account even if it has been offline for weeks or was reimaged under another device record. Account inactivity flags are useful review signals, but they do not replace domain-controller event logs and endpoint evidence when a security or incident-response decision depends on exactly who authenticated and when.
Directory scope is another quiet source of errors. A query run against the default domain may omit objects in a different domain or organizational unit, and a permissive whole-domain search can disclose far more than a help-desk ticket needs. Before using a report in a decision, record the query time, the domain or server queried, the exact filter and the intended population. When scripts run repeatedly, test pagination, disconnected domain controllers and missing-property behavior instead of assuming every object has consistent metadata.
Finally, AD DS and Microsoft Entra ID are not interchangeable administrative targets. The examples above depend on the ActiveDirectory module and an on-premises or managed AD DS directory service; they do not query Entra cloud-only objects merely because the organization synchronizes some identities. If the relevant permission or user is cloud-only, investigate the cloud identity and application layer using its own supported tooling. That distinction prevents a real directory result from becoming an incorrect explanation of a different system.