will it work now???

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

View File

@ -26,6 +26,9 @@ foreach ($row in $fous) {
# Get the name of the OU from the CSV # Get the name of the OU from the CSV
$ouName = $row.Name $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 # Check if the OU already exists
if (-not (Get-ADOrganizationalUnit -LDAPFilter "(Name=$ouName)")) { if (-not (Get-ADOrganizationalUnit -LDAPFilter "(Name=$ouName)")) {
# Create the OU # Create the OU