From 6fdcbb26e4fa1cff03197180fb0de0dbfd24d365 Mon Sep 17 00:00:00 2001 From: reiyua Date: Fri, 12 Apr 2024 21:18:05 +1000 Subject: [PATCH] dear god help me i hate powershell --- AutoOUADCreator.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AutoOUADCreator.ps1 b/AutoOUADCreator.ps1 index 932a65f..41aab49 100644 --- a/AutoOUADCreator.ps1 +++ b/AutoOUADCreator.ps1 @@ -27,7 +27,7 @@ foreach ($row in $fous) { $ouName = $row.Name # Check if the OU already exists - if (-not (Get-ADOrganizationalUnit -Filter "Name -eq '$ouName'")) { + if (-not (Get-ADOrganizationalUnit -LDAPFilter "(Name=$ouName)")) { # Create the OU New-ADOrganizationalUnit -Name $ouName -Path "DC=alphadelta,DC=com" -ErrorAction SilentlyContinue Write-Host "OU '$ouName' created successfully."