Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

This will work

27 views
Skip to first unread message

haroldprudhomme

unread,
Jan 5, 2010, 2:47:26 PM1/5/10
to
$address = "Fraser Center`r`nBldg 3"
set-user -id -streetaddress $address

You need to have both the `r`n and that is not a ' it a ` there is a differance in powershell.

Al Dunbar wrote:

I think part of the confusion may be between the term multi-line and
11-Apr-09

I think part of the confusion may be between the term multi-line and
multi-valued (which is how that type of attribute in AD is described).

Why not do this: use ADUC to set a multi-valued attribute, then use
powershel to extract it, examine it to see what form it is in, and then
write your code to provide it in the same format. This could be a delimited
string, an array, or even something else.

/Al

"TPGBrennan" <TPGBr...@discussions.microsoft.com> wrote in message
news:395D9A4C-DD87-4441...@microsoft.com...

Previous Posts In This Thread:

On Thursday, April 09, 2009 8:35 AM
TPGBrenna wrote:

multiline values
I can get PS to correctly enter a multiline value such as the street address
by entering the following at a command prompt
set-user -streetaddress "Fraser Center'n Bldg 3".

However, I have not been able to get PS to enter the multiline value
correctly by using an input file to modify attributes. No matter what I've
tried the value is simply entered in ADUC as Fraser Center'n Bldg 3 with no
line break.

Is it possible to import a multiline value from an input file?

Thanks

On Thursday, April 09, 2009 9:34 AM
Vadims Podans [MVP] wrote:

Re: multiline values
try this:

$address = ("Fraser Center'n Bldg 3").replace(" ", "`n")
set-user -streetaddress $address

however this breaks single line in to 4 lines (simple replaces space to new
line symbol).
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

"TPGBrennan" <TPGBr...@discussions.microsoft.com> rakst??ja zi??ojum??
"news:299EDF44-3751-4591...@microsoft.com"...

On Thursday, April 09, 2009 10:06 AM
Josh Einstein wrote:

The expansion of `n into a newline character is only applicable in a
The expansion of `n into a newline character is only applicable in a
double-quoted string.

Try this:

Set-User -StreetAddress $(Get-Content File.txt -ReadCount 0)

(Leave the actual line breaks in the file.)

Josh

"TPGBrennan" <TPGBr...@discussions.microsoft.com> wrote in message
news:299EDF44-3751-4591...@microsoft.com...

On Thursday, April 09, 2009 4:48 PM
TPGBrenna wrote:

$address=(Fraser Center&Bldg 3)$address=$address -replace "&","`n"set-user
$address=(Fraser Center&Bldg 3)
$address=$address -replace "&","`n"
set-user juser -streetaddress $address

This worked, except Active Directory Users and Computers shows the result as
a single line with a special character where the line break is. If retrieve
the attributes for the user it shows up correctly as two lines. it appears
the underlying problem is how ADUC handles the string from Powershell.
VBScript was able to get the line breaks to display, but it can't set the
Country in the ADUC GUI. meanwhile, Powershell can't work with non-exposed
attributes such as employeeid and departmentnumber. I guess I'll use
VBScript as it gives me almost everything needed.

thanks for the response

"Vadims Podans [MVP]" wrote:

On Friday, April 10, 2009 4:19 AM
Vadims Podans [MVP] wrote:

can you show your VBS code, that can write multilines fields?
can you show your VBS code, that can write multilines fields?
--
WBR, Vadims Podans
MVP: PowerShell
PowerShell blog - www.sysadmins.lv

On Friday, April 10, 2009 10:45 AM
Alex K. Angelopoulos wrote:

It's probably using vbNewLine or vbCrLf, which is pretty simple to do; just
It's probably using vbNewLine or vbCrLf, which is pretty simple to do; just
need to use "`r`n".

A way to confirm is if he retrieves values correctly and incorrectly
displayed in ADUC and uses VBScript's Escape() function on the text; it
should show %0D%0A for the ones that show up correctly in ADUC and %0A for
the ones done by PowerShell with just `n. Or the same thing, using
[system.uri]::EscapeDataString() from PowerShell.

This appears to technically be brokenness in ADUC, since it probably
_should_ support all the general ways of showing multiline output, but
working around it with PowerShell is just as easy as with VBScript...

"Vadims Podans [MVP]" <vpodans> wrote in message
news:OL27SUb...@TK2MSFTNGP06.phx.gbl...

On Saturday, April 11, 2009 1:00 AM
Al Dunbar wrote:

I think part of the confusion may be between the term multi-line and
I think part of the confusion may be between the term multi-line and
multi-valued (which is how that type of attribute in AD is described).

Why not do this: use ADUC to set a multi-valued attribute, then use
powershel to extract it, examine it to see what form it is in, and then
write your code to provide it in the same format. This could be a delimited
string, an array, or even something else.

/Al

"TPGBrennan" <TPGBr...@discussions.microsoft.com> wrote in message
news:395D9A4C-DD87-4441...@microsoft.com...


Submitted via EggHeadCafe - Software Developer Portal of Choice
Setting Option Strict On by Default in VB.NET
http://www.eggheadcafe.com/tutorials/aspnet/c67e9bfe-171d-41d6-8e88-e21bafc73cd0/setting-option-strict-on.aspx

0 new messages