AD ‐ GPO - derek-hash/SYS-265-02 GitHub Wiki

Creating an OU via PowerShell:

New-ADOrganizationalUnit -Name "NewOU" -Path "DC=yourdomain,DC=com" Deleting an OU via PowerShell:

Remove-ADOrganizationalUnit -Identity "OU=NewOU,DC=yourdomain,DC=com" -Recursive

Note: You may need to disable OU protection first.

Moving items to a new OU:

Move-ADObject -Identity "CN=User1,OU=OldOU,DC=yourdomain,DC=com" -TargetPath "OU=NewOU,DC=yourdomain,DC=com"

Searching the Event Log using PowerShell:

Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='Microsoft-Windows-GroupPolicy'} | Where-Object {$_.Message -like "PuTTY"} | Select-Object TimeCreated, Message