Posts Tagged ‘registry’
Remove Driver Filters to Resolve Device Manager Errors on Windows 7
Sometimes the situation might come up where a device that was working flawlessly before will stop doing so, even if you try everything – replugging it, reinstalling its drivers, rebooting the computer – but nothing will help.
A possible cause for this is a driver filter that was either installed by any third party software or simply was corrupted. These can be part of any hardware driver and can intercept requests between software and driver (UpperFilter) or between hardware and driver (LowerFilter). Furthermore, there are two types of filter for each relation – device filters and class filters, where device filters work only for specific devices and class filters work for every device of a specific type, for example every bluetooth radio or every USB device attached to your computer. Those class drivers are the ones that usually cause the issues (if it is a filter issue) because on the software’s side, it makes more sense to address those to alter specific behaviours.
If you experience such an issue (which is commonly recognized by the Device Manager errors 19, 31, 32, 37, 39 and 41) it is possible to delete class filters in the registry. Before you make any changes there, it is highly recommendable to back it up. To do so, enter the registry by entering regedit into a Run… prompt and on the left pane, right-click the topmost key (Computer). Click Export and save the file to any location. The file you just created is a .reg file and can be imported into the registry again by simply double-clicking it.
To find the correct filters in the registry, navigate to the Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class key. This will have many subkeys all named like this: {36FC9E60-C465-11CF-8056-444553540000}. These represent the different classes of hardware, you can sport their type by the (Default) or Class values. The one above is for all USB devices:
Along with the other values, those keys contain the class filters if any are present. They are named UpperFilters and LowerFilters. If you have backed up your registry, look for the device giving you headaches and remove the class filters by right-clicking and deleting them.
This guide is only a solution to a possible source of errors and does not cover the whole range – if the problem persists, the source most likely lies somewhere else.
Windows Powershell Script to Export and Import Sound Schemes
Windows 7 offers the possibility to switch between preinstalled sound schemes and also create new ones and delete those again. What it does not provide however is a way to export and import those schemes to use them on other systems. There is a way to do this but it involves copying over all the custom sound files as well as exporting and importing specific registry keys. This might be a bit too complicated for someone who just wants all their Windows systems to play some nice bird chirp at logon.
Luckily, what is possible on Windows is also scriptable in PowerShell. Therefore the following script is able to export custom sound schemes into a zipped package, including all sound files and needed registry items and also import them onto another system. All the audio files used for the custom scheme to export need to be in the C:\Windows\Media directory – on import, they are all unpacked back there and will not be found if the registry points somewhere else.
$x = “nil”
function SelectFileDialog
{
param([string]$Title,[string]$Directory,[string]$Filter=”Zip archives (*.zip) |*.zip”)
[System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”) | Out-Null
$bFile = New-Object System.Windows.Forms.OpenFileDialog
$bFile.ShowHelp = $true
$bFile.Title = $Title
$bFile.InitialDirectory = $Directory
$bFile.Filter = $Filter
$Show = $bFile.ShowDialog()
If ($Show -eq “OK”)
{
Return $bFile.FileName
}
Else
{
Write-Error “Cancelled by user.”
}
}function NewZip
{
param([string]$zipFilename)
$l = $zipFilename.length-4
$iszip = $zipFilename.substring($l)
if ( $iszip -ne “.zip”)
{
$zipFilename = $zipFilename + “.zip”
}
set-content $zipFilename (“PK” + [char]5 + [char]6 + (“$([char]0)” * 18))
(dir $zipFilename).IsReadOnly = $false
}function AddZip
{
param([string]$zipFilename)
$l = $zipFilename.length-4
$iszip = $zipFilename.substring($l)
if ( $iszip -ne “.zip”)
{
$zipFilename = $zipFilename + “.zip”
}$l = $zipFilename.length-4
$iszip = $zipFilename.substring($l)
if ( $iszip -ne “.zip”)
{
$zipFilename = $zipFilename + “.zip”
}
$shellApplication = new-object -com shell.Application
$zipPackage = $shellApplication.NameSpace($zipFilename)foreach($file in $input)
{
$zipPackage.CopyHere($file.FullName)
Start-sleep -milliseconds 500
}
}function ExtractZip
{
param([string]$zipFilename, [string] $destination)if(test-path($zipFilename))
{
$shellApplication = new-object -com shell.Application
$zipPackage = $shellApplication.NameSpace($zipFilename)
$destinationFolder = $shellApplication.NameSpace($destination)
$destinationFolder.CopyHere($zipPackage.Items())
}
}$objshell = New-Object -ComObject Shell.Application
[void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Drawing”)
[void] [System.Reflection.Assembly]::LoadWithPartialName(“System.Windows.Forms”)$objform = New-Object System.Windows.Forms.Form
$objform.Text = “Export Windows 7 Sound Scheme”
$objform.Size = New-Object System.Drawing.Size(330,160)
$objform.StartPosition = “CenterScreen”$objform.KeyPreview = $True
$objform.Add_KeyDown({if ($_.KeyCode -eq “Escape”) {$objform.Close()}})$exportButton = New-Object System.Windows.Forms.Button
$exportButton.Location = New-Object System.Drawing.Size(20,70)
$exportButton.Size = New-Object System.Drawing.Size(75,23)
$exportButton.Text = “Export”
$exportButton.Add_Click({$x=”exp”;$objform.Close()})
$objform.Controls.Add($exportButton)$importButton = New-Object System.Windows.Forms.Button
$importButton.Location = New-Object System.Drawing.Size(100,70)
$importButton.Size = New-Object System.Drawing.Size(75,23)
$importButton.Text = “Import”
$importButton.Add_Click({$x=”imp”; $objform.Close()})
$objform.Controls.Add($importButton)$cancelButton = New-Object System.Windows.Forms.Button
$cancelButton.Location = New-Object System.Drawing.Size(180,70)
$cancelButton.Size = New-Object System.Drawing.Size(75,23)
$cancelButton.Text = “Cancel”
$cancelButton.Add_Click({$x=”nil”;$objform.Close()})
$objform.Controls.Add($cancelButton)$objlabel = New-Object System.Windows.Forms.Label
$objlabel.Location = New-Object System.Drawing.Size(10,20)
$objlabel.Size = New-Object System.Drawing.Size(280,40)
$objlabel.Text = “Do you want to export your current theme or import a new theme?”
$objform.Controls.Add($objlabel)$objform.Add_Shown({$objform.Activate()})
[void] $objform.ShowDialog()if($x -eq “nil”) {exit}
if($x -eq “exp”)
{
cd C:\Users\howtoforge\Desktop
$ts = (get-itemproperty (get-item HKCU:\AppEvents\Schemes).PSPath).”(default)”
$a = @()
$b = @()
newzip $ts
Get-ChildItem HKCU:\AppEvents\Schemes\Apps\ | Get-ChildItem | Get-ChildItem |
Foreach-Object {if ((get-itemproperty $_.PSPath).”(default)” -notlike “C:\Windows\Media\*\*”){($efg = ((get-itemproperty $_.PSPath).PSChildName));
if ($efg -eq $ts) { $a += ((get-itemproperty $_.PSPath).”(default)”)
}}}
foreach ($i in $a){ if ($i) {$b += get-item $i}}
$b = $b | select -uniq
get-item $b | addzip $ts
reg export HKCU\AppEvents ($ts + “.reg”)
get-item ($ts + “.reg”) | addzip $ts
remove-item ($ts + “.reg”)
}if($x -eq “imp”)
{
$p = SelectFileDialog
if ($p)
{
$ppp = (gci $p | select -expandproperty name)
$ps = $ppp.substring(0,$ppp.length-4)
extractzip $p C:\Windows\Media
regedit (“C:\Windows\Media\” + $ps + “.reg”)
Start-sleep -milliseconds 10000
remove-item (“C:\Windows\Media\” + $ps + “.reg”)
$p.remove
}
}
In order to be able to run the script, you need to enable running PowerShell scripts on your systems. Therefore, open a PowerShell as administrator and type in:
set-executionpolicy remotesigned
Now you can run selfmade or signed scripts. Copy and paste the script above into a notepad and find the line that was printed bold here – change my username in the path (“howtoforge”) to yours. Then save it as .ps1 file.
Afterwards you can run the script by right-clicking it and running it in PowerShell or setting that as the default program to open ps1 scripts with. A prompt will pop up that will ask you if you want to ex- or import. Exporting will automatically export your current sound scheme to a zip file on your desktop (but only with the audio files lying in the said folder – exporting any schemes with files in a subfolder such as the Windows schemes will result in missing paths).
Copy the zipped package to the target system and run the script from there, choosing Import this time. Browse for the package and open it. The script will then put all the audio files to the C:\Windows\Media folder and import the registry file (a few pop ups will come up upon importing stuff into the registry, just accept them and everything should be fine).
If any issues should occur, make sure the zipped package is saved to a folder you have writing-permissions and everything for – if you changed it to something else than your desktop, this may easily happen.
If you are told that the registry file does not exist, this is because you waited too long to accept the import – after ten seconds, the .reg file is deleted to not clutter the Media folder. Just import again to solve it.
Remove Arrows From Shortcut Icons on Windows 7
Upon creating shortcuts on Windows, the icons used for them are always tagged with an additional small arrow icon to indicate that the thing you have there is only a pointer to another file, not the file itself.
If, for esthetical or other reasons, you want remove those arrow icons, you can do that by choosing a transparent icon instead of the arrow to be displayed as indicator so that it won’t be visible anymore. To do that you have to apply a simple registry tweak:
Open the Windows registry by entering regedit into a Run… prompt and browse the following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons
If the Shell Icons key does not exist, create it by right-clicking the Explorer key. Next, select the created Icons key and right-click the right pane to create a new String value. Name it 29 and assign the value C:\Windows\System32\shell32.dll,50 to it.
Afterwards close the registry and open a command line by searching for cmd. Enter the following commands one after another (Please note: the first one will close your explorer which means that your windows and taskbar will disappear. The last one is the command to restart your computer, which you need to do to apply all changes):
taskkill /IM explorer.exe /F
cd /d %userprofile%\AppData\Local
del IconCache.db /a
shutdown /r
After rebooting, the icons will be replaced. To revert the changes, simply remove the registry value and execute the commands again.
Export and Import Sound Schemes on Windows 7
Importing and exporting whole sound schemes becomes handy if you want to apply your schemes to different computers or setup your system anew and don’t want to copy the whole Windows theme. Doing so proves trickier as one might think though, since sound schemes are not saved as some kind of file or package as one might think.
First off, to create a custom sound scheme, head to the Control Panel and open the Hardware and Sound Options. In the Sound menu, click on Change system sounds. Leave the applied scheme as it is and instead change its components by selecting one of the listed items and browsing for a new sound file, which has to be in the .wav format. For simplicity’s sake, put all your custom sound files into the C:\Windows\Media folder prior to setting them since they have to be in the exact same folder on the system you import them.
After you have applied new sounds for all the items you want to change, click the Save as… button and give your scheme a name.
Afterwards, to export the scheme open the Windows registry – do so by opening a Run… prompt (Windows + R) and entering regedit. In the left registry panel, browse for the HKEY_CURRENT_USER\AppEvents key. Right-click it and select Export to save its contents somewhere on your hard drive. Put the exported registry file and all the custom sound files you used on a USB key or another device to transfer the files.
After you have got the registry file as well as the soundfiles you used on the other system, put the sound files in the exact same folder as they were on the first system (if you followed this guide, it is C:\Windows\Media). Then double-click the registry file to add the first system’s sound scheme settings to the new one (schemes are only added, non will be removed if there were custom schemes installed before). The sound scheme should now be available in the Control Panel.
Defragment Boot Files on Windows 7
Apart from the usual file defragmentation on Windows 7, there is another undocumented function that rearranges boot files to grant faster access on them, resulting in shorter boot times. The usual boot options can be viewed by entering defrag -? into a command line window (this can be done in any command line window; to actually start the defragmentation however you need an elevated command prompt – therefore search for cmd in the menu, right-click it and choose Run as Administrator).
The one we need to use, the /b switch, is not listed there. This undoubtedly has its reasons and you should back-up files before you run it. Do not run it if you fear loss of data.
defrag /b C:
I hereby assume that C: is the drive you have your boot-files on. I ran the command on a Windows 7 Enterprise 64-bit machine and it worked flawlessly.
If upon entering the defrag command you get the errorcode 0×89000017, stating that some registry entries are missing, run the following in an elevated command prompt, wait up to 20 minutes and try again afterwards:
Rundll32.exe advapi32.dll,ProcessIdleTasks
This will initiate some services to start that usually only run when the system is idle, one of them being a service of Superfetch that needs to be run before the defrag /b command.
Disable Autoreboot after Updates on Windows 7
After critical Updates, Windows often needs to restart the computer to apply all changes, which however might not be in the interest of the user. To prevent Windows from auto-restarting (may it be to reduce annoyance or to prevent Windows from stopping unattended running applications), you can use a simple but effective registry entry. To apply it, open the Windows registry by entering regedit into a Run… prompt. On the left column navigate to the Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU key (you might have to create some of the keys if they have not been automatically created yet (right-click the key-tree for that)).
On the right panel, right-click to create a new DWORD-Value (32-bit) and call it NoAutoRebootWithLoggedOnUsers. Assign it the value 1 (which is the same in decimal and hexadecimal). key (you might have to create some of the keys if they have not been automatically created yet (right-click the key-tree for that)).
To reverse the effect, browse the same value again and change it to 0
Skip the Web Search Prompt for Unknown File Extensions (Windows)
If you open a file with an extension that is unknown to Windows, it will react with the following prompt:
I cannot remember to have used the web search a single time, that is why I disabled it long ago. One can accomplish that with a simple registry entry. Open your Windows Registry by entering regedit into a Run… prompt and browse the following key in the left frame:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer
Now you will have to create a value if it is not already present for some reason. Go to the right frame, right-click it and select New > DWORD (32-bit) Value. Name it NoInternetOpenWith and set its value to 1.
Close the registry. Now, upon opening a file with an unknown extension, Windows will skip the web search prompt and head straightforward to the list of software available.
Backup Your Windows Registry
Before you make any changes in your Windows Registry where you’re not completely sure of what you are doing, it might be a good idea to make a backup of your current registry settings. You can either do that by creating a System Restore Point or do a backup of only the registry itself. To do the latter, enter it by typing regedit into a Run… prompt. Right-click on Computer on the left frame (the root directory of the keys) and select Export:
Choose a directory where to save the backup and hit Save. The file that is created that way is a *.reg file and can be merged (in this case it replaces the whole registry) on double-click.
This way you create a backup of the whole registry. It is a good idea to have a full working registry backed up, but you can also back-up smaller parts by exporting sub-keys of Computer.








