Skip to main content

Posts

Showing posts with the label Windows Tips and Tricks

Get Network Interface Card GUID in Windows

Get Network Interface Card GUID in Windows Method 1 - using netsh PS C:\> netsh lan show interfaces Below shows sample output There is 1 interface on the system: Name : Ethernet Description : Microsoft Hyper-V Network Adapter GUID : 17ab0088-6ca5-4aac-82bb-c533700cda21 Physical Address : 00-15-5D-1C-45-00 State : Connected. Network does not support authentication. Method 2 - using PowerShell WMI PS C:\> Get-CimInstance -ClassName Win32_NetworkAdapter | Select-Object -Property DeviceID, GUID, Name Below shows sample output DeviceID GUID Name -------- ---- ---- 0 Microsoft Kernel Debug Network Adapter 1 {17AB0088-6CA5-4AAC-82BB-C533700CDA21} Microsoft Hyper-V Network Adapter 2 WAN Miniport (SSTP) 3

Control Panel console command equivalent

There are cases where you might need to run some of the Control Panel applets to perform quick configuration like add user accounts under different user credentials(say administrator account). Anyway below lists the files and equivalent Control Panel applet. Command Description access.cpl Accessibility Options appwiz.cpl Add or REmove Programs bthprops.cpl Bluetooth configuration desk.cpl Display Properties firewall.cpl Windows Firewall hdwwiz.cpl Add Hardware Wizard inetcpl.cpl Internet Properties intl.cpl Regional and Laguage Options irprops.cpl Infrared Properties joy.cpl Game Controllers jpicpl32.cpl Java Control Panel main.cpl Mouse Properties mmsys.cpl

Install Windows Terminal using winget

Install Windows Terminal using winget Windows Terminal is a new, modern, feature-rich, productive terminal application for command-line users. It includes many of the features most frequently requested by the Windows command-line community including support for tabs, rich text, globalization, configurability, theming & styling, and more. To install Windows Terminal using winget , do: PS C:\>winget install Microsoft.WindowsTerminal Note: To install winget on Windows 2022 follow this link .

Getting "Store is not available in your country or region" in Microsoft Store

Getting "Store is not available in your country or region" in Microsoft Store When I open Microsoft Store I am getting the following error message on Windows 10 20H2 Store is not available in your country or region Code: 0x87e10002 CV: SGmLmAU6/UWYL9FO To fix this, open Control Panel | Clock and Region | Region , check if it shows the following: Format: English (United States) Match Windows display language (recommended) If yes, then change it to: Format: English (United States) Click on Apply and then close and open Microsoft Store .

Native boot into VHDX

Native boot into VHDX Why would you boot into VHDX instead of dual booting? Because it is easy(ier) vs adjusting partition post-Windows installation. And the partition layout may not be easy to adjust without using advanced partitioning tool. Also booting into native VHDX gives full access to the hardware without the penalty of virtualization. This allow you to run say other virtuaization on top of native boot! I prepare VHDX using Hyper-V and once it is ready to my liking I use the VHDX to boot into it. Below are the general steps: Copy a VHDX into the desired location. For example, copy C:\VMs\W21H1M2\Virtual Hard Disks\W21H1M2.vhdx to C:\VMs\NaviteBoot\NaviteBoot.vhdx Mount C:\VMs\NaviteBoot\NaviteBoot.vhdx using File Explorer Note of volume/drive letter for the mounted VHDX, e.g. V: Change directory to V:\Windows Run bcdboot V:\Windows . This should have added the VHDX into the boot options Optional, change the boot description. Get the GUID entry for the jus

Windows Quick Tip: Enable/Disable Run Dialog history

Windows Quick Tip: Enable/Disable Run Dialog history Windows Run Dialog history can be disalbed for security or enabled for convenience To enable/disable, navigate to the registry key below: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced Start_TrackProgs DWORD 0 = Turn off 1 = Turn on

How to properly delete Windows10Upgrade folder

How to properly delete Windows10Upgrade folder So you are running out of storage and you are staring at Windows10Upgrade and wondering how you can get rid of it correctly? Well, fear no more, it is easy. Open up Control Panel and navigate to Control Panel\All Control Panel Items\Programs and Features or appwiz.cpl . Then look for Windows 10 Upgrade Assistant and uninstall the application.See below for how it looks like.

Get hostname from an IP in Windows

Get hostname from an IP in Windows Method 1 - Using built-in ping. This only works if a working DNS server has reverse look-up configured. c:\>ping -a 8.8.8.8 The hostname for 8.8.8.8 was returned as dns.google , below shows the output details. Pinging dns.google [8.8.8.8] with 32 bytes of data: Reply from 8.8.8.8: bytes=32 time=52ms TTL=112 Reply from 8.8.8.8: bytes=32 time=56ms TTL=112 Reply from 8.8.8.8: bytes=32 time=59ms TTL=112 Reply from 8.8.8.8: bytes=32 time=56ms TTL=112 Ping statistics for 8.8.8.8: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 52ms, Maximum = 59ms, Average = 55ms Method 2 - Using nslookup c:\>nslookup 8.8.8.8 This is the same as method 1, it needs a working DNS to provide the information Server: somedc.com Address: some_ip_here Name: dns.google Address: 8.8.8.8 Method 3 - Using nbtstat c:\>nbtstat -a 192.168.1.101 With the added bonus that

Resolve Windows NetBIOS name in Ubuntu 20.04

Resolve Windows NetBIOS name in Ubuntu 20.04 It is very common to have a mix of Windows and Ubuntu/Linux in an enterprise environment. There are scenarios where Ubuntu can get IP via DHCP but not enroll the machine to DNS. To resolve Windows NetBIOS machine name in Ubuntu in a workgroup environment do the following. Install nss-winbind like below $: sudo apt install libnss-winbind Then update /etc/nsswitch.conf . On Ubuntu 20.04, this will be line 12, which should look like below: hosts: files wins dns Refs: https://8thstring.blogspot.com/2010/05/resolve-netbios-name-in-ubuntu.html

Change Windows 10 to dark mode and black background

Change Windows 10 to dark mode and black background using Registry (cmd.exe) c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d "0" /f c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d "0" /f c:\> powershell -command add-type -typedefinition """"using System;`n using System.Runtime.InteropServices;`n public class PInvoke { [DllImport(`"""user32.dll`""")] public static extern bool SetSysColors(int cElements, int[] lpaElements, int[] lpaRgbValues); }""""; [PInvoke]::SetSysColors(1, @(1), @(0x000000))   Ref: https://superuser.com/questions/1214337/update-hkcu-control-panel-colors-background-via-cmd-and-apply-immediately

How to delete Windows protected partition

How to delete Windows protected partition Run diskpart in elevated command prompt, like: c:\> diskpart Then follow the prompts like below: Microsoft DiskPart version 10.0.18362.1171 Copyright (C) Microsoft Corporation. On computer: M1 DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 180 GB 53 GB * DISKPART> select disk 0 Disk 0 is now the selected disk. DISKPART> list partition Partition ### Type Size Offset ------------- ---------------- ------- ------- Partition 1 System 100 MB 1024 KB Partition 2 Reserved 16 MB 101 MB Partition 3 Primary 126 GB 117 MB Partition 4 Recovery 499 MB 126 GB DISKPART> select partition 4 DISKPART> delete partition override DISKPART> exit Leaving DiskPart...

Windows containers cannot use USER instruction to change user with a password

 I have a Dockerfile like below: FROM mcr.microsoft.com/windows/servercore:20H2 as final RUN net user timus P@$$w0rd123!@# /add /Passwordchg:No RUN WMIC USERACCOUNT WHERE "Name='timus'" SET PasswordExpires=FALSE RUN net localgroup administrators timus /add USER timus RUN whoami Running this will fail with an error message like below: C:\mydocker>docker build -t myimages:1.0.0 -f Dockerfile Sending build context to Docker daemon 678.8MB Step 1/6 : FROM mcr.microsoft.com/windows/servercore:20H2 as final ---> 4943ff812624 Step 2/6 : RUN net user timus P@$$w0rd!@# /add /Passwordchg:No ---> Running in 95d4d70138d8 The command completed successfully. Removing intermediate container 95d4d70138d8 ---> d00130167ea2 Step 3/6 : RUN WMIC USERACCOUNT WHERE "Name='timus'" SET PasswordExpires=FALSE ---> Running in 0d05945d8f70 Updating property(s) of '\\0D05945D8F70\ROOT\CIMV2:Win32_UserAccount.Domain="0D05945D8F70",Name=&q

My docker cheat sheet

My docker cheat sheet Installing base container image for Server Core 2019. If you are running Windows Server 2019 virtual machine, this will allow you to run the container in process isolation mode instead of Hyper-V isolation. Process isolation is more light-weight and allows you to run a Server 2019 VM with dynamic memory setting in Hyper-V. PS C:\> docker image pull mcr.microsoft.com/windows/servercore:ltsc2019 To list downloaded images, do PS C:\> docker images This will show something like below PS C:\> docker images REPOSITORY TAG IMAGE ID CREATED SIZE mcr.microsoft.com/windows/servercore ltsc2019 3eaa9ebbf51f 5 weeks ago 5.25GB To run a Windows container based on servercore:ltsc2019, do: PS C:\> docker run -it mcr.microsoft.com/windows/servercore:ltsc2019 cmd.exe This will open a cmd.exe prompt. This should allow you to play inside that container. This contain

Can’t install Hyper-V Management Tools on Windows Server 2019 if the machine/VM does not support virtualization

Can’t install Hyper-V Management Tools on Windows Server 2019 if the machine/VM does not support virtualization   I tried to install PowerShell Direct to manage docker containers but can't install the feature, trying to run: PS C:\> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell  yields with error below: PS C:\Users\Administrator> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-PowerShell Enable-WindowsOptionalFeature : One or several parent features are disabled so current feature can not be enabled. At line:1 char:1 + Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V- ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : NotSpecified: (:) [Enable-WindowsOptionalFeature], COMException     + FullyQualifiedErrorId : Microsoft.Dism.Commands.EnableWindowsOptionalFeatureCommand Apparently this happens when the OS is running on a ma

Creating new Windows admnistrator user from the command line

Creating new Windows admnistrator user from the command line I am not quite comfortable with too few options available when creating a new user in Windows 10 Home edition, so I do the following. c:\> net user timus P@$$w0rd123!@# /add /Passwordchg:No c:\> WMIC USERACCOUNT WHERE "Name='timus'" SET PasswordExpires=FALSE c:\> net localgroup administrators timus /add

Changing the color of the title bar via registry

This will change the title bar to black c:\> reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v "AutoColorization" /t REG_SZ /d "0" /f c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /v "ColorPrevalence" /t REG_DWORD /d "1" /f c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /v "AccentColor" /t REG_DWORD /d 4282203453 /f c:\> reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM" /v "AccentColorInactive" /t REG_DWORD /d "13882323" /f