Tag Archives: Windows 10

How to Block Your Child from Certain Websites

Motivation:

You have a child and do not want him to be able to install games from Microsoft Store or play online games on certain websites or run a specific program.

Solution:

I. Prevent your child from installing games Microsoft Store.
This method only applies to Windows 10 Enterprise and Windows 10 Education.

  1. Type gpedit in the search bar to find and start Group Policy Editor.
  2. In the console tree of the snap-in, click Computer Configuration, click Administrative Templates, click Windows Components, and then click Store.
  3. In the Setting pane, click Turn off the Store application, and then click Edit policy setting.
  4. On the Turn off the Store application setting page, click Enabled, and then click OK.

Note: Enabling Turn off the Store application policy turns off app updates from Microsoft Store.

Source: https://docs.microsoft.com/en-us/windows/configuration/stop-employees-from-using-microsoft-store

II. Block all websites except some websites using one of the software below.

  1. Surfblocker.

III. Block certain websites in your modem settings in order to prevent your child from playing online games on these websites.

If you are using FTP GPON Modem then you can

  1. Click on the Access tab on the top,
  2. Click on the Filter tab on the left,
  3. Select URL Filter as Filter Type Selection,
  4. Select 1 as URL Index,
  5. Enter URL (host) (e.g. bluestacks.com or roblox.com),
  6. Select Enabled as Individual active,
  7. Click on the Save button.
  8. Repeat the procedure for other hosts with other URL Indexes (i.e. 2, 3, 4, etc.).

    IV. Block all Windows users from running certain programs.

    1. Type gpedit.msc in search box, then press Enter.
    2. Expand User Configuration > Administrative Templates, then select System.
    3. Double click the policy Don’t run specified Windows applications.
    4. Set the policy to Enabled, then select Show.
    5. Add the programs you would like to prevent the user from running to the List of disallowed applications. Use the name of the application launching file such as chrome.exe.
    6. Restart your computer.

     

     

     

    How to Install Ubuntu and Windows as a Dual Boot

    Motivation:

    You are want to install Windows 10 and Ubuntu 18.04 (or Windows 11 and Ubuntu 22.04) as dual boot for completing some machine learning tasks.

    Prerequisites:

    You need to have a 8Gb USB stick.

    Solution:

    Step 1:

    • Note: You can skip this step if you are installing Windows 11 and Ubuntu 22.04.
    • Go to BIOS, select the UEFI option in Boot List Option.
    • Disable the Enable Legacy option ROMS option.
    • Disable Secure Boot.

    Step 2:

    • Install Windows 10 or Windows 11.
    • Create a free partition for Ubuntu.

    Step 3:

    Step 4: Install Ubuntu.

    • Select Minimal installation option, Download updates while installing Ubuntu option on Updates and other software screen.
    • Select Install third-party software for graphics and Wi-Fi hardware option and enter a password on Updates and other software screen. This password will be used on first boot after install.
    • Select Something else on Installation type screen.
    • Select free space partition that you created for Ubuntu.
    • Click the + sign.

    • Create an EFI System Partition and set its size to be 552MB if it does not exist.
    • Create a swap area. Set its size to be twice as your RAM size, e.g. 65536Mb swap area for 32Gb RAM.
    • Create a Root partition. Set its size to be all the remaining free space to optimize your space.

    • Click Install Now button.
    • On first boot after install, select Enroll MOK.
    • Enter the password that you entered to install third party drivers.

     

     

     

    How to Remove Caches and Temporary Files in Windows

    Motivation:

    You may want to remove caches to update an application status or fix some issues.
    You may need to remove temporary files to get some more free disk space.

    Solution:

    Try clearing files and folders in the directories below.

    • %USERPROFILE%\AppData\Local\Temp
    • C:\Windows\Temp
    • C:\Users\All Users\Package Cache
    • C:\Windows\SoftwareDistribution\Download
    • C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files

    Sometimes you may get permission error when deleting files or folders. If this is true then try the following command before deleting these files and folders.

    takeown /f C:\Users\All Users\Package Cache /r /d y
    icacls C:\Users\All Users\Package Cache /grant administrators:F /t

    How to Hide Your IP Location using VPN in Windows 10

    Motivation:

    You have VPN credentials and want to hide your IP location for a specific purpose.

    Solution:

    • Setup a VPN connection using your VPN credentials.
    • Type and click View network connections in Search box to open the Network Connections window.
    • Right-click the VPN connection and select Properties in the menu.
    • Select the Networking tab.
    • Click the Internet Protocol Version 4 (TCP/IPv4) row, then click the Properties button.
    • Click the Advanced… button.
    • Select Use default gateway on remote network option.

    How to Run Docker on a Windows 10 Hyper-V Virtual Machine

    Motivation:

    You want to have an environment with Docker for development and testing  without interfering your stable machine.

    Context:

    You have enabled Hyper-V, created a virtual machine and install Windows 10 to the virtual machine.
    When installing Docker in the virtual machine, Docker requires that the Nested Virtualization feature must be enabled for the virtual machine.
    You open PowerShell, execute below command in the virtual machine:

    Get-ComputerInfo -property "HyperV*"

    You find that find that the HyperVRequirementVirtualizationFirmwareEnabled feature is not available.

    Procedure:

    1. Download this PowerShell script. The main interesting command in this script is the command below that enables Nested Virtualization for a virtual machine.

    On the host machine execute below command:

    Set-VMProcessor -VMName $vmName -ExposeVirtualizationExtensions $true

    2. Open PowerShell as Administrator and execute 2 commands below.

    Set-ExecutionPolicy -ExecutionPolicy "Unrestricted"
    .\Enable-NestedVm.ps1 "Windows 10 Dev"
    
    "Windows 10 Dev" is the virtual machine name without quotes.

    3. Install Docker. Restart the virtual machine.

    4. Install any additional software if needed, restart the virtual machine again.

    5. Open a Command Prompt and test Docker installation.

    docker pull hello-world && docker run hello-world
    
    Rerun the command if you get an issue in the first run.
    

     

     

    How to Install a Fresh Windows Booted from UEFI Secure Boot using a Bootable USB

    Motivation:

    Most of Windows machines are delivered with a limited Windows version and unnecessary preinstalled software.

    You want to format the hard drive and install a fresh Windows that can be booted from UEFI secure boot to improve machine performance and stability.

    Prerequisites:

    You need to have a 8Gb USB stick and an ISO file of Windows 10, version 21H2 or Windows 11, version 23H2.

    Solution:

    Step 1: Backup your machine and create an USB recovery by entering “Create a recovery drive” text to the search box on the task bar and follow the instructions.

    Step 2: Create a bootable USB with Windows installation files.

    If you plan to install Windows 11 then you can use Windows 11 Installation Assistant to create a bootable USB (click Download Now link below Create Windows 11 Installation Media section), and skip the commands below.

    If you plan to install Windows 10 then you can use the commands below to create a bootable USB.

    • Right click Windows logo, click Command Prompt (Admin).
    • Enter diskpart.exe, press Enter.
      DISKPART> list disk
      DISKPART> select disk 1 -- the USB disk should be selected, the number may be different in your machine.
      DISKPART> clean
      DISKPART> create partition primary size=1024
      DISKPART> select partition 1
      DISKPART> active
      DISKPART> format quick fs=fat32
      DISKPART> assign
      DISKPART> create partition primary
      DISKPART> select partition 2
      DISKPART> format quick fs=ntfs
      DISKPART> assign
      DISKPART> exit
    • Double click on the Windows ISO file to create a virtual drive.
      xcopy f:\sources\boot.wim d:\sources\ /s /e
      
      where 
      f: the virtual drive and 
      d: the USB fat32 partition.
      We copy only the f:\sources\boot.wim file to d:\sources\.
      
      robocopy f:\ d:\ /IS /S /XD sources
      
      where 
      
      f: the virtual drive and 
      d: the USB fat32 partition.
      We copy everything from f:\ to d:\ except the sources folder.
      
      xcopy f:* e:\ /s /e 
      
      where 
      f: the virtual drive and 
      e: the USB ntfs partition.

    Step 3: Install Windows.

    1. Plug the USB to a machine.
    2. For a Dell laptop, power on the machine, press F12 until a one-time boot up menu appears. Select the option to boot the machine from the USB. (You may need to access BIOS to select the UEFI option for Boot Sequence, and select the AHCI option for SATA operation).
    3. For a Sony VAIO laptop, power off the machine, then press the Assist button to enter VAIOCare. Select the option to boot the machine from the USB. (You may need to access BIOS to enable the option to boot the machine from an USB).
    4. For a ThinkPad laptop, power on the machine, press F12 until a one-time boot up menu appears. Select the option to boot the machine from the USB. Alternatively go to Settings > Update & Security > Recovery, click the Restart now button under the Advanced setup section and follow the instructions to boot the machine from a USB.
    5. Follow the instructions to install Windows. Set Windows partition size to 614516Mb for DellPrecision if you want to have 600Gb C drive, or 262260Mb for DellXPS if you want to have a 255Gb C drive, or 819815Mb for ThinkPad if you want to have a 800Gb C drive.
    6. You can delete all the partitions, including MRP (Microsoft Reserved Partition – this is just a reserved partition for Windows later use if needed), ESP (EFI System Partition – this is where UEFI firmware files are stored to boot Windows), WINRETOOLS (Windows Recovery Environment (WinRE) Tools – this is where files for repairing or recovering Windows are stored), and PBR image (this is where original the manufacture Windows installation file  are stored) because you already created an USB recovery in the Step 1.

    Step 4: Configure Windows for Developer’s needs.

    1. Change Computer Name, turn off System Restore, enable Remote Desktop,
    2. Change Time Zone.
    3. Add Wireless LAN Service feature for Windows Server 2019.
    4. For a Dell laptop, install Dell Wireless 1820A 1830 WiFi Driver. Set battery charge threshold value to 50% in BIOS.
    5. Turn on Network discovery and file sharing by clicking on Network icon on the left side of Explorer.
    6. Activate Windows.
    7. Disable Hibernation (powercfg.exe /h off).
    8. Configure Power options (Hard disk >> Turn of hard disk after: 0, Wireless Adapter Settings >> Power Saving Mode: Maximum Performance, Sleep >> Sleep after: 0).
    9. Uninstall unnecessary applications.
    10. Use the manage-bde -status command to show BitLocker status (There is a space between bde and status). Use the manage-bde -off C: command to turn off BitLocker for the C drive.
    11. Turn on Automatic Logon.
    12. For a Dell laptop, go to Dell Support, scroll down and enter your Dell laptop service tag, click Search button, click Drivers & Downloads tab, expand Find drivers section, install Dell Command Update, and use it to check and install necessary drivers.
    13. For Windows Server 2019, install Chipset Device, Graphics, Audio, Ethernet, Bluetooth, Memory Card Reader, Dynamic Platform and Thermal Framework driver.
    14. For a ThinkPad laptop, install Lenovo Vantage. Set battery charge threshold value to 40% using Lenovo Vantage.
    15. Turn the following Windows features on: .NET 3.5, ASP.NET 4.8, Hyper-V, Internet Information Services, Telnet Client.
    16. Install Total Commander, Office 365 Offline, MS Project 2016, MS Visio 2016, MS SQL Server 2016, Visual Studio 2022, Adobe Acrobat Pro DC v15.8, Adobe Photoshop CC 2015, TortoiseSVN 1.14.6
    17. Install Remote Desktop Connection Manager, PuTTY 0.80, WinSCP 6.3.
    18. Create a VPN connection. Configure the VPN connnection.
    19. Prevent normal traffic from going through VPN: Go to Control Panel >> Network and Sharing Center >> Change adapter settings >> Right click VPN Connection >> Properties >> Select the Networking tab:
      – Disable Internet Protocol Version 6 (TCP/IPv6).
      – Select Internet Protocol Version 4 (TCP/IPv4) >> Properties >> Advanced >> IP Settings: Uncheck the Use default gateway on remote network option.
    20. Install Python 3.6.8, TensorFlow, Keras
      1. Install Firefox, MPC-HC.1.7.13. (Go to View >> Options >> Player and turn off all options under the History section. Go to View >> Options >> Playback and disable the Auto-zoom feature.)
      2. Configure secure protocols using IIS Crypto GUI (Select Best Practices, disable TLS 1.0, TLS 1.1, MD5, SHA).
      3. Install Hyper-V, create an external Virtual Switch for Internet access, set Scheduler Type to Core.
      4. Apply Windows updates to the machine.

       

      How to Count the Number of Source Lines of Code, Find and Replace Content in Multiple Files

      Motivation:

      • You have a source code folder and want to know the number of source lines of code.
      • You want to find and replace a string with another string in multiple files.

      Procedure:

      1. Right click Start icon, click on Command Prompt (Admin) or Windows Powershell (Admin)
      2. Assume that the source code folder location is C:\Users\admin\Downloads\test, type below commands and press Enter
      cd C:\Users\admin\Downloads\test

      3. Assume that the source code file extension is .py, type below commands and press Enter

      type *.py | Measure-Object -line

      SLOC

      4. Assume that you want to find and replace “.flac” string with “.wav” string in all .cue files in the “E:\New Music\” directory, type below command, then press Enter.

      Get-ChildItem "E:\New Music\" *.cue -recurse | ForEach { (Get-Content -Path $_.FullName).Replace(".flac", ".wav") | Set-Content -Path $_.FullName }

      How to Manually Install PHP 8.1 on Windows 10

      Motivation:

      • You want to understand how PHP works with IIS.
      • You want to prepare a PHP or WordPress development environment on Windows.
      • You want to update PHP to any version to address compatibility or security issues on Windows.

      Solution:

      • Install CGI for IIS on Turn Windows features on or off > Internet Information Services > World Wide Web Services > Application Development Features > CGI.
      • Download VS16 x64 Non Thread Safe package under PHP 8.1 section on https://windows.php.net/download/.
      • Extract the ZIP file to C:\Program Files\php-8.1.10-nts-Win32-vs16-x64 folder.
      • Download the cacert.pem file and move it to the C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\extras\ssl folder.
      • Copy the php-.ini-development file to php.ini.
      • Open the php.ini file and uncomment the following lines
        fastcgi.impersonate = 1;
        
        cgi.fix_pathinfo=1;
        cgi.force_redirect = 1 (and change the value to 0, i.e. cgi.force_redirect = 0)
        
        extension_dir = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\ext"
        
        extension=curl
        extension=fileinfo
        extension=gd
        extension=gettext
        extension=mbstring
        extension=exif ; Must be after mbstring as it depends on it
        extension=mysqli
        extension=openssl
        extension=pdo_mysql
        
        error_log = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\php_errors.log"
        
        error_log = syslog
        
        curl.cainfo = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\extras\ssl\cacert.pem"
        
        openssl.capath="C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\extras\ssl\cacert.pem"
      • Add C:\Program Files\php-8.1.10-nts-Win32-vs16-x64 to SYSTEM PATH.
      • Restart your machine.
      • Open cmd and execute the command below to ensure that the PHP file can be found in the SYSTEM PATH.
        php --version
      • Open IIS, click on Server name, double click on Handler Mappings > Add Module Mapping with below information.
        Request path = *.php
        
        Module = FastCgiModule
        
        Executable = "C:\Program Files\php-8.1.10-nts-Win32-vs16-x64\php-cgi.exe"
        
        Name = PHP 8.1
        
        Request Restrictions = File or folder
      • Create phpinfo.php file with below content in the root website folder.
        <?php phpinfo(); ?>

       

       

      How to Find and Remove Windows Hot Fix

      Motivation:

      You have an application that had been working well but it has encountered issues after you applied a Windows hot fix.

      You need to list your latest Windows hot fixes and uninstall the one that causes the issue so that your application can work again.

      Procedure:

      1. Right click Start icon, click on Command Prompt (Admin) or Windows Powershell (Admin).

      2. Type below command and press Enter to list the Windows hot fixes.

      Get-Hotfix | Sort-object InstalledOn -Descending

      3. Type below command and press Enter to uninstall a hot fix. Please note that the hot fix id does not contain KB.

      wusa /uninstall /kb:4058702

      Some other useful commands:

      • Geting the Windows original install date.
      systeminfo | find /I "Install Date"

      Alternatively, you can use below command to get the Windows original install date.

      ([WMI] "").ConvertToDateTime(((Get-WmiObject -class win32_operatingsystem).installdate))
      • Displaying Windows OS information.
      systeminfo | findstr OS
      • Detecting Manufacturer name & Model number.
      wmic computersystem get model, name, manufacturer, systemtype

       

       

       

      How to Install Windows on your MacBook using Boot Camp

      Motivation:

      You have a MacBook and you want to use an application that only works on Windows.

      Procedure:

      1. Prerequisite:
      • Ensure that your macOS is up-to-date and does not have any issue.
      • If you want to reinstall macOS then you can hold down Command+R after powering your machine on.
      2. Installing Windows on your MacBook using Boot Camp

      In macOS:

      • Finder > Shift+Command+u > Boot Camp Assistant
      • Select 350Gb (or another appropriate size) for Windows. Use Windows 10 version 1909, April 2020 or Windows 10 version 1709, November 2017.
      • Remove unnecessary macOS applications (e.g. Numbers, Pages, Garage Band) if you want to use as much as possible storage for Windows.
      • Install Windows 10.
        – DO NOT USE Disk Management to create new partitions during Windows installation. Only use Disk Management to format an existing partition when installing Windows.
        – During the next boot into OS X, the OSXRESERVED partition is removed and put back into the Core Storage container of the OS X partition.

      in Windows:

      • Install Boot Camp drivers.
      • Boot Camp Control Panel… > TrackPad > Tap to Click.
      • Change Computer Name, disable System Protection, enable Remote Desktop, activate Windows.
      • Turn on Automatic Logon
        Command Prompt (Run as Administrator) >> netplwiz
      • Disable Hibernate
        Command Prompt (Run as Administrator) >> powercfg.exe /hibernate off
      • Power management > Change plan settings > Change advanced power settings
        >> Hard disk > Turn of hard disk after > Never
        >> Sleep > Sleep after > Never
      • Adjust System > Display > Brightness and color.
      • Uninstall unnecessary apps.
      • Use Disk Management to shrink the BOOTCAMP partition and create a new DATA partition. Use 150Gb (153600MB) as the amount of space to shrink.
      • Check and install Windows updates.
      • Copy portable apps.
      Developer’s tools:
      • Turn the following Windows features on: ASP.NET 3.5, 4.7, Internet Information Service, Telnet Client
      • Install Hyper-V, create an external Virtual Switch for Internet access
      • Install Total Commander, Remote Desktop Connection Manager
      • Install Firefox
      • Install MS SQL Server 2008 R2, MS Office 2007 SP3 (Display >> Scale and layout: 175%), MS Project 2016, MS Visio 2016, Visual Studio 2010, Visual Studio 2015, Adobe Acrobat Pro DC v15.8, Adobe Photoshop CC 2015, TortoiseSVN 1.11.1
      • Install Python 3.6.8, TensorFlow, Keras
      3. Removing Windows from your MacBook using Boot Camp

      In Windows:

      • Delete all Windows Data partitions, then Extend the Boot Camp volume (C:\) using Windows Disk Management.

      In macOS:

      • Finder > Shift+Command+u > Boot Camp Assistant > Continue > Restore
      • If you get any problem with Boot Camp Assistant then delete Windows Boot Camp partition using Disk Utility: Finder > Shift+Command+u > Disk Utility > Partition.
      • If you get a “Ghost” partition after deleting Windows Boot Camp partition using Disk Utility then please use the following procedure to remove it:

      Execute below command:

      diskutil list

      Find EFI IDENTIFIER (e.g. disk0s1).

      Execute 2 below commands:

      sudo mkdir /Volumes/efi
      sudo mount -t msdos /dev/disk0s1 /Volumes/efi

      Navigate to /Volumes/efi/EFI. Delete all directories (i.e. Microsoft and Boot) except the APPLE directory.

      Execute below command:

      diskutil unmount /Volumes/efi
      4. Repair or update Boot Camp drivers in Windows
      • Download and install 7-Zip.
      • Download Brigadier 0.2.4.
      • Run Brigadier to automatically detect your Mac model and download the right Boot Camp drivers for Windows 10, and extract them (using 7-Zip) to the same location where Brigadier executable is located.
      • Find and double-click on Setup.exe to run it.