question

SikanderKhanC-3918 avatar image
0 Votes"
SikanderKhanC-3918 asked SikanderKhanC-3918 commented

Windows Server Sysprep Unattend.xml - Unable to use special chars( <, >, &.._ ) for pasword in unattend.xml file.

Hey,

   While creating a windows server using Sysprep, I found out that Sysprep's unattend.xml file doesn't accept special chars(<, >, &)  as input for passwords. I am trying to use the following characters as a password in the unattend.xml file.

Sysprep unattend.xml code block

![113323-screenshot-2021-06-02-at-81723-pm.png][1]


Error message
![113318-screenshot-2021-06-09-at-35902-pm.png][2]

After debugging I found out that this is because XML doesn't accept these 5 special chars(<, >, &, ', "). We need to escape and unescape it but windows don't do that. If so please provide proper documentation stating all the valid characters accepted for the password in aunattend.xml.

[1]: /answers/storage/attachments/113323-screenshot-2021-06-02-at-81723-pm.png
[2]: /answers/storage/attachments/113318-screenshot-2021-06-09-at-35902-pm.png
windows-server-2016
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@SikanderKhanC-3918,

What's the latest on you side?
Did you have a chance to try the proposed solutions?

0 Votes 0 ·

Hi,
@SikanderKhanC-3918
Just checking in to see if the information provided was helpful.
If the reply helped you, please remember to accept as answer.
If no, please reply and tell us the current situation in order to provide further help.

0 Votes 0 ·

Hi @PercivalYang-MSFT ,
I apologize for late reply. We tried this solution and it worked.
Thanks for the assistance.

Best regards,
Sikander khan

0 Votes 0 ·
YitzhakKhabinsky-0887 avatar image
0 Votes"
YitzhakKhabinsky-0887 answered YitzhakKhabinsky-0887 edited

Hi @SikanderKhanC-3918,

Just use CData section for such values:

<password><![CDATA[secret & password]]></password>

XML - CDATA Sections


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PercivalYang-MSFT avatar image
0 Votes"
PercivalYang-MSFT answered

Hi
@SikanderKhanC-3918

To use html transcode, you can have a try using the following html dec to replace.

& → &#38
< → &#60
> → &#62
´ → &#180
′ → &#8242
″ → &#8243;

here is the link for your reference

https://www.w3schools.com/charsets/ref_html_entities_4.asp
Note: Since the websites are not hosted by Microsoft, the links may change without notice. Microsoft does not guarantee the accuracy of this information.


Hope this can help you

If your need further help, be free reply to me at your convenience.


==============================================================================
If the Answer is helpful, please click "Accept Answer" and upvote it

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.