Link to home
Start Free TrialLog in
Avatar of Fred Acme
Fred Acme

asked on

Creating accounts AD 2k8 PowerShell - Carriage Return in addresses

Hello,

How are you today ?

I've got a problem with Excel, PowerShell and AD (2008 or 2012).
In AD, we have some users with an address on 2 lines (See 2-LINES.JPG attached).

In Excel, I use ALT+ENTER (or "Wrap up automatically" button) to make the return (See 2-LINES-EXCEL.JPG).

Then, I save the file in csv with  coma format.

When I lauch my script (this is a part of the script) : New-ADUser -StreetAddress $_.streetaddress
The address is on a signle line.

What should I do to make the address on two lines ?

Thank you for your help !

Fred
2-lines.jpg
2-lines-Excel.jpg
Avatar of Patrick Bogers
Patrick Bogers
Flag of Netherlands image

Hi,

In the csv you can add `r`n between the two lines like below.
"This is the first line`r`nThe Second"

Cheers
You can also open CSV in Excel and use this formula
=SUBSTITUTE(M19,CHAR(10),"`r`n")

Open in new window

User generated image
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Fred Acme
Fred Acme

ASKER

Hello !

Thank you everybody for your help.

I'll test it rapidly.
Hello,

Your command is great !

I used it yesterday and all my accounts are OK :)

Thank you !