Lessons Learned

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

Posts
  • Lessons Learned

    More Fun with Passwords

    • 0 Comments
    Given the sad frequency with which web sites get their password stores leaked, using the same password, N0M@tt3rH0w5tr0ng !!! is a very bad idea.  Recent articles have shown how even hashed password strings can get translated back to their plaintext...
  • Lessons Learned

    Rehash: Testing for a 302 Redirect

    • 0 Comments
    This blog, like any journal, tracks my own personal growth. This means I get to revisit and rehash old posts a lot.   In this case, I’m adding the 302 Redirect check from a few years back to the ServicePointManager callback to accept bad SSL...
  • Lessons Learned

    Rehash: Testing Web Pages Once More

    • 0 Comments
    I seem to be rehashing a lot of stuff.  The reason is that I’m trying to capture what I actually find useful, and hope this blog will capture processes that I may use later.  Many of these processes start from copy-pasting items I’ve already...
  • Lessons Learned

    Setting Font in PowerShell.exe Window, Sort Of…

    • 0 Comments
    To change the font in the current PowerShell.exe window, copy-and-paste all but the last line from http://gallery.technet.microsoft.com/scriptcenter/cb72e4e6-4a68-4a2e-89b7-cc43a860349e/view/Reviews . Now, for the obligatory caveats: It changes the font...
  • Lessons Learned

    Importing and Removing Certificates

    • 1 Comments
    We knew it had to come to this. All these posts about examining .cer files, scanning for certificates being served on :443, and auditing the LocalComputer\My certificate store. We knew there had to come a time when we programmatically import and remove...
  • Lessons Learned

    DFS (Distributed File System) Mountpoints Across Sites

    • 0 Comments
    DFS (Distributed File System) is a very use feature.  By normalizing the naming and presenting it via namespace servers, hosts in multiple sites connect to their local filers using abstracted names that are common across the environment.  This...
  • Lessons Learned

    Getting Network Adapter Speed

    • 0 Comments
    TIMTOWTDI (pronounced ‘tim-toady’) is the Perl dictum, “There is more than one way to do it.” PowerShell seems to be mercifully free of this, but this may be an exception. We leverage the old standard “Win32_NetworkAdapterConfiguration”...
  • Lessons Learned

    Getting OCS 2007 Certs through WMI Revisited

    • 0 Comments
    Back in August 2012 , I posted about getting certificates bound to Office Communication Server 2007 interfaces using PSExec.  As much as I respect MarkRuss and SysInternals, PSExec is quite fiddly.  We have PSH V2 in our lab (finally!), so a...
  • Lessons Learned

    Number of Processors vs. Number of Cores Revisited

    • 0 Comments
    Back in July 2011, I posted about getting the number of processors and cores and gave passing mention of the fact that there’s a known issue with PSH and some versions of Windows.  Well, PSH V3 now has the NumberOfLogicalProcessors property in the...
  • Lessons Learned

    Certificate Chains

    • 0 Comments
    I seem to spend a lot of time typing about SSL certificates, don’t I?  Well, I seem to spend a lot of time auditing certificates at work.  In this case, we’re updating certs because we’re migrating from one Root CA to another.  Why? ...
  • Lessons Learned

    Hack(saw)ing the Surface Pro

    • 0 Comments
    I'm taking a break from PowerShell goodness to brag about my new MS Surface Pro. It's an amazing piece of engineering. It's small, it's light, it's ... It's very steal-able. Sadly, Microsoft (disclaimer: I work for them, but that's pretty much a...
  • Lessons Learned

    RDCman Config Files (*.rdg)

    • 2 Comments
    RDCMan is a godsend if you have to jump on multiple machines. It's a wrapper for mstsc.exe, the venerable Remote Desktop Protocol client. It allows you to create trees of server groups (though groups and servers cannot branch from the same node, be warned...
  • Lessons Learned

    Futzing With System Variables

    • 0 Comments
    $Env:PATH is a common bane - you have a hundred machines, and you end up with fifty different $Env:PATH values.  Here's a quick way to audit them, and to set them remotely.  But be careful: just like with superpowers, this comes with great responsibility...
  • Lessons Learned

    Stopping Services Remotely and Recursively (But Without Recursion)

    • 0 Comments
    This one is actually fun because it reminded me of my Comp Sci. 101 days (the actual course number was 53A, but the point is the same: basic algorithms.)  Here, I have an n -deep tree that I must consume leaf-first.  Specifically, I want to...
  • Lessons Learned

    Adding a Timestamp to a Pipeline of Strings

    • 0 Comments

    If I'm doing something long-running, and I want it to know when various lines of output are generated, assuming they are being sent to STDOUT (something PSH is NOT good at), here's a quick way to preface the output with a timestamp.

    ...
  • Lessons Learned

    Batch-Getting BIOS Serial Numbers

    • 0 Comments
    Our lab maps hosts to KVM Ports based on, not hostname, not IP address, but the BIOS Serial Number. Like the last post, this is probably overkill on (Get-WmiObject -ComputerName $ComputerName Win32_BIOS).SerialNumber, but it's probably useful.  Possibly...
  • Lessons Learned

    Batch-Getting IP Addresses

    • 0 Comments
    Let's say you have a list of hostnames and need IP addresses for them. "You have a list of hostnames..." Very funny.  This is probably overkill on what is simply [System.Net.Dns]::GetHostEntry($ComputerName).AddressList.  Still, it...
  • Lessons Learned

    When Were These Computers Last Rebooted?

    • 0 Comments
    Here's a short one.  We want to know when this box was last rebooted.  Sure, it's in the SCOM DB, but this is probably faster. The Win32_OperatingSystem WMI object contains the LastBootupTime attribute.  Beyond that, it's a simple matter...
  • Lessons Learned

    Removing Monitoring Agents (Not Really)

    • 0 Comments
    Thanks to my coworker Keith Munson for the core logic. This post is written around the task of removing SCOM and MOM monitoring agents, but those rely on knowing the agent’s MSI installer’s GUID. The easiest way to get that is to...
  • Lessons Learned

    Getting Computer Memory Usage

    • 0 Comments
    Here’s a quick spot-check on the memory usage on remote computer (or a few dozen computers).  It uses WMI objects – Win32_ComputerSystem for the TotalPhysicalMemory and Win32_OperatingSystem for FreePhysicalMemory, TotalVirtualMemorySize (why did...
  • Lessons Learned

    Fun with PSCredentials

    • 0 Comments
    Back in October of 2012, I posted Securely Storing a Password , which showed the key commands to capture a password and store it as a SecureString in a file. However, this doesn’t address using that password as a PSCredential. Let’s remedy...
  • Lessons Learned

    Converting PsCustomObject To/From Hashtables

    • 3 Comments

    Functions to converting Hashtables to PsCustomObjects and vice versa (losing all PsCustomObject class members that are not properties such as noteproperty).

    ...
  • Lessons Learned

    AppWiz.cpl in PowerShell

    • 2 Comments

    Querying the registry for installed programs remotely

    ...
  • Lessons Learned

    PSH V1 Get-Tail

    • 0 Comments
    In PSH V2, Get-Content –Tail 10 –Wait will display the last 10 lines of a file, then poll it every second and display any additions to it. In PSH V1, Get-Content didn’t have a –Tail flag, so if you wanted to do the equivalent of...
  • Lessons Learned

    Get-FileVersion

    • 0 Comments
    With an endless stream of daily builds, it is essential that a test lab run the latest version.  PS C:\Users\timdunn> dir C:\Windows\System32\*.dll | Get-FileVersion | more Path                                                       ...
Page 4 of 8 (197 items) «23456»