CI/CD Why explained

Disable AD User


Import-ModuleActiveDirectory

Get-ADUser-LDAPFilter'(employeeID=1200547)'| Disable-ADAccount

Disable Bulk AD Users from CSV by User’s EmployeeID

Import-ModuleActiveDirectory

Import-Csv"C:\Users.csv"| ForEach-Object{

$employeeID= $_."EmployeeID"

Get-ADUser-LDAPFilter"(employeeID=$employeeID)"| Disable-ADAccount

Write-Host"User $employeeID disabled"

}

Refer : https://morgantechspace.com/2017/02/disable-ad-user-by-specific-attribute.html

Check if AD user exists with PowerShell

Find AD Users from OU are Member of a Group


$users = Get-ADUser -Filter * -SearchBase "OU=TestOU,DC=TestDomain,DC=com"
$group = "Domain Admins"
$members = Get-ADGroupMember -Identity $group -Recursive | Select -ExpandProperty Name
$users | ForEach-Object {
$user = $_.Name
If ($members -contains $user) {
      Write-Host "$user exists in the group"
} Else {
      Write-Host "$user not exists in the group"
}}

Design a site like this with WordPress.com
Get started