Fix: Clipboard is not working + Restart-Process with PowerShell

24460391384_1668f05155_m
Sometimes it happens that the clipboard stops working. The routine of copy and paste we all rely on so many times a day suddenly refuses to do its job. The reason this happens is usually an application blocking the keyboard, making it impossible for other applications to get access to the clipboard. In order to fix this, one needs to find out which application is the culprit and either stop or restart the respective process in order to “free up” the clipboard.
I put together a small PowerShell function (Clear-Clipboard), that does just that:

clipboardBlocking

  1. It identifies the process that currently blocks the clipboard (Using GetOpenClipboardWindow and GetWindowThreadProcessId API calls)
  2. Opens a small GUI offering options to either stop or restart the process

Other than the mentioned Clear-Clipboard function. I’m also sharing Restart-Process as a separate function as it might be useful at times. Both can be downloaded from my GitHub repository.

shareThoughts


Photo Credit: Andi Campbell-Jones via Compfight cc

Fix: Chrome won’t start or taking a long time to start

25187751746_7369950f8d_m

Two simple, yet not intuitive solutions to solve two quite annoying Chrome problems (worked for me on Windows 10 and Windows 8).

1. Chrome browser refuses to launch

Solution: Reset the winsock catalog (see https://support.microsoft.com/en-us/kb/811259 and https://technet.microsoft.com/en-us/library/cc753591%28v=ws.10%29.aspx for more details).:

  1. Open an elevated command prompt (see here)
  2. Type: netsh winsock reset and hit Enter
  3. Restart your PC

2. Chrome takes a very long time to launch:

Solution: Disable hardware acceleration:

  1. Open chrome and type chrome://settings into the address bar and hit Enter
  2. Scroll down and click “Show advanced setttings…”
  3. Scroll further down and untick the box next to “Use hardware accelartion when available”

shareThoughts


Photo Credit: Dakiny via Compfight cc

Retrieve UninstallStrings to fix installer issues

24356667904_413b3b0856_m
Recently I have encountered several installer related issues on my machine. Most of them seemed to be caused by insufficient privileges.
This kind of issue can be usually fixed by running the installer “As Administrator”. In case the issue is in relation to an already installed software packet, it’s sometimes not so easy to locate the respective uninstaller/MSI packet, though. For that purpose, I’ve written a small PowerShell function that scans the registry (it turned out that if you are using PowerShell v5, there is a better way of doing this. See below for more details) (have a look here on why I didn’t want to use WMI Win32_Product instead) for the information. The function has the following features:

  • Search for software by name including wildcards (parameter DisplayName defaults to ‘*’)
  • Search through user specific (HKCU) and/or machine specific (HKLM) registry hives (parameter Hive defaults to HKLM, HKCU only accepts a combination of ‘HKCU’ and/or ‘HKLM’)
  • If a key is found matching the DisplayName. Output an object with the following properties: RegistryHive, DisplayName, UninstallString, msiGUID (if present), InstallLocation=$subKey.InstallLocation, Version (DisplayVersion)

Usage (if your PowerShell version < 5):

#search for the chrome uinstaller only in the machine wide registry hive
Get-Uninstaller *chrome* -Hive HKLM

Output:
GetUninstaller
If you happen to be on PowerShell v5 ($PSVersionTable.PSVersion.Major -eq 5) you can use the built-in Get-Package to retrieve the same information:

Armed with that information one can easily run the installer (MSI) or uninstall routine with elevated privileges in order to fix some installer related issues. For msi installer packets the following command will reinstall the respective software (see here for more details on the reinstall mode). It hopefully goes without saying, that you should only run those commands if you know what you are doing:

msiexec /i {msiGUID} REINSTALL=ALL REINSTALLMODE=omus /l*v log.txt

Below is the source of the helper function for older PowerShell version. I have also uploaded another adaption that uses the best approach depending on the PowerShell version, to my GitHub repo.

shareThoughts


Photo Credit: Chad Sparkes via Compfight cc

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