AD GPO - Brandon-Duffy/SYS-265 GitHub Wiki

Creating an OU via PowerShell:

Open PShell

'New-ADOrganizationalUnit -Name "Software Deploy" 'Get-ADComputer WKS01-BRANDON | Move-ADObject -TargetPath 'ou=Software Deploy, DC=brandon, DC=local' '$ou = "OU=Test OU, DC=brandon, DC=local" 'Set-ADOrganizationalUnit -Identity $ou -ProtectedFromAccidentalDeletion $false'

Deleting an OU from PShell: 'Remove-ADOrganizationalUnit -Identity $ou -Confirm:$false -Verbose

Moving Items to a new OU:

Using 'Move-ADObject -TargetPath' to move items to a new OU.

Searching the Event Log using Powershell:

if you know the Event Log ID, use this command: 'Get-EventLog -LogName "System 301" System is the Windows Logs tab in the EV GUI, and 301 is the ID