PowerShellRay

Archive for the ‘Active Directory’ Category

To find OU’s that exist in your domain

Get-ADOrganizationalUnit -Filter {Name -like "*"} | Format-Table name, distinguishedname -AutoSize

Create new user

New-ADUser -SamAccountName "sherift" -Name "Sherif Tawfik" -AccountPassword (ConvertTo-SecureString -AsPlainText "pass@word1" -Force) -Enabled $true -ChangePasswordAtLogon $true -GivenName "Sherif" -Surname "Tawfik" -Path "OU=CoExUsers,DC=CoEx,DC=com"

Search user

Get-ADUser -Filter {Name -like "*Sherif*"}

Enable Recycle bin feature (Active Directory that forestand domain level are R2)

Enable-ADOptionalFeature ‘Recycle Bin Feature’ -Scope Forest -Target ‘CoEx’


%d bloggers like this: