{ claus.conrad }

Microsoft Windows

FAQ

Get a List of all Installed Programs (and Updates)

  1. On the machine in question launch a command window.
  2. To display all the installed programs execute the following two commands:
WMIC
product get name,version
  1. To export all the installed programs to a text file (c:ProgramList.txt) execute the following two commands:
WMIC
/output:c:ProgramList.txt product get name,version
  1. To export all the installed updates to a text file (c:UpdateList.txt) execute the following two commands:
WMIC
/output:C:UpdatelList.txt QFE get

Source: https://www.petenetlive.com/KB/Article/0000619

Using the Windows OpenSSH Agent from WSL

  1. Install socat in the WSL distro:
sudo apt install socat
  1. Install npiperelay in Windows:
choco install npiperelay
  1. Insert into ~/.bashrc in the WSL distro:
# Configure ssh forwarding
export SSH_AUTH_SOCK=$HOME/.ssh/agent.sock
# need `ps -ww` to get non-truncated command for matching
# use square brackets to generate a regex match for the process we want but that doesn't match the grep command running it!
ALREADY_RUNNING=$(ps -auxww | grep -q "[n]piperelay.exe -ei -s //./pipe/openssh-ssh-agent"; echo $?)
if [[ $ALREADY_RUNNING != "0" ]]; then
    if [[ -S $SSH_AUTH_SOCK ]]; then
        # not expecting the socket to exist as the forwarding command isn't running (http://www.tldp.org/LDP/abs/html/fto.html)
        echo "removing previous socket..."
        rm $SSH_AUTH_SOCK
    fi
    echo "Starting SSH-Agent relay..."
    # setsid to force new session to keep running
    # set socat to listen on $SSH_AUTH_SOCK and forward to npiperelay which then forwards to openssh-ssh-agent on windows
    (setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork &) >/dev/null 2>&1
fi

Source: https://stuartleeks.com/posts/wsl-ssh-key-forward-to-windows/

WSL (Windows Subsystem for Linux) documentation

Enabling systemd in WSL2

Switch easily between VirtualBox and Hyper-V with a BCDEdit boot Entry

Some sites say to use Add/Remove Features to turn the Hyper-V support off, but that seems like a big deal to do what should be a small thing.

Instead, from an administrative command prompt I made a copy of my boot menu with a “No Hyper-V” entry:

Note the first command gives you a GUID and you then copy it and use it with the second command.

C:>bcdedit /copy {current} /d “No Hyper-V”

The entry was successfully copied to {ff-23-113-824e-5c5144ea}.

C:>bcdedit /set {ff-23-113-824e-5c5144ea} hypervisorlaunchtype off

The operation completed successfully.

Now, this is important. In Windows 8.x, Windows is optimized to startup FAST. And it does. On my Lenovo it starts in about 3 seconds, faster than I can press any buttons to interrupt it. But when I want to dual boot, I need it to really shut down and give me an option to chose this new boot menu.

In order to access the new boot menu, I select Settings (Windows Key + C) then Power, and Restart but hold down shift on the keyboard while clicking Restart with the mouse.

HOLD SHIFT while pressing Restart

You will get this scary looking Blue Screen. Select “Other Operating Systems” and your “No Hyper-V” option is in there.

Now, you can run Virtual Box nicely but still choose Hyper-V when you want. You can confirm VirtualBox works by noting that the Acceleration tab will not be grayed out under System Settings for your VMs. Reboot normally and Hyper-V will be back and ready to go.

Source: http://www.hanselman.com/blog/switch-easily-between-virtualbox-and-hyperv-with-a-bcdedit-boot-entry-in-windows-81

Arranging windows in a grid view using the keyboard

  1. Press Win+Z
  2. Press the digit corresponding to the desired layout
  3. Press the digit corresponding to the desired location of the current window
  4. Use the arrow keys to highlight a window for another location
  5. Press Enter to confirm the other window

Enable Hibernate in Windows 11

As a user with the Administrator role:

powercfg.exe /hibernate on

Source: https://www.ubackup.com/windows-11/hibernate-mode-windows-11.html

Change Hyper-V Virtual Machine Connection screen resolution

  • As an administrative user, run VMConnect.exe HOSTNAME VMNAME /edit to spawn the resolution dialog and re-connect to the VM using RDP.

Change PIN code

To change your Windows PIN code to one with more than 4 digits, follow these steps:

  1. Open Settings (click on the gear icon) ➡️ Accounts ➡️ Sign-in options.
  2. Click the Change button under PIN.
  3. Enter your current PIN, then enter and confirm the new PIN (which can be more than 4 digits).
  4. If you’ve forgotten your PIN, click “I forgot my PIN” and follow the instructions. If you encounter any issues related to complexity requirements, consider the following:
  • If your computer is part of a school or work domain, the policy might enforce a minimum PIN length. Unfortunately, there’s nothing you can do in this case.
  • If it’s a home computer, check if a minimum PIN length has been set. You can adjust it to your desired length or revert the policy to the default 4 digits.

Virtual Disk Manager: “The system cannot find the file specified”

  • This can happen when Windows sees partition table errors. This has happened to me with a USB drive where I created the (GPT) partition table using Linux. To fix it, I ran diskpart in Windows, list disk to identify the USB drive’s number, select disk X to select it, and clean to delete the partition table. ==Careful:== Of course this also deletes all partitions!

Shortcuts

ShortcutFunction
Ctrl+Win+LeftSwitch to previous desktop
Ctrl+Win+RightSwitch to next desktop
Win+ROpen emoji selector (from Windows 10 and upwards)
Win+ZSnap a window using the keyboard