So recently I was working with the Get-TSLsaSecret CMDLet which was written by Niklas Goude, a guest blogger from TrueSec who was writing on the Hey Scripting Guy Blog.
Everytime I ran the CMDLet, ensuring that I was running as a 32bit session, which was elevated, I would receive the message "The specified structure must be blittable or have layout information.", I looked and looked and couldn't see anything I was doing wrong, or anything wrong in the code.
I the stumbled upon Microsoft KB 2909958. Resolving the issue is very simple, we just need to do another cast on the line with the error.
In the code from Microsoft/Niklas, change:
[LSAUtil.LSAUtil+LSA_UNICODE_STRING] [System.Runtime.InteropServices.marshal]::PtrToStructure($privateData, [LSAUtil.LSAUtil+LSA_UNICODE_STRING])
And you are done!
More to come on Get-TSLsaSecret!!!!