Lessons Learned

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

March, 2013

Posts
  • 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

    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

    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

    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

    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

    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

    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

    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

    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

    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

    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

    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...
Page 1 of 1 (13 items)