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: WMI and HP Product IDs

    An HP Product ID is related to the hardware SKU The plain-English way of getting the SKU is Get-WMIObject –ComputerName $computerName Win32_ComputerSystem However, our inventory system uses the HP product ID property stuffed in ILO.  As someone who uses the test lab, this isn’t something that I...
  • Blog Post: WMI-Less Network Adapters

    We can get a list of network adapters (calling them NICs is a bit outdated: the C in NIC stands for ‘card’, like it’s something you plug into an ISA or PCI slot.  These days, it’s almost always built in) from Get-WMI Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration, but per http://msdn...
  • Blog Post: Getting User Names for Processes

    Sometimes, I am in awe at the PowerShell team.  Other times, I am stunned, but at their inability to grasp common user scenarios.  PSH3, for example, finally allows Get-ChildItem to specify “files only” or “directories only” (but their way of specifying attributes is a whole other syntax, which...
  • Blog Post: PowerShell One-Liner: Getting This Computer's Asset Tag Number

    Here's a gem from an internal email: CMD> wmic SystemEnclosure get SMBIOSAssetTag 5551212 If the system has asset tag data added to the BIOS, this is a way to collect it.
  • Blog Post: PowerShell for Non-N00bs: Formatting Time With RegEx

    So, last episode we learned how to format the output of a LastBootUpTime property from the WIN32_OperatingSystem WMI query to something human readable using WMI. What if that didn't exist? PSH> (Get-WmiObject -Query 'SELECT LastBootUpTime FROM Win32_OperatingSystem').LastBootUpTime 20090712112652...
  • Blog Post: PowerShell for Non-N00bs: System Uptime Via WMI

    Getting the last time a system was rebooting is pretty easy from WMI. From this half-decade old post , we get the two key bits: the LastBootUptTimem property of the Win32_OperatingSystem WMI class. In PowerShell, it looks like this: PSH> (Get-WmiObject -Query 'SELECT LastBootUpTime FROM Win32_OperatingSystem...
  • Blog Post: One-Liner: Getting This Computer's Serial Number

    The computer's serial number can be very useful. Among other things, many manufactuers' support sites keep record of their machine's serial numbers to serve the right drivers for downloads. CMD> wmic bios get serialnumber SerialNumber ABCDEF12345 Wmic is the command line executable for performing...
  • Blog Post: PowerShell One-Liner: Hardware SKU

    Someone asked me what kind of server I was running in the lab. Uh, I don't have lab access, and even if I do, how the heck would I find it? PS> Get-WmiObject Win32_ComputerSystem | fl Domain : testlab Manufacturer : HP Model : ProLiant DL380 G4 Name : testlab1234 PrimaryOwnerName : TotalPhysicalMemory...
Page 1 of 1 (8 items)