Multiline registry keys not importing newline characters with Group Policy Preferences
-
Tuesday, October 26, 2010 11:15 PM
We have a program that holds an address in a REG_SZ, it's a real pain in the bum to setup the address for all our users.
I am trying to use group policy preferences to set this address, however, when GPP applies the registry key, the newline characters seem to be replaced with spaces. So instead of this:
123 Street Road
Suburb
City 45678I get:
123 Street Road Suburb City 45678
Is there any way I can get GPP to apply the registry key correctly?
Thanks!
All Replies
-
Wednesday, October 27, 2010 9:01 AMThe smart way for this is to use the registry type REG_MULTI_SZ instead of REG_SZ.
I'd try if your app can cope with this.
If not I would create a reg export of the key created by the app itself.
How does it look like? Maybe your app supports escape sequences, e.g. \n for Linefeed?
See if you can use this string within GPP.
Patrick -
Wednesday, October 27, 2010 10:43 PM
All good ideas, unfortunately I have tried all of them. This program doesn't like REG_MULTI_SZ, only REG_SZ by the look of it.
It doesnt like escape characters either...
To import the key correctly, the reg file has to look like the following:
"Company_10902"=hex(1):54,00,65,00,73,00,74,00,0D,00,0A,00,54,00,65,00,73,00,\
74,00,00,00That will read:
Test
TestWhen imported.
This seems to be the only way to import a REG_SZ with the newline characters. But I would really like to use GPP for this. We already have enough scripts without adding another into the mix to test what branch the user is in and import the correct reg file. We have near 100 branches.
If someone from Microsoft can confirm that its not possible. That would be nice :-), we can go back to manually adding it :-(.
-
Thursday, October 28, 2010 1:41 PM
I see.
I'd agree there is a limitation in GPP Editor. You cannot insert LF characters here.
But try this trick:
Open the file "Registry.xml" on SYSVOL share with an editor (path = ...\Policies\GUIDofYourGPO)
Navigate to your item and use the XML escape sequence


as delimiter between your lines.
Reference:
http://www.xmlschemareference.com/regularExpression.html#SingleCharacterEscapeAt least when reading the result from registry via vbcsript I get a multiline result.
Don't know what your app makes out of this, but give it a try...
Patrick -
Friday, October 29, 2010 12:47 AM
Good Idea. Unfortunately it didn't work :-(. Well everyone, the answer is NO . You cannot do this with GPP.- Marked As Answer by Thomas Higgins Friday, October 29, 2010 12:47 AM

