microsoft windows Notes - ipatch/dotfiles GitHub Wiki

Contents

General Windows 10 Notes Unsorted 🔝

If the Windows boot process displays two different versions of Windows that can selected to boot from, and no longer want to be presented with a selection menu when booting the OS

open the msconfig from the run dialog and select the boot tab from the menu, then select the proper OS to boot from learn more

search engine query windows 10 shows two windows during boot

To allow multiple RDP connections learn more

To setup a hard drive / SSD for a fresh install of Windows 10, and the GUI installer has issues setting up the partitions to install Windows 10

search query windows 10 we couldn't create a new partition or locate an existing one for more information, see the setup log files

Use the command prompt shift+f10 from the Windows Installer USB

echo "enter disk partition tool"
diskpart
echo "select the disk to partition"
sel disk [NUM]
echo "list the partitions on the disk"
list vol
echo "select the volume to work with (if one exists)"
echo "clean the disk"
clean
echo "if using BIOS, use MBR"
convert mbr
create partition primary
active
echo "format the partition for windows 10 installation"
format quick fs=ntfs
exit
exit
echo "restart computer, and rerun the Windows 10 install process"

echo "create an image of a windows install"
dism /capture-image /imagefile:B:\install.wim /capturedir:C: /Name:"Windows 10 Custom" /compress:max

The Windows 10 GUI installer should now be able to install Windows 10 to the newly setup disk / partition. learn more

If using the above steps to flash a custom Windows 10 install image to a freshly setup disk, assigning a drive letter to the freshly setup volume / partition may be required to load a wim file to the partition

diskpart
echo "list the available volumes (eject all disks except the windows 10 installer disk)
list vol
sel vol [NUM]
echo "the assign command with no arguments will assign a drive letter"
assign

Once the drive / partitions have been setup, plugin the drive with the wim windows image file, and then apply the image file to the disk SSD or HDD learn more

echo "list the contents of an image"
dism /get-wiminfo /wimfile:F:\install.wim

echo "example cmd, apply the windows image to a partition"
dism /Apply-Image /ImageFile:F:\install.wim /index:1 /ApplyDir:C:\

Final step, is to create a boot record for the freshly setup Windows 10 partiton / disk.

C:\Windows\System32\bcdboot C:\Windows
echo "success message"
Boot files successfully created.

Upgrading hardware for Windows 10

If one wants to keep their HDD / SSD, and OS Windows 10 in tact and just put the drive in a new system, run the below command before inserting the drive in a system. learn more

sysprep

Note, when moving a Windows install from a SATA/IDE to a different storage medium interface problems can arrise, and such it may be required to load the registry of an offline system via an install media to reset some key registry values to get the system to boot learn more

troubleshooting sysprep

may 13, 2021

recently, i wanted to create an image of my current windows 10 install, ran into several issues running sysprep.

  • from what i can tell, WSL has to be uninstalled removed before sysprep will work

  • also had to remove microsoft oneconnect (i have no idea what this is)

    • i had to list all packages that were installed via powershell in order to remove onecconnect and to be able to complete the sysprep process, learn more

search query windows 7 drmv2clt.dll learn more

When using sysprep to prepare a HDD or SDD, and if the sysprep utility outputs an error with above search term, disable above such related service then rerun the sysprep utility.

If the above error log file cannot be opened due to permissions, add the user to the administrators group, using an elevated command prompt

net localgroup Administrators [USER] /add

To remove windows.old folder after a windows 10 upgrade use the Disk Cleanup. learn more

Fixing a Windows 10 install that will not boot

my particular use case

I installed Windows 10 on a HDD then upgraded the system to a SSD, then used GParted to copy the partitions to the SSD, however the system would not boot, and the automatic repair Wizard provided by the Windows 10 install media, could not resolve the issue.

Once in the repair console / command prompt issue the below commands to resolve 🤞 boot issues.

Use the command prompt shift+f10 from the Windows Installer USB

launch a command prompt once the setup dialog appears

BOOTREC /FIXMBR
BOOTREC /FIXBOOT
bootrec /scanos
BOOTREC /RebuildBcd

🚨 It is imperative to use a Windows install media that is not 1809 due to issues with the above mentioned commands. I was able to resolve the boot issues on the Gateway EC14 using Windows 10 1703 ISO. see for more details

additional link, more commands to issue learn more

fix error 0xC0000225 in Windows 10

When using rufus to create a bootable Windows 10 install media, rufus has an option of pressing alt + e to allow one to select creating a dual UEFI / BIOS install media if required, but it's discouraged because one should more than likely select either BIOS or UEFI but not both.

To find the PID of a process using a command prompt in Windows 10

sc queryex [SERVICE_NAME]
echo "example"
sc queryex wuauserv

To kill a PID using the number ID of the PID

taskkill /PID 4242 /F

To run a powershell script, ie. a file with a .ps1 extension launch / run the script from within a powershell terminal.

I had issues attempting to run a powershell script from a command prompt or even using Cmder

🚨 Pressing control + shift at the same time causes the keyboard to enter alternate chars, ie. É instead of /

To launch an elevated command prompt from the run dialog box windows™️ + r input cmd and while pressing enter hold down the shift and control keys while pressing enter, and Windows should launch an elevated command prompt.

To launch the Microsoft Edge web browser from the command prompt

microsoft-edge:

To open a dialog displaying the current version of Windows

winver

The above command should work in cmd.exe, PowerShell, and Cmder.exe

To check and see if there are Windows 10 updates available via a CLI

explorer ms-settings:windowsupdate

The above command will launch a explorer window where windows updates can be downloaded and installed.

❗️ As of Windows 10 1809 I have not been able to figure out how to download and install updates via a CLI.

To see how long it took for a Windows 10 system to boot, open Event Viewer

📸 Event Viewer

windows-10-boot-time

To access the emoji context menu

Win™+.

™️ is a reference to the Windows key.

To get a diagnostic report, a la System Inoformation on macOS on Windows™️

  1. Open a run dialog box Win™️+r
  2. Input msinfo32 into the box, press enter and a diagnostic report of the system should display within a window.

Windows 7 / General Notes

To enable password less login on Windows 7 see

To fix boot issues using a Windows 7 install medium learn more

chkdsk C: /f
exit

bootrec.exe /fixmbr
bootsect.exe /nt60 all /force

bootrec.exe /rebuildbcd

extending windows 7 sysprep limit

see

TODO: copy instructions from post into this document for preservation reasons.

Working with environment variables on Windows 10

To set an environment variable for a running terminal session and then have it clear when the session finishes in Windows 10

set code=C:\opt\code

To set the value of an environment variable permanently

setx code "C:\opt\code"

To print the value of an environment variable

echo %HOME%

Running Windows 10 in VirtualBox

For a sane mouse scrolling experience within a Windows 10 virtual machine, select the standard PS/2 Mouse

  • Machine SettingsSystemMotherboardPointing Device: PS/2 Mouse

From my experience running Windows 10 in VirtualBox on a MacBook with a Retina display, ie. HiDPI, it's useful to set the resolution to 1600x1200 and scale the display to 150% so that my eyes don't pop out of my head. 🧟‍♂️. Those settings are applied in Windows 10 itself and are unrelated to VirtualBox settings on macOS.

Working with Linux subsystem on Windows 10 WSL

To use Linux subsystem on Windows 10, Developer Mode needs to enabled, and Windows should be a Professional version, and NOT a Home version.

To enable Developer Mode

Search for Use developer features after clicking the Win™️ key. Within the Settings window look for a radio button / toggle to enable Developer mode.

After Developer mode has been enabled then Windows Subsystem for Linux can be installed via the Control Panel > Add / Remove Apps > Windows Apps, or via a PowerShell.

After the Distro has been installed, it will require initialization, see

To manually install a version of Linux on Windows 10 see the following microsoft doc

To print a list of filesystems that can be mounted on a GNU+Linux or even a WSL

cat /proc/filesystems

To mount an already mapped network share that has been mapped to a local drive letter, ie. Z

sudo mkdir /mnt/z
sudo mount -t drvfs 'Z:' /mnt/z

Working with Chocolately

To install chocolately on Windows 10 see the chocolately website.

chocolately can be installed via cmd.exe or powershell.exe just make sure the cmd.exe is run with elevated priviliges.

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

The above command is for cmd.exe

To paste the above command into either powershell or cmd.exe

alt + + e + p

A decent window size for command prompt, ie. cmd.exe is

Width 90 Height 30

A decent window size for power shell is

Width 100 Height 30

Working with PowerShell on Windows 10

To avoid the mr-fancy-script.ps1 is not digitally signed.

Set-ExecutionPolicy -Scope CurrentUser Bypass

Working with git on Windows 10

Cannot figure out how to use git to clone git repositories using the git protocol, however https appears to be working. 👍

To show the settings in a user derived git configuration file

git config --list

Working with Cmder

To set an alias for git status

alias gs=git status $*

To set an alias for git push

alias gp=git push $*

To refresh "shell" / environment using cmder

refreshenv

The above command is useful when changes to such things as PATH have been made, and the terminal does not need to closed and reopened.

Working with Firefox

To access a locally running app, ie. a Node.js / Express app on a local port on Windows 10

  1. about:config
  2. search for ports
  3. add the below setting
network.security.ports.banned.override
  1. Add a list of ports, ie. 4242,3000

For more information see

Working with networking in Windows 10

To be able to ping a Windows host on a LAN

Open the firewall settings, and make sure firewall settings are disabled for private networks.

Connecting to a SMB share

To access a SMB share on a local network in Windows 10

  1. Open the run dialog box, ie. +.
  2. Insert the IP address of the SMB server you would like to connect to
\\[192.168.1.42]

The IP address of the SMB server can be specified or the local discoverable name can be used, which is preferred. ie. mr-fancy-42-computer.local

Ex

\\mr-fancy-computer.local

Inputting \\ is imperative to being able to connect to the share. 👍

  1. A dialog box should appear, prompting for credentials.

Useful Links 🔝

⚠️ **GitHub.com Fallback** ⚠️