Lessons Learned

My drop-site for interesting snippets and tips. If it's useful to you as well, great!

Browse by Tags

Tagged Content List
  • Blog Post: PowerShell for N00bs: $env:temp vs. %TEMP%

    A while ago, we snuck in something. PSH> dir $env:temp | less $env:temp is PowerShell's way of accessing the original environment variables, the stuff we get when we type 'set' at a cmd.exe prompt. 'set' in PowerShell is an alias for Set-Variable, so it doesn't do the same thing. To get the...
  • Blog Post: PowerShell One-Liner: Decrypt-SecureString

    Let's say you have a $secureString. If you don't have one handy, create one: PSH> $secureString = ConvertTo-SecureString -Force -AsPlainText "hello" Actually, we're breaking the system - SecureStrings aren't supposed to be created this way - they're supposed to be created like this: PSH>...
  • Blog Post: PowerShell for N00bs 4: More Properties than a Monopoly Board

    We used Select-Object -Property to, well, select properties (after all, PowerShell is trying to move away from obscure abbreviations and truncated names.) How do we know what properties exist? Get-Member . We covered this in N00bs 2. Get-Member gets the ... class members of a PowerShell object...
  • Blog Post: PowerShell for N00bs 3: What's a.k.a. short for?

    "Also known as." It's an abbreviation, a TLA. (What's a TLA short for? "Three Letter Acronymn." See: recursion, definition.) In PowerShell for N00bs 2 , we snuck something in the last example: PSH> (gm -InputObject [string] | where-Object {$_.name -eq 'replace'}).definition System.String...
  • Blog Post: PowerShell for N00bs 2: Power Under the Hood

    "Hello, World!" That's how you write "Hello, World" in PowerShell. No, this isn't a flashback to PowerShell for N00bs 1 . Back then, we skimmed over some interesting concepts. Specifically: PowerShell is Object Oriented. "Hello, World" (and every object) has a ToString() method. Object...
  • Blog Post: PowerShell for N00bs 1: Hello, World

    "Hello, World!" That's how you write "Hello, World" in PowerShell. Give it a try: PSH> "Hello, World" "Hello, World!" PowerShell has some very unorthodox behaviours, such as "To execute a string, print it." (There's more to it than simply "print it," but that's for later.) Actually, if it...
  • Blog Post: PowerShell for N00bs 0: References

    (I actually wrote this blog after PowerShell for N00bs 1: Hello, World , but the content of this entry I wrote before the blog entry.) Many PowerShell texts are available. I have only read a few, and offer the following opinions: Microsoft Windows PowerShell Step by Step – Very good first book...
Page 1 of 1 (7 items)