Skip to main content

Windows

Install

# Bypass internet connection to install Windows 11
# Oops, you’ve lost internet connection
# Shift + F10
OOBE\BYPASSNRO

Boot from VHDX

# Mount Windows 11 ISO
Dism /apply-image /imagefile:F:\sources\install.wim /index:1 /ApplyDir:V:\

bcdboot V:\Windows

OS

# Tool to test a user account and password (test login)
runas /u:yourdomain\a_test_user notepad.exe

taskkill /f /PID 6092

# reboot to settings
shutdown /r /o /f /t 00

# Activation error 0x80070002
# Sync time
# Windows Update

Net

' Check port with windows powershell
tnc 192.168.1.2 -port 3389

' Check who using port
netstat -aon|findstr "80"

' Check task
tasklist|findstr "7532"

' Ping: Transmit Failed. General Failure
ipconfig /flushdns
netsh winsock reset

IPBan

# Install

# PowerShell with adminitrator
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/DigitalRuby/IPBan/master/IPBanCore/Windows/Scripts/install_latest.ps1'))

# Old, windows 11 not generate log.
dir C:\my\service\IPBan-Windows | Unblock-File

New-Service -Name "IPBAN" -BinaryPathName "c:\path\to\service\DigitalRuby.IPBan.exe" -StartupType automatic -DisplayName "IPBAN" -Description "Automatically builds firewall rules for abusive login attempts: https://github.com/DigitalRuby/IPBan"
Get-WmiObject win32_service -Filter "name='IPBAN'"
Start-Service IPBAN
sc.exe config IPBAN start= delayed-auto

# English
auditpol /set /category:"Logon/Logoff" /success:enable /failure:enable
auditpol /set /category:"Account Logon" /success:enable /failure:enable

# ZTW
auditpol /set /category:"登入/登出" /success:enable /failure:enable
auditpol /set /category:"帳戶登入" /success:enable /failure:enable

# app path
C:\Program Files\IPBan

# Uninstall
sc.exe stop IPBAN
sc.exe delete IPBAN

ipban.config config ipban

ban.txt ban ip at next CycleTime

unban.txt unlock ip at next CycleTime

search log

# Find address, user name, source
DigitalRuby.IPBanCore.Logger|Login succeeded

Restart explorer when desktop hangups

taskkill /f /IM explorer.exe
start explorer.exe
exit

Removing one particular autocomplete

Shift + FN + Delete

MongDB On windows

Start powershell with administartor

mkdir C:\temp\mongo\data\db

mkdir C:\temp\mongo\data\log

Manual create C:\temp\mongo\data\mongod.cfg

systemLog:
destination: file
path: C:\temp\mongo\data\log\mongod.log
storage:
dbPath: C:\temp\mongo\data\db

mongod.exe --config "C:\temp\mongo\data\mongod.cfg" --install

net start MongoDB

mongo.exe

net stop MongoDB

IPBan Service

# install
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/DigitalRuby/IPBan/master/IPBanCore/Windows/Scripts/install_latest.ps1'))

Windows Terminal

Add new profile.

"profiles":
{
...
"list":
[
...
{
...
"commandline": "ssh [email protected]",
"name": "vm7 ubuntu20.04Server",
...
}
]
},

Enable Ping

# Enable IPv4 – This will create an exception in the default Windows firewall rule.

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol="icmpv4:8,any" dir=in action=allow

# For IPv6:

netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol="icmpv6:8,any" dir=in action=allow

# To disable ping on IPv4:

netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=block

# For IPv6:

netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol=icmpv6:8,any dir=in action=block

Powershell

Multi line: Ctrl+Q→Shift+A

RabbitMQ

# Verify rabbitmq credentials are valid
curl -i -u user:passw0rd http://vmwin2022:15672/api/whoami

SSH

SSH Login linux

Windows Side

Open PowerShell

# Generating public/private rsa key pair.
# Enter file in which to save the key (C:/Users/%USERNAME%/.ssh/id_rsa):
# Created directory 'C:\Users\rojarsmith/.ssh'.
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
# Your identification has been saved in C:/Users/%USERNAME%/.ssh/id_rsa.
# Your public key has been saved in C:/Users/%USERNAME%/.ssh/id_rsa.pub.
ssh-keygen

ssh-keygen -t rsa -b 4096 -C "[email protected]" -f D:\id_rsa

Only multi key need modify config.

C:\Users%USERNAME%\.ssh\config

Host MY-HOST
Hostname 127.0.0.1
Port 80
User my
IdentityFile ~/.ssh/id_rsa

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

Delete all old key information in .ssh/known_hosts.

Linux side

# upload id_rsa.pub, confirm the existence of the file
cd ~/
mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
cat id_rsa.pub >> .ssh/authorized_keys
rm id_rsa.pub

Desktop ICON space

regedit.exe

HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics

IconSpacing = -1125

IconVerticalSpacing = -1125

PM2

spawn sh ENOENT

use git bash

pacman -S mingw-w64-x86_64-osslsigncode
pacman -S winpty # Fix can not prompt input
Restart MSYS2

winpty openssl pkcs12 -in Certificates-Unify.p12 -nocerts -out Certificates-Unify.key
openssl x509 -in win-codesign.cer -out win-codesign.cert -inform DER # cer == cert
./detached-sig-create.sh -key Certificates-Unify.key

PotPlayer

# Add to C:\Windows\System32\drivers\etc\hosts
127.0.0.1 get.daum.net

Python

# For python 3.x
python --version

pip3 install --upgrade pip

pip install virtualenv
python -m venv .venv
.\.venv\Scripts\activate.bat
deactivate

pip install -r requirements.txt
pip install requests

pip freeze > requirements.txt


pip install -U urllib3
# No update
pip install -v requests2==2.27.1

RDP

Modify record of RDP client:

Computer\HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default MRU*

Win 11 classic right click menu

reg add HKCU\Software\Classes\CLSID{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /ve /f

Msys2

# Update the package database and base packages.
pacman -Syu

# Update the rest of the base packages.
pacman -Su

# mingw-w64 GCC
pacman -S --needed base-devel mingw-w64-x86_64-toolchain

# jq, a lightweight and flexible command-line JSON processor.
pacman -S mingw-w64-x86_64-jq

# install gradle
pacman -S gradle

# Set PATH
export PATH=/C/tool/hugo_0.93.3_Windows-64bit:$PATH

Reload Driver

Win + Ctrl + Shift + B

Default Resolution

Avoid window shrinking if the display off line.

regedit

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration

Find SIMULATED...:

PrimSurfSize.cx = 1920 PrimSurfSize.cy = 1080

Sub folder 00...:

ActiveSize.cx = 1024 ActiveSize.cy = 768

Monitor OSD:

Disable Deep Sleep.

Version

Windows 11/10 International English vs. English

In general, Windows International targets people who know British English, and the English version is meant for Windows users living in the United States.

International English | English

British English | American English

its country 24 hrs format | US Pacific Time(PST) 12 hours format

spells the word as ‘coloUr’ | spells the word as ‘colOr’.

VMware

Ubuntu22.04 LTS copy & past can not work.

Change login session from Wayland to xorg at login UI.

VPN

Error: OpenVPN connector disconnect frequently.

  • Check rules of windows firewall completely blocks all software except VPN client.

Kill Switch

  1. Open Windows Defender Firewall with Advanced Security on Local Computer.
  2. Set Inbound and Outbound Block for Domain Profile and Private Profile.
  3. Add new rules allow Remote UDP Port 53, 1194 in Outbound.
  4. Add new rules Scope allow Remote 10.8.0.1-10.8.0.254 in Inbound.
  5. Add new rules Scope allow Local 10.8.0.1-10.8.0.254 in Outbound.

Windows Store

Fix: “ms-windows-store:PurgeCaches The App didn't start” error in Windows 11

Get-AppXPackage | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

WSL2

# Install WSL command
wsl --install

# Check which version of WSL
wsl -l -v
wsl --list --verbose

# Change versions
wsl --set-version DISTRO_NAME 2

# Start
wsl -d Ubuntu

Scenario

Allows the guest to open host applications

Make sure the virtual machine's configuration allows the guest to open host applications

Win11 Lite leak Microsoft Edge.

Msixbundle

Add-AppxPackage WindowsCamera_2022.2210.9.Msixbundle

Split Autio

ffmpeg -i input.mp4 -vn -acodec copy output.m4a