dear god help me i hate powershell

This commit is contained in:
Ray 2024-04-12 21:18:05 +10:00 committed by GitHub
parent a313e7b671
commit 6fdcbb26e4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ foreach ($row in $fous) {
$ouName = $row.Name $ouName = $row.Name
# Check if the OU already exists # Check if the OU already exists
if (-not (Get-ADOrganizationalUnit -Filter "Name -eq '$ouName'")) { if (-not (Get-ADOrganizationalUnit -LDAPFilter "(Name=$ouName)")) {
# Create the OU # Create the OU
New-ADOrganizationalUnit -Name $ouName -Path "DC=alphadelta,DC=com" -ErrorAction SilentlyContinue New-ADOrganizationalUnit -Name $ouName -Path "DC=alphadelta,DC=com" -ErrorAction SilentlyContinue
Write-Host "OU '$ouName' created successfully." Write-Host "OU '$ouName' created successfully."