Hi i have a problem that i need you to help to solve, I want so search through multiple OU´s for Users. I have it working for one OU but i need to make a script that can search through multiple I am currently trying to get it working with two, but i can't seem to get it to work.
Function Update-ADUsers {
Import-Csv -path $csvfile | `
ForEach-Object {
$Description = $_.'Descripcion'
$sam = $_.'Logon Name'
Try{ $SAMinAD = Get-ADUser -server $ADServer -Credential $GetAdminact -LDAPFilter "(sAMAccountName=$sam)"}
Catch{}
If($SAMinAD -ne $null -and $sam -ne '')
{
IF ($Description -ne '' ) { Set-ADUser -server $ADServer -Credential $GetAdminact -SearchBase "OU=maincra,DC=depresion,DC=com" -Identity $sam -Replace @{Description = $Description}}
}
}