How to edit the userParameters binary blob in Active directory¶
For setting the TerminalServicesProfilePath
attribute in Active Directory, one has to fight with a weird (and I'm being polite here) encoding. The whole magic is now included into our user creation process, the basic algorithm is just sketched here as a reference (note that each character of plain text is encoded in 3 bytes of binary):
for each character you want to encode, do:
- split the character's byte into nibbles
xxxx
andyyyy
- have a look at
xxxx
. If it's ≤ 9,control x
equals001011
, otherwise it's011010
- have a look at
yyyy
. Here the bit patterns forcontrol y
are001110
(yyyy
≤ 9),011010
otherwise - if
xxxx
>9:xxxx
-= 9 - if
yyyy
>9:yyyy
-= 9 - take the
1110
prefix,control y
,yyyy
,control x
andxxxx
and glue them all together to yield a 24 bit string - convert this bit stream to three bytes