Sergey M
Sergey M

Reputation: 3

Powershell format string

I am trying to convert the following string (this is UUID of the server) E376B527-CD96-4AC9-B6F8-218987D196DB to this format (which i can insert to registry) 0xE3,0x76,0x6B,0x27

Upvotes: 0

Views: 370

Answers (1)

Keith Hill
Keith Hill

Reputation: 201622

This will get you the hex values as bytes but you will have to twiddle the order a bit:

[guid]::Parse('E376B527-CD96-4AC9-B6F8-218987D196DB').ToByteArray() | % {"0x{0:X2}" -f $_}

Upvotes: 2

Related Questions