Windows

From Giki

diskpart - remove all partitions

source: https://windowsloop.com/use-diskpart-to-delete-partitions/

list disk
select disk n
clean

use clean all to zero the disk after removing partitions (might take long and cannot be aborted!) - if diskpart was closed when clean all was executed but not yet done: use the task manager tab performance to see when usage drops from 100 % on previously selected disk to see when it's done

fix ALTGR in RDP session not working

source: https://newyear2006.wordpress.com/2021/04/21/alt-gr-funktioniert-unter-windows-nicht-mehr/

from time to time ALTGR does not work in a RDP session. while this can be circumvent by pressing ALT + CTRL it can be easily fixed by pressing ALT + RETURN.

Shrink VHDX

in VM

defrag

defrag C:

Defrag.png

diskpart

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          63 GB     23 GB        *

DISKPART> select disk 0

Disk 0 is now the selected disk.

DISKPART> list volume

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0         Recovery     NTFS   Partition    499 MB  Healthy
  Volume 1     C                NTFS   Partition     50 GB  Healthy    Boot
  Volume 2                      FAT32  Partition     99 MB  Healthy    System

DISKPART> select volume 0

Volume 0 is the selected volume.

DISKPART> shrink querymax

The maximum number of reclaimable bytes is:  15 GB (177586 MB)

DISKPART> shrink desired=12256

DiskPart successfully shrunk the volume by:   11 GB

on Hyper-V Host

Resize-VHD

Resize-VHD -Path 'C:\Hyper-V\VMNAME\Virtual Hard Disks\VMNAME.vhdx' -ToMinimumSize

Compact disk using GUI

In the setting of the VM select the disk -> Edit -> Compact

Self-healing NTFS

initial source: https://twitter.com/fr333k/status/1370110050941960196
source https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-r2-and-2008/cc771388(v=ws.10)
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-repair

To enumerate the confirmed corruptions of a volume, type:

fsutil repair enumerate C: $Corrupt

To enable self-healing repair on drive C, type:

fsutil repair set c: 1

To disable self-healing repair on drive C, type:

fsutil repair set c: 0

Virus Scanner

Kaspersky Free Rescue Disk (bootable)

https://www.kaspersky.de/downloads/thank-you/free-rescue-disk

Microsoft Safety Scanner (Windows)

https://docs.microsoft.com/en-us/windows/security/threat-protection/intelligence/safety-scanner-download

WinDefThreatsView

https://www.nirsoft.net/utils/windows_defender_threats_view.html