HP Power Supplies

HP servers have redundant power supplies.  SCOM will tell me which one is broken if it’s down, but in this case, I lost power to one side of the rack, and want to see if replacing the distribution unit fixed the issue.  Here’s a quick-and-dirty WMI wrapper to do that: function Get-HPPowerSupplyStatus { param (…

0

#StupidProfileTrick – FunctionList

As I previously posted, my $Profile is stupidly complicated, and it adds a ton of functions.  Which ones did I add? (Reason this is of interest to me is because I mistakenly named a function with the same name as a cmdlet.  Yeah, totally stupid move on my part.  More on that later.) #region start…

0

Something I Should Have Done a While Ago: $continue

$ErrorActionPreference is your friend.  However, ‘SilentlyContine’ isn’t, especially when it’s misspelled as is this case.  If we could Tab-complete it, that’d be great. Hey…. I’ve added this to my $PROFILE (actually my CommonFunctionLibrary.psm1 from my RDP-friendly Profile System) $Continue = ‘Continue’; $SilentlyContinue= ‘SilentlyContinue’; $Stop = ‘Stop’; $Inquire = ‘Inquire’; $Ignore = ‘Ignore’; $Suspend = ‘Suspend’;…

1

8.3, the Undead Path

8.3 is a common reference to the DOS name limit of 8 characters for the filename and 3 characters for the file extension.  E.g.: command.com. NTFS did away with that, but it still haunts us in the form of legacy .BAT files that can’t handle file paths with space characters in them (and may blow…

0

Write-Error, $Error, and Users

Write-Error is useful, but the output is intimidating for new users.  You want them to see a nice message, but they get a wall of red text including a stack dump. Here’s a way to output it as a warning, but populate $Error as well. function Out-Error { param ( [String]$Message = "No error message.",…

0

VM Host

Here’s the one-liner: reg query “HKLM\Software\Microsoft\Virtual Machine\Guest\Parameters” /v hostname Here’s the wrapper function Get-VmHostName { <# A fancy way to run remotely reg query “HKLM\Software\Microsoft\Virtual Machine\Guest\Parameters” /v hostname #> param([string[]]$ComputerName = @($env:COMPUTERNAME)); foreach ($myComputerName in ($ComputerName | ? { $_; })) { if ($result = (reg query “\\$myComputerName\HKLM\Software\Microsoft\Virtual Machine\Guest\Parameters” /v hostname | select-string hostname) -replace…

0