One-Liner(s): X509 Certificate Store Names and You

All right, we know that we can access a remote computer’s various X509Certificate stores via .NET, and ‘My’ corresponds to “Local Computer\Personal\Certificates”. What are the other names? http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.storename.aspx That gives us the details, but on some of my lab boxes, some of it didn’t work. Specifically, I couldn’t pull the Intermediate Certification Authorities list. Per…

1

One-Liner: Case-Insensitive XML Queries

I’m a one-trick pony with XML.  I use $xml.SelectNodes(“//name[@attribute=’value’]”) and permutations thereof.  However, XML’s SelectNodes() and SelectSingleNode() methods are case-sensitive.  My coworker Keith Munson found this tidbit:  $xml.SelectNodes(“//element[translate(@AttributeName, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’, ‘abcdefghijklmnopqrstuvwxyz’) =’AttributeValue’]”) This will return <element AttributeName=”attributevalue” /> as well as <element AttributeName=”AttributeValue” /> But it won’t work for <Element AttributeName=”AttributeValue” /> nor: <element attributename=”AttributeValue” />…

0

Regular Expressions, Search-and-Replace Interpolation and Delegates

This (and the previous post) stem from me stumbling onto this page: http://stackoverflow.com/questions/17229866/powershell-hex-to-string-conversion/19151495 Last time, we looked at hex-decoding a string. In the above, the original poster had file of space-delimited lines, each with three fields: the username, the user’s domain, and the hex-encoded password. The requested solution was to only hex-decode only the third…

0

Splitting a Hex-Encoded String into Pairs of Hex Characters (a.k.a. To Pull a Noah)

Simple enough task: I have a hex-encoded string and need to decode it.  Now, we all know that to encode a string to hex is to cast each [char] to [int], then shove it through the "{0:X}" format specifier, then concatenate all the strings. $string = "The quick brown dog"; [string]::Join($null, ([char[]]$string | % {…

1