All posts by admin

How to Fix “The parameter is incorrect” Issue When Disabling the Sync Host OneSyncSvc Service

Problem:

The Sync Host OneSyncSvc service was not started correctly and caused error in the Server Manager.

You wanted to disable this service. However you got the “The parameter is incorrect” error message when disabling it.

Solution:
  1. Click on the Search icon, type regedit, press Enter.
  2. Locate the key below
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\OneSyncSvc

3.  Change the Start value from 2 to 4 (Disabled).

4. Restart the server.

 

How to Fix the “We can’t sign into your account” Issue in Windows

Problem:

You remotely connect o a computer using a Windows Domain account and get the error message below.

We can't sign into your account
Solution:
  1. Login the computer as a Local Administrator.
  2. Open C:\Users and delete the folder of the Windows Domain account.
  3. Click Search icon, enter regedit, and press Enter.
  4. Navigate to the path below.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

4. Look for the Profile of the Windows Domain account by reviewing the ProfileImagePath value.

5. Delete the Profile key of the Windows Domain account.

6. Restart the machine.

How to Manually Install PHP 7.4 on Windows Server 2019

Motivation:

  • You want to deploy a PHP application or WordPress on Windows Server 2019.
  • You want to update PHP to any version to address compatibility or security issues in Windows.
  • You want to understand how PHP works with IIS.

Solution:

  • Install CGI for IIS on Turn Windows features on or off > Internet Information Services > World Wide Web Services > Application Development Features > CGI.
  • Download VC15 x86 Non Thread Safe package here or under PHP 7.4 section from http://windows.php.net/download/
  • Extract the ZIP file to the C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86 folder.
  • Rename the php-.ini-development file to php.ini.
  • Open the php.ini file and add the following line at the end of the file.
    extension=php_wincache.dll
  • 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 (x86)\php-7.4.9-nts-Win32-vc15-x86\ext"
    
    extension=php_curl.dll
    extension=php_fileinfo.dll
    extension=php_mbstring.dll
    extension=php_exif.dll
    extension=php_mysqli.dll
    extension=php_pdo_mysql.dll
    extension=php_openssl.dll
    
    error_log = "C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\php_errors.log"
    
    error_log = syslog
  • A sample php.ini file can be download here.
  • Add C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86 to System Path.
  • Download x86 package of WinCache 2.0 for PHP 7.4 here or from https://sourceforge.net/projects/wincache/.
  • Extract and copy the php_wincache.dll file to C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\ext
    folder.
  • Open IIS, click on Server name, double click on Handler Mappings, click on Add Module Mapping, and enter below information.
    Request path = *.php
    
    Module = FastCgiModule
    
    Executable = "C:\Program Files (x86)\php-7.4.9-nts-Win32-vc15-x86\php-cgi.exe"
    
    Name = PHP 7.4
    
    Request Restrictions = File or folder
  • Download and install VC_redist.x86.exe of Microsoft Visual C++ Redistributable for Visual Studio 2019 here or on https://visualstudio.microsoft.com/downloads/#microsoft-visual-c-redistributable-for-visual-studio-2019
  • en a Command Prompt, execute below command and ensure that NO WARNINGS APPEAR.
    php --version
  • Create phpinfo.php file with below content in the root website folder.
    <?php phpinfo(); ?>
  • Open http://localhost/phpinfo.php URL and verify PHP information.

 

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 Enable Processor Resource Controls in Hyper-V

Context:

You got a warning message below when configuring Number of virtual processors in Hyper-V.

Hyper-V is not configured to enable processor resource controls.

Problem:

How do you enable processor resource controls in Hyper-V?

Solution:

1. What is the difference between core and logical processor?

  • A socket is a slot contains one or more mechanical components providing mechanical and electrical connections between a microprocessor and a printed circuit board (PCB). This allows for placing and replacing the central processing unit (CPU) without soldering.
  • A core is a physical processor unit (hardware component) inside your processor.
  • Logical processor or logical core is the processor as seen by the operating system. Logical processor does not exist physically.

Logical Processor = (# of Core) * (# of Thread in each Core) = 4 * 2 = 8

Example:

2. What is SMT?

Simultaneous multithreading, or SMT, is a technique utilized in modern processor designs that allows the processor’s resources to be shared by separate, independent execution threads.

Processors supporting SMT are available from both Intel and AMD. Intel refers to their SMT offerings as Intel Hyper Threading Technology, or Intel HT.

3. How does Hyper-V virtualize processors?

  • Hyper-V creates and manages virtual machine partitions, across which compute resources are allocated and shared, under control of the hypervisor. Partitions provide strong isolation boundaries between all guest virtual machines, and between guest VMs and the root partition.
  • The root partition is itself a virtual machine partition, although it has unique properties and much greater privileges than guest virtual machines. The root partition provides the management services that control all guest virtual machines, provides virtual device support for guests, and manages all device I/O for guest virtual machines. Microsoft strongly recommends not running any application workloads in the root partition.
  • Each virtual processor (VP) of the root partition is mapped 1:1 to an underlying logical processor (LP). A host VP always runs on the same underlying LP – there is no migration of the root partition’s VPs.
  • By default, the LPs on which host VPs run can also run guest VPs.
  • A guest VP may be scheduled by the hypervisor to run on any available logical processor. While the hypervisor scheduler takes care to consider temporal cache locality, NUMA topology, and many other factors when scheduling a guest VP, ultimately the VP could be scheduled on any host LP.

4. What are Hyper-V hypervisor scheduler types?

Starting with Windows Server 2016, the Hyper-V hypervisor supports several modes of scheduler logic, which determine how the hypervisor schedules virtual processors on the underlying logical processors. These scheduler types are:

  • The classic scheduler provides a fair share, preemptive round- robin scheduling model for guest virtual processors.
  • The core scheduler offers a strong security boundary for guest workload isolation, and reduced performance variability for workloads inside of VMs that are running on an SMT-enabled virtualization host.
  • The root scheduler cedes control of work scheduling to the root partition. The NT scheduler in the root partition’s OS instance manages all aspects of scheduling work to system LPs.

5. Determine your current Hyper-V Hypervisor Scheduler Type

Execute the command below.

Get-WinEvent -FilterHashTable @{ProviderName="Microsoft-Windows-Hyper-V-Hypervisor"; ID=2} -MaxEvents 1

  • 1 = Classic scheduler, SMT disabled
  • 2 = Classic scheduler
  • 3 = Core scheduler
  • 4 = Root scheduler

6. Enable processor resource controls in Hyper-V by setting Scheduler Type to Core or Classic.

  • Open a Command Prompt as Administrator.
  • Execute the command below.
C:\Windows\System32\bcdedit.exe /set hypervisorschedulertype Core

  • Restart the computer.

 

 

How to Convert MP4 or MKV File to MP3 or M4A File

Motivation:

You have downloaded some MP4 or MKV video files.

You want to extract audio parts so that you could copy them to your iPhone to listen to them while turning off the display of your phone.

Procedure:

  • Download this portable application to your Windows.
  • Unzip the files to a location.
  • Open Mp4ToMp3_64.exe.
  • Click on the Add files button to add MP4 or MKV files to the application.
  • If you want to extract the original audio (for example the M4A format) then select Try extract original audio stream option below the Audio section on the right panel.
  • Click the Convert button.
  • Copy the MP3 or M4A files to your phone.

This procedure can be used for extracting audio from M4B (Apple audiobook file format) file to M4A or MP3 file too.

 

How to Install a Clean iOS

Motivation:

You want to sell or give away your iPhone. You want to ensure that the new owner will not access any of your data.

You may also need to give your iPhone to a technician to fix the broken display of your iPhone. You want to ensure that the technician cannot access any of your data.

You may also have so many buggy applications on your iPhone and want to increase stability and performance of your iOS.

Procedure:

  • Import your Photos to a MacBook.
  • Create a backup of data. It is best to let your iPhone synchronize everything with iCloud, including Photos and Contacts.
  • Turn off Find My iPhone.
  • Plug your iPhone to a MacBook.
  • Open Finder. Click on your iPhone on the left panel.
  • Click Restore iPhone… button.
  • Click Backup button.
  • Click Restore and Update button. Click Next button. Click Agree button.
  • Follow the instructions to install a clean iOS to your iPhone.

Post Installation Configuration:

  • Setup your iPhone.
  • Activate your iPhone.
  • Setup Face ID.
  • Restore your Apps & Data from iCloud backup.
  • Synchronize music to your iPhone.
  • Go to Settings > Generals > Software Update > Automatic Updates. Turn off Automatic Updates.
  • Go to Settings > Generals > Display & Brightness > Text Size. Drag the slider to the right to increase text size.
  • Go to Settings > Messages. Enable iMessage.

How to Trim, Cut or Combine MP4 Files Without Re-Encoding

Motivation:

  • You have MP4 files with unwanted portions. You want to trim these portions.
  • You want to cut a MP4 file into files with equivalent length for uploading to specific storage that limits length of an uploaded video.
  • You want to combine multiple MP4 files into single file for copying to specific storage in a single upload.

Trimming MP4 file:

  1. Download XMedia Recode.
  2. Unzip the downloaded package.
  3. Click on the XMedia Recode.exe file to open the application.
  4. Open a MP4 file.
  5. Under the Format tab set
    Profile = Custom
    Format = MP4
    File Extension = mp4
  6. Click the Video tab and set Mode = Copy on the middle panel.
  7. Click the Audio tab and set Mode = Copy on the middle panel.
  8. Click the Filters/Preview tab and set Start Time and to (End Time) value text boxes.
  9. Click the Add to queue button (with the + icon) on the tool bar.
  10. Click the Encode button on the tool bar.

Splitting MP4 file to multiple files with equivalent length:

    1. Download XMedia Recode.
    2. Unzip the downloaded package.
    3. Click on the XMedia Recode.exe file to open the application.
    4. Open a MP4 file.
    5. Under the Format tab set
      Profile = Custom
      Format = MP4
      File Extension = mp4
    6. Click the Video tab and set Mode = Copy on the middle panel.
    7. Click the Audio tab and set Mode = Copy on the middle panel.
    8. Click the Filters/Preview tab and specify appropriate time range for each file, for example from 00:00:00:0000 to 00:09:00:0000.
    9. Click the Add to queue button (with the + icon) on the tool bar.
    10. Click the Encode button.

    Repeat the procedure for the same file with different time ranges.

    For example use time range from 00:09:00:0000 to 00:18:00:0000 for creating the second file, then time range from 00:18:00:0000 to 00:27:00:0000 for creating the third file, etc.

    Combining multiple MP4 files into single MP4 file:

    1. Download ffmpeg.
    2. Unzip the downloaded package.
    3. Copy MP4 files to the bin folder.
    4. Create vidlist.txt with the content below in the bin folder.
    file 'Part 1.mp4'
    file 'Part 2.mp4'
    file 'Part 3.mp4'
    file 'Part 4.mp4'
    file 'Part 5.mp4'
    file 'Part 6.mp4'

    4. Open Command Prompt, navigate to the bin folder and execute the command below.

    ffmpeg -f concat -safe 0 -i vidlist.txt -c copy output.mp4

    How to Put Your eBooks into Kindle or Apple Books or Google Play Books

    Motivation:

    You have an ebook with .epub or .mobi format in your MacBook or PC.
    You want to put it into your iPhone or iPAD so that you can read it on the go.

    Solution 1:

    1. Upload your ebook to iCloud Drive.
    2. Install Kindle or Apple Books or Google Play Books on your iPhone or iPAD.
    3. Login your Kindle or Apple or Google account.
    4. Open the Files app to go to iCloud Drive.
    5. Open the ebook.
    6. Tap the Share icon in the lower left hand corner.
    7. Select Kindle or Open in iBooks or Play Books.

    Solution for Google Play Books:

    1. Install Google Play Books on your iPhone or iPAD..
    2. Log in Google Play Book website using your Google account.
    3. Upload your ebook in EPUB format to Google Play Book website.
    4. Open Google Play Books on your iPhone or iPAD.

    How to Install a Clean Windows

    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.

    2.A. 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).

    2.B. 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: Boot your laptop using the USB.

    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.

    Step 4: Install Windows.

    1. If your laptop is NOT officially supported by Windows 11, then on the first screen asking you to choose the language of your install, press Shift + F10 or Fn + Shift + F10 to open Command Prompt. Then type regedit and press Enter. Then locate HKEY_LOCAL_MACHINE\SYSTEM\Setup key. Then create a new LabConfig key. Then click on LabConfig key, and create 3 DWORD (32-bit) Values named BypassTPMCheck, BypassSecureBootCheck and BypassRAMCheck and set each to 1. Then close regedit and the Command Prompt, and continue the setup process.
    2. Follow the instructions to install Windows.
    3. Set Windows partition size to 123748Mb for DellXPS if you want to have a 120Gb C drive, or 614516Mb for DellPrecision if you want to have 600Gb C drive, or 819815Mb for ThinkPad if you want to have a 800Gb C drive.
    4. 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 5: Configure Windows without the Internet.

    1. Press Shift + F10 or Fn + Shift + F10 to open Command Prompt.
    2. Type oobe\bypassnro.
    3. Press Enter.
    4. Setup will reboot your computer and after reboot, you will get  I don’t have Internet option and Continue with limited setup option to skip the Internet requirement.

    Step 6: Configure Windows.

    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.

    Step 7: Configure Windows for developer’s needs.

    1. Turn the following Windows features on: .NET 3.5, ASP.NET 4.8, Hyper-V, Internet Information Services, Telnet Client.
    2. 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
    3. Install Remote Desktop Connection Manager, PuTTY 0.80, WinSCP 6.3.
    4. Create a VPN connection. Configure the VPN connnection.
    5. 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.
    6. 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.

      Information:

      The bypassnro.cmd which is in \Windows\System32\oobe folder, is a script which contains:

      @echo off
      reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v BypassNRO /t REG_DWORD /d 1 /f
      shutdown /r /t 0