From fd7d3143d05542a287d44ccdb7360dce17fae6bc Mon Sep 17 00:00:00 2001 From: reiyua Date: Fri, 12 Apr 2024 21:19:53 +1000 Subject: [PATCH] will it work now??? --- AutoOUADCreator.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AutoOUADCreator.ps1 b/AutoOUADCreator.ps1 index 41aab49..171dc42 100644 --- a/AutoOUADCreator.ps1 +++ b/AutoOUADCreator.ps1 @@ -26,6 +26,9 @@ foreach ($row in $fous) { # Get the name of the OU from the CSV $ouName = $row.Name + # Get all existing OUs in the specified path + $existingOUs = Get-ADOrganizationalUnit -Filter * -SearchBase "DC=alphadelta,DC=com" | Select-Object -ExpandProperty Name + # Check if the OU already exists if (-not (Get-ADOrganizationalUnit -LDAPFilter "(Name=$ouName)")) { # Create the OU