Skip to content
Back to skills

Powershell Active Directory

ASecurity

Use when managing AD via PowerShell.

  • 2 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 10, 2026
ai-agentsgoshelldockersecurity

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add LoopyLuci/Skills --skill powershell-active-directory --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Powershell Active Directory?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Powershell Active Directory
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/loopyluci-powershell-active-directory/badge)](https://www.skillsdirectory.com/skills/loopyluci-powershell-active-directory)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: powershell-active-directory
description: "Use when managing AD via PowerShell."
category: software-development
tags: [powershell, active-directory, ad, domain, users]
---
# PowerShell Active Directory

Managing Active Directory with PowerShell.

## Prerequisites

```powershell
# Install RSAT tools (Windows 10/11)
Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 -Online

# Import the module
Import-Module ActiveDirectory
```

## User Management

```powershell
# Get user
Get-ADUser -Identity jdoe
Get-ADUser -Filter { Name -like "John*" } -Properties Department, Title, Manager
Get-ADUser -SearchBase "OU=Staff,DC=contoso,DC=com" -Filter *

# Create user
New-ADUser -Name "John Doe" -GivenName John -Surname Doe `
    -SamAccountName jdoe -UserPrincipalName jdoe@contoso.com `
    -Title "Developer" -Department "Engineering" `
    -Path "OU=Staff,DC=contoso,DC=com" `
    -AccountPassword (ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force) `
    -Enabled $true

# Modify user
Set-ADUser -Identity jdoe -Title "Senior Developer" -Department "R&D"
Set-ADUser -Identity jdoe -Add @{ extensionAttribute1 = "DockerUser" }

# Enable/disable
Enable-ADAccount -Identity jdoe
Disable-ADAccount -Identity jdoe

# Remove
Remove-ADUser -Identity jdoe -Confirm:$false
```

## Group Management

```powershell
# Create group
New-ADGroup -Name "DockerUsers" -GroupScope Global `
    -GroupCategory Security -Path "OU=Groups,DC=contoso,DC=com"

# Add/remove members
Add-ADGroupMember -Identity "DockerUsers" -Members jdoe, asmith
Remove-ADGroupMember -Identity "DockerUsers" -Members asmith -Confirm:$false

# Get members
Get-ADGroupMember -Identity "DockerUsers" | Select-Object Name, SamAccountName

# Find groups for a user
Get-ADUser -Identity jdoe -Properties MemberOf | Select-Object -ExpandProperty MemberOf
```

## Computer Management

```powershell
# Find computers
Get-ADComputer -Filter { OperatingSystem -like "*Windows 10*" } -Properties OperatingSystem

# Get computer details
Get-ADComputer -Identity WS-001 -Properties *

# Computer last logon
Get-ADComputer -Filter * -Properties LastLogonDate |
    Where-Object { $_.LastLogonDate -lt (Get-Date).AddDays(-90) }
```

## Organizational Units

```powershell
# Create OU
New-ADOrganizationalUnit -Name "Servers" -Path "DC=contoso,DC=com"

# Move object
Move-ADObject -Identity "CN=jdoe,CN=Users,DC=contoso,DC=com" `
    -TargetPath "OU=Staff,DC=contoso,DC=com"
```

## Reports

```powershell
# Export all users
Get-ADUser -Filter * -Properties Department, Title, LastLogonDate |
    Select-Object Name, SamAccountName, Department, Title, LastLogonDate |
    Export-Csv "ad-users.csv" -NoTypeInformation

# Disabled users report
Get-ADUser -Filter { Enabled -eq $false } |
    Select-Object Name, SamAccountName, LastLogonDate
```

## Pitfalls

- AD module requires RSAT or runs on Domain Controller
- Filter uses PowerShell syntax, not LDAP -- but is converted internally
- Bulk operations need careful throttling (1000+ at a time)
- Password must meet domain password policy
- `-Confirm:$false` skips confirmation prompts -- use with caution

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.