Windows Task Manager may prevent safe removal of USB drive

I recently experienced problems removing a USB drive safely from a Thinkpad T440p running Windows 10.

I saw this warning:

Windows_is_unable_to_stop_the_device

Windows is unable to stop the device 'USB Mass Storage Device'. Don’t remove this device while it is still in use. Close any programs using this device and then remove it.

 

I checked if I was deliberately using any files or folders on the drive, but that was not the case.

 

I checked which processes held handles on the D: drive using the useful utility handle.

C:\bin\Handle>handle d:\

Handle v4.0
Copyright (C) 1997-2014 Mark Russinovich
Sysinternals - www.sysinternals.com

System             pid: 4      type: File           FA0: D:\$Extend\$RmMetadata\$TxfLog\$TxfLog.blf
System             pid: 4      type: File          1788: D:\$Extend\$RmMetadata\$TxfLog\$TxfLogContainer00000000000000000002
System             pid: 4      type: File          193C: D:\$Extend\$RmMetadata\$TxfLog\$TxfLogContainer00000000000000000001
System             pid: 4      type: File          1B60: D:\$Extend\$RmMetadata\$Txf

 

I found this in Event Viewer:

Log Name:      System
Source:        Microsoft-Windows-Kernel-PnP
Event ID:      225
Task Category: (223)
Level:         Warning
User:          SYSTEM
Description:
The application \Device\HarddiskVolume4\Windows\System32\Taskmgr.exe with process id 7432 stopped the removal or ejection for the device USB\VID_1058&PID_1023\57584C3145313145534A5A36.

 

The problem was solved by closing task manager. Then the USB drive could be removed safely.

AHCI power saving settings may cause system freezes

I experienced a frequent issue on a Lenovo Thinkpad T440p computer running Windows 10.

The system would sometimes become completely unresponsive for around 30 seconds, where every program would freeze.

Then the system would resume with very high disk activity for a while from the System and compressed memory process.

(Initially this made me suspect an issue with this process, but it seems like this was just a side effect)

 

In Event Viewer I found events like these around the time the freezes occured:

Log Name:      System
Source:        storahci
Event ID:      129
Description:
Reset to device, \Device\RaidPort0, was issued.

 

I found this blog post and discussion, which seems to have a solution and explanation:

Event ID 129 – storachi – Reset to device, DeviceRaidPort0, was issued.

 

The issue may be caused by AHCI power saving settings.

The simple workaround is to change the system power profile to High Performance under:

Control Panel -> Power Options

Power_Options_power_plan_High_performance

(This disables a number of power saving settings including one for AHCI)

 

Be aware that system freezes can also be caused by firmware bugs, driver bugs, defective SATA cable, failing harddisk/SSD and possibly other causes.

PowerShell: Check memory used by processes and virtual machines

PowerShell can be useful for many things.

There are PowerShell Cmdlets that make it fairly simple to examine the amount of memory used by processes or virtual machines.

 

Examples:

Sum of working set for all processes:

Get-Process | Measure-Object WorkingSet -Sum
"{0:N2} GB" -f ((Get-Process |
Measure-Object WorkingSet -Sum).sum / 1GB)

 

Sum of assigned memory for Hyper-V virtual machines:

Get-VM | Select-Object MemoryAssigned |
Measure-Object MemoryAssigned -Sum
"{0:N2} GB" -f ((Get-VM |
Select-Object MemoryAssigned |
Measure-Object MemoryAssigned -Sum).sum / 1GB)

 

Sorted list of processes with working set in megabytes:

Get-Process |
Select-Object Name,@{Name='WorkingSet';Expression={($_.WorkingSet / 1MB)}} |
Sort-Object -Property WorkingSet

Alt Gr key not working normally

If you use a Lenovo Thinkpad computer running Windows 10 you may experience a situation where the Alt Gr key stops working normally and just works as the regular Alt key.

Ctrl + Alt can be used as a substitute, but that’s only a workaround.

The problem seems to be related to the Synaptics Pointing Device driver.

 

The problem can be resolved for some time by reinstalling, rolling back or updating the Synaptics Pointing Device driver and then restarting the computer.

The problem can reappear after some weeks. However it can be resolved again by repeating the above steps.

If I discover a permanent fix, I will update the article again.

 

The driver can be rolled back this way:

1. Open Device Manager

2. Open Properties for Synaptics Pointing Device

Synaptics_Pointing_Device_01

3. Click: Rollback driver

Synaptics_Pointing_Device_02_Roll_Back_Driver

4. Restart the computer.

Run diskpart clean twice

When trying to clear a USB memory stick with diskpart I encountered this error:

DISKPART> clean

DiskPart has encountered an error: Access is denied.
See the System Event Log for more information.

 

The System event log contained this error from VDS Basic Provider:

Cannot zero sectors on disk \\?\PhysicalDrive2. Error code: 5@0101000F

 

The problem was solved simply by running clean again:

DISKPART> clean

DiskPart succeeded in cleaning the disk.

 

After that a partition could be created and formatted.

 

Warning: Always be very careful when using diskpart.

In order to avoid data loss make sure to list disks, select the correct disk and list disks again before running diskpart clean.

Windows file permissions: High Mandatory Level

I encountered a problem when following the guide: WinPE: Create a Boot CD, DVD, ISO, or VHD

 

I chose to create a new .vhdx file directly under C:\ for testing in Hyper-V

Later I moved the .vhdx file to C:\Hyper-V

I actually got this dialog when moving the file, but just went ahead with Continue without considering the implications.

00_Administrator_permission_to_move_this_file

 

When I tried to attach the .vhdx to a virtual machine I got this error message:

01_User_Account_does_not_have_permissions

Failed to modify device ‘Virtual Hard Disk’.

User Account does not have permission to open attachment.

 

I checked the file permissions and noticed:

02_High_Mandatory_Level

Integrity level: High Mandatory Level

 

I also checked the permissions with:

C:\>icacls c:\Hyper-V\WinPE_amd64_PS.vhdx
c:\Hyper-V\WinPE_amd64_PS.vhdx BUILTIN\Administrators:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Users:(I)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
Mandatory Label\High Mandatory Level:(I)(NW)

Successfully processed 1 files; Failed processing 0 files

 

The high integrity level was causing the problem, but how to remove it?

The easiest solution was to lower the integrity level with:

icacls c:\Hyper-V\WinPE_amd64_PS.vhdx /setintegritylevel medium

After that the file could be attached and used.

 

Conclusion

If high integrity level on a file causes problems, it can be lowered with icacls.

Generally avoid creating files directly under C:\, because it can lead to problems like this.

Change Windows PE keyboard layout

I was experimenting with Windows PE for deployment and servicing.

The default keyboard layout is American. I wanted to use Danish keyboard layout instead.

The keyboard layout can be changed to Danish with:

wpeutil SetKeyboardLayout 0406:00000406

 

Be aware that the setting does not affect the initial cmd window.

It will however affect all other programs run hereafter.

Another cmd window (with the new keyboard layout) can be opened with:

start cmd

(Dont’t close the initial cmd window. That will make Windows PE restart)

 

Microsoft has a list of locale IDs: Locale IDs Assigned by Microsoft

As another example the locale ID for Swedish is 0x41d, so Swedish keyboard layout can be set with:

wpeutil SetKeyboardLayout 041d:0000041d

 

The same principle applies to other languages.

Replace default Windows 10 Intel graphics driver

After installing Windows 10 I experienced problems with screen corruption, (unwanted) screen cloning and occasional graphics driver crashes.

The graphics driver also seemed to cause performance and stability problems for some programs.

Intel Graphics driver version 10.18.15.4256 installed by Windows Update worked poorly for me.

 

Windows 10 forces particular driver updates as standard.

I wanted to use the latest Intel graphics driver to avoid the problems described above.

 

This was accomplished by:

1. Identfying the CPU using CPU-Z and finding the latest compatible graphics driver at: https://downloadcenter.intel.com/

2. Downloading and unpacking the .zip driver package.

3. Updating and choosing the driver using Device Manager.

4. Disabling driver updates.

 

I found a number of ways to disable driver updates here:

http://www.makeuseof.com/tag/take-back-control-driver-updates-windows-10/

The method that worked for me was changing the value of registry key SearchOrderConfig from 1 to 0.

Under: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DriverSearching

Conclusion

The default graphics driver delivered by Windows Update may not be the most reliable version.

In some cases it can be relevant to install a different driver version and disabling driver updates.

Media driver error at Windows 10 setup

I experienced a strange problem when trying to install Windows 10 on an Asus K52J laptop from a Verbatim Store ‘n’ Go 16 GB USB drive.

After booting Windows 10 setup and clicking “Install now” I saw the message: Setup is starting

And then this error message:

A media driver your computer needs is missing. This could be a DVD, USB or Hard disk driver. If you have a CD, DVD, or USB flash drive with the driver on it, please insert it now.

Note: If the installation media for Windows is in the DVD drive or on a USB drive, you can safely remove it for this step.

 

Followed by this error message:

No device drivers were found. Make sure that the installation media contains the correct drivers, and then click OK.

 

Common explanations for this error

  • Corrupted ISO file.

(I checked the SHA1 checksum, which was correct)

  • Wrong AHCI/SATA/IDE setting in BIOS.

(I tried the available options, which had no effect)

  • Using a USB 3.0 port instead of a USB 2.0 port.

(The machine only has USB 2.0 ports. Tried all the ports anyway, which didn’t change the situation)

 

Solution

I eventually found and tried the solution suggested by 4TXTECH here:

http://www.tomshardware.co.uk/forum/id-2762791/win10-clean-install-fails-missing-media-drivers.html

Setup could continue after following this procedure:

1. Unplug the USB drive.

2. Plug the USB drive into a different USB port.

3. Go back to the initial setup screen (by clicking X).

4. Click “Install now” again

 

Thoughts

The problem seems to be caused by a USB compatibility issue somewhere between Windows 10, the laptop or the USB drive.

Further investigation could be relevant.

If Windows installation from a USB flash drive fails due to this or other problems, try the suggested workaround.

As an alternative, try installing from a DVD (if possible).