Im a little lost here. Hopefully you can see with my code what I am trying to achieve:
$Dept=@("Sales","Finance") $OU=@("ou=Sales,ou=Finance,ou=WS,dc=ads,dc=contoso,dc=net") #change -lt value to add more sources and destinations for ($i=0; $i -lt 2; $i++) { Write-Host $i Get-ADUser -SearchBase $OU -Filter * | ` Set-ADUser -City "XXXX" ` -State 'XXXX' ` -StreetAddress 'XXXXXXX' ` -Description 'XXXX' ` -Organization 'XXXXXXXX' ` -Country 'XX' ` -Department "$Dept" ` -PostalCode XXXX ` -PassThru }
I have replaced the true values with X
I get this error when I run it:
Get-ADUser : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'SearchBase'. Specified method is not supported.
At C:\Users\XXX\Desktop\Update_Address_details.ps1:8 char:24
+ Get-ADUser -SearchBase $OU -Filter * | `
+ ~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.ActiveDirectory.Management.Commands.GetADUser
Any ideas?
Chris Golden