Fix: Battery Icon and/or Volume Control Missing From Windows 10 Taskbar

tree
I came across a rather weird problem today where my taskbar was missing the icons for the volume control and battery meter:
Capture
My first attempt to fix this was to check the related system settings:

  1. Open the run dialog (Windows-key + R) and type ‘ms-settings:notifications’
  2. Click on ‘Turn system icons on or off’
  3. In my case the sliders for both Volume and Power were disabled at the off position

If you find yourself in the same situation the following might help you, too:
As an alternative you can click here to jump to the bottom of the post for a PowerShell solution that will modify the respective registry keys instead of applying the changes via group policy settings

  1. Open the run dialog (Windows-key + R) and type ‘gpedit.msc’ Note: The Local Group Policy Editor is not available in all windows versions here is a link to a post that claims to bring it to all versions of Windows 7, which you can try out at your own risk on Windows 10.
  2. Navigate to: User Configuration -> Administrative Templates -> Start Menu and Taskbar
  3. Configure the policies for ‘Remove the battery meter’ and ‘Remove the volume control icon’ to be Disabled
    1. Double-click each entry
    2. Select the radio-button next to Disabled
    3. Click Apply and OK


For the changes to take affect you can either restart your PC or just restart windows explorer. One way to achieve the latter is through PowerShell (at least to have one PowerShell command in this post 🙂 ). Just use the command

kill -n explorer

This will end the explorer.exe task and restart automatically. As an alternative if you don’t know your way around in PowerShell you could type the following into the run dialog:

powershell -exe bypass -nop -command "&{kill -n explorer}"

PowerShell only solution
The following commands need to be executed from an elevated PowerShell window (How to open an elevated PowerShell prompt in Windows 10)

Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name HideSCAVolume -Value 0
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer -Name HideSCAPower -Value 0
kill -n explorer

shareThoughts


Photo Credit: Indigo Skies Photography via Compfight cc

PowerShell Error – “Select-Object : Cannot convert System.Object[] to one of the following types…”

tree

I came across a bug (at least I would assume this a bug) in PowerShell while using the Select-Object (alias select) cmdlet in conjunction with a mix of literal and variable arguments for the Property parameter (attempting to use Get-ChangeLog with a multiple column identifier). Select-Object’s Property parameter accepts either an array of objects, or a hashtable of name/expression pairs as arguments. Let’s look at an example:

Get-Help select -Parameter Property
#usage with literal argument
Get-Process | select Name, ID, Handle, VM, PM
#usage with a variable argument
$props = "Name", "ID", "Handle"
Get-Process | select $props
#mixed usage of literal and a variable argument
Get-Process | select $props, VM, PM

The last command results into the following error message:
select_Error
Even if we change the literal values to strings and put the arguments in parentheses Select-Object still refuses to accept it:

$props = "Name", "ID", "Handle"
#check the type of the parameter value
($props, "VM", "PM").GetType().FullName
#should work, but still doesn't
Get-Process | select ($props, "VM", "PM")

I found two possible workarounds.

  1. Concatenation of the values
  2. Using Write-Output (alias echo) to produce an array of strings (I like that one more)

See also PowerShell tricks- Build an array of strings without quotation marks

#concatenate
$props = echo Name ID Handle
Get-Process | select ($props + "VM" + "PM")
#using echo
Get-Process | select (echo $props VM PM)

shareThoughts


Photo Credit: S.Raj via Compfight cc

“Please wait while windows configures Microsoft Visual Studio…” when starting Excel

tree6

I got this dialog (“Please wait while windows configures Microsoft Visual Studio Professional 2013”) on every Excel (2010) start up shortly after I had installed Visual Studio 2013 Community Edition. In my case it delayed the Excel start-up for several minutes. In order to get rid of the quite annoying dialog I just created a new directory under C:\WINDOWS\Microsoft.NET\Framework\URTInstallPath_GAC. To do so just run the command below from an elevated command- or PowerShell prompt:

mkdir C:\WINDOWS\Microsoft.NET\Framework\URTInstallPath_GAC

photo credit: Mañana… – Tomorrow… via photopin (license)

Group-Object “Wildcard characters are not allowed in …”

tree2

I recently came across a situation where I wanted to group a custom object based on a property that contained a question mark.

[PSCustomObject]@{"test?"="test"} |
     group 'test?'

Running the above resulted in the error message “group : Wildcard characters are not allowed in “test?”.”. To make Group-Object work with the property name that contains a wildcard character the property name needs to be escaped either manually by preceding the wildcard character by “`” (e.g. “test`?”) or utilizing the related .net method.

[PSCustomObject]@{"test?"="test"} |
     group [Management.Automation.WildcardPattern]::Escape('test?'))

shareThoughts


photo credit: the tree II via photopin (license)