Showing posts with label Windows 10. Show all posts
Showing posts with label Windows 10. Show all posts

Apr 15, 2025

Windows 10/11 : Batch File to Start and Check Windows Services

Create a batch file to check the status of a Windows Service(s) and start it if its not started. The batch file can also be run inside "Task Scheduler" at an interval basis.


1. First, you need to find out the Service Name that you want to monitor, in this example let's say the service you need to monitor is an Exchange Server IMAP4 service.


2. Open --> Services and browse through the list until you found the IMAP4 service.


3. Right-click the Service Name --> Properties.


4. Take note of the "Service name:", copy the name to Notepad. As per below screenshot, the service name is "MSExchangeImap4".



5. Create a batch file as below :-


@ECHO OFF
CLS
SETLOCAL ENABLEDELAYEDEXPANSION
SET /A RETRY_IMAP=0
SET /A MAX_RETRIES=3
SET EXCH_IMAP= MSExchangeImap4

REM To check current status of the service.
:check_imap
SC QUERY %EXCH_IMAP% | FIND "RUNNING" >NUL
IF %ERRORLEVEL%==0 (
    ECHO Exchange IMAP4 Service is Running.
        GOTO end
)

REM To start the service if the status is stopped.
ECHO Exchange IMAP4 Service is Stopped.
SC START %EXCH_IMAP%
TIMEOUT /T 10 >NUL

REM To re-check the service status again for confirmation.
SC QUERY %EXCH_IMAP% | FIND "RUNNING" >NUL
IF %ERRORLEVEL%==0 (
    ECHO Exchange IMAP4 Service is Running.
        GOTO end
)

REM Retrying to start the service with a maximum of 3 retries only.
SET /A RETRY_IMAP+=1
IF !RETRY_IMAP! LSS %MAX_RETRIES% (
    ECHO Retrying Start %EXCH_IMAP% (Attemp: !RETRY_IMAP!).
    GOTO check_imap
) ELSE (
    ECHO Max Retries Reached for %EXCH_IMAP%, will stop retrying.
        GOTO end
)

:end
EXIT



6. You can now test run the batch file and create a "Task Scheduler" to run the check at an interval basis (eg. every 2 hours or at Startup of the server).



!!! HAPPY COMPUTING !!!

Nov 18, 2024

NextCloud Install in Ubuntu Server

NextCloud is an Open Source, Self-Hosted or Cloud Hosted, File Sync and Sharing Platform. It's Secure, Private and Easy to use. Compatible with Windows, Linux, Android and Apple iOS devices.

This is assuming that you already have Ubuntu Server installed, patched and updated.

1. Download the latest version of NextCloud.

sudo wget https://download.nextcloud.com/server/releases/latest.zip


2. Install some required packages.


sudo apt install libmagickcore-6.q16-6-extra php php-apcu php-bcmath php-cli php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml -y



3. Install Marid DB Server.

sudo apt install mariadb-server -y


4. Secure Marid DB installation, follow on-screen prompt and instructions.

sudo mysql_secure_installation


5. Configure Maria DB Server.


CREATE DATABASE nextcloud;

SHOW DATABASES;

GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost' IDENTIFIED BY 'ncpass';

FLUSH PRIVILEGES;

QUIT;



6. Enable PHP Modules.

sudo phpenmod apcu bcmath gmp imagick intl


7. Install Unzip Apps.

sudo apt install unzip -y


8. Unzip the downloaded NextCloud file.

sudo unzip latest.zip


9. Copy and Rename the extracted NextCloud folder.

sudo cp nextcloud demo.com


10. Move the renamed folder to Apache server path.

sudo mv demo.com /var/www/


11. Grant permissions to NextCloud folder.

sudo chwon -R www-data:www-data /var/www/demo.com


12. Create Apache configuration file for NextCloud.


<VirtualHost *:80>
   ServerAdmin webmaster@local.com
   ServerName demo.com
   DocumentRoot /var/www/demo.com

   <Directory /var/www/demo.com>
     Options MultiViews FollowSymlinks
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>

   ErrorLog /var/log/apache2/demo.com/error.log
   TransferLog /var/log/apache2/demo.com/access.log

  <IfModule mod_headers.c>
     Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
   </IfModule>

</VirtualHost>



13. Configure and modify PHP file. Modify the value according to your requirements.


memory_limit = 512M

upload_max_filesize = 512M

max_execution_time = 360

post_max_size = 512M

date.timezone = Asia/Kuala_Lumpur

opcache.enable = 1

opcache.interned_strings_buffer = 16

opcache.max_accelerated_files = 10000

opcache.memory_consumption = 128

opcache.save_comments = 1

opcache.revalidate_freq = 1



14. Enabled Apache modules for NextCloud use.

sudo a2enmod dir env headers mime rewrite ssl


15. Enable APCU module in PHP.

sudo nano /etc/php/8.3/mods-available/apcu.ini

add the following line :-

apc.enable_cli = 1


16. Open your favorite browser, such as Google Chrome browser. And type the URL of NextCloud server (eg. http://demo.com). At the main screen, you need to configure the NextCloud Database (eg. nextcloud) created earlier including its username (eg. ncuser) & password (eg. ncpass). You also need to create the First Administrator account with a valid email address too.


17. NextCloud screen will auto refresh upon successful connection to the database, now login with the new administrator account created in earlier step.


18. Secure NextCloud with Let's Encrypt SSL.

sudo certbot --apache


19. Fix missing Indices in NextCloud.

sudo chmod +x /var/www/demo.com/occ

sudo /var/www/demo.com/occ db:add-missing-indices

sudo chmod -x /var/www/demo.com/occ


20. Change permissions of NextCloud config file.

sudo chmod 660 /var/www/demo.com/config/config.php

sudo chown root:www-data /var/www/demo.com/config/config.php


21. Modify NextCloud configuration file.

sudo nano /var/www/demo.com/config/config.php

Modify the following lines according to you needs :-


'memcache.local' => '\OC\Memcache\APCu',

'default_phone_region' => 'MY',

'maintenance_window_start' => 1,

'filelocking.enabled' => true,

'memcache.locking' => '\OC\MemCache\APCu',



22. Restart Apache server.

sudo systemctl restart apache2


23. Configure Crontab.

sudo crontab -u www-data -e

Add the following line :-

00 * * * 1 php -f /var/www/demo.com/cron.php



OPTIONAL STEPS

24. Remove Skeleton Files and Folders when User account is created.

sudo rm -R /var/www/demo.com/core/skeleton/Templates


25. Remove Work Flow Engine, to prevent User from installing WorkFlow.


sudo /var/www/demo.com/occ config:app:set workflowengine user_scope_disabled --value yes



26. Install "Redis" as MemCache for NextCloud.

sudo apt install redis php-redis -y

sudo systemctl enable redis

sudo systemctl start redis

sudo nano /var/www/demo.com/config/config.php


'memcache.local' => '\OC\Memcache\Redis',

'memcache.locking' => '\OC\Memcache\Redis',

'redis' => array(
     'host' => '/var/run/redis/redis.sock'.
     'port' => 0,
     'timemout' => 0.0,
     ),


sudo nano /etc/redis/redis.conf


unixsocket /var/run/redis/redis.sock

unixsocketperm 660


sudo usermod -aG redis www-data

sudo systemctl restart redis


27. If Redis is distributed, add following line into NextCloud config file :-

'memcache.distributed' => '\OC\Memcache\MemCached',


28. To clear all NextCloud log entries.

sudo -u www-data truncate /var/www/demo.com/data/nextcloud.log --size=0



!!! HAPPY COMPUTING !!!


Aug 16, 2024

Windows : Microsoft Edge Browser with Script

Sometimes we just need to create a shortcut that run Microsoft Edge browser to a specific URL or Website. This could be achieved easily if your "Default" browser is configured to Microsoft Edge, but what if your computer have 2 or more browsers like Google Chrome ?

This is especially true if the "Default" browser is configured to Google Chrome and that specific URL or Website only works with Microsoft Edge.

Thus by simply creating a shortcut to open that specific URL will only opens up Google Chrome instead of Microsoft Edge which is a bummer.

Let's get started :-

1. First you will need to create .vbs file with the following code.


Set Edge = CreateObject("WScript.Shell")
Edge.Run "msedge.exe https://demo.com"


* Replaced https://demo.com with your specific URL.

2. Save the above file as "edge.vbs", you can of course name it whatever filename you want.


3. Then create the shortcut to that "edge.vbs" on your desktop or any location you preferred.


4. If you want Microsoft Edge to open up with "Maximized" screen, just add the following line into .vbs file.


Set Edge = CreateObject("WScript.Shell")
Edge.Run "msedge.exe https://demo.com", 3, false



Now Microsoft Edge will open that specific website in maximized screen.


!!! HAPPY COMPUTING !!!

Jul 18, 2024

Windows : DISM Error "0x800f081f"

Fixing the DISM Error "0x800f081f". Depending on what you are trying to achieve, in my case is the failure of installing .NET Framework 3.5 in Windows Server 2012 R2 Std 64-bit.

The error message :


Error: 0x800f081f

The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log



1. Check the Windows Protected files scan.

sfc /scannow

Results with error :


Beginning system scan. This process will take some time.

Beginning verification phase of the system scan.
Verification 100% complete.

Windows Resource Protection found corrupt files but was unable to fix some of them. Details are included in the CBS.Log windir\Logs\CBS\CBS.log. For example C:\Windows\Logs\CBS\CBS.log. Note that logging is currently not supported in offline servicing scenarios.



2. Scan the image with dism.

dism /online /cleanup-image /scanhealth

Results with error :


Deployment Image Servicing and Management tool
Version: 6.3.9600.19408

Image Version: 6.3.9600.19397

[==============================100.0%============================]

Error: 0x800f081f

The source files could not be found. Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.

The DISM log file can be found at C:\Windows\Logs\DISM\dism.log



3. Repairing the files.

dism /online /cleanup-image /restorehealth /source:D:\sources\install.wim /limitaccess


4. Once completed, restart the computer and proceed to install the .NET Framework 3.5

dism /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess


5. Once done, restart the computer again and the new features is already installed.


!!!HAPPY COMPUTING !!!


Feb 21, 2024

Windows 10 : Create Recovery Partition

Sometimes we just need to fix the Windows Recovery Partition or just wanted to increase that partition size so that Windows Update able to run without any error.

The recommended Recovery Partition size by Microsoft is at least 1GB.

There are 2 scenarios here :-

1. The Recovery Partition is NOT available in the HDD/SSD.

2. The Recovery Partition is available but the size is too small (eg. less than 1GB).


METHOD 1 (No Recovery Partition).

1. Open --> Computer Management.

2. Goto --> Disk Management.

3. Right-Click on [C:] drive, select --> Shrink Volume.

4. Decrease the [C:] drive volume, enough to have a balance of 1GB (or 1000 MB).

5. Once the [C:] drive volume have shrinked successfully, you will now see an empty volume available.

6. Create the a new partition on the empty volume, FORMAT it but do not assign any drive letter yet.

6. Now, open --> CMD (as admin).

7. Run --> Diskpart utility and set the correct configurations for Recover Partition to work.

C:\>diskpart

8. List all available drive and select the correct drive.

DISKPART>list disk

DISKPART>select disk 0

9. Next, is to display all the available partition in that drive and select the new partition. Assuming that the new partition is numbered 4.

DISKPART>list partition

DISKPART>select partition 4

10. Now we need to configure the partition, depending on your drive's configuration it may either be MBR or GPT type. Choose the correct command based on your drive's configuration.

MBR
DISKPART>set id=27

GPT
DISKPART>set id=06d1-4d40-a16a-bfd50179d6ac

DISKPART>gpt attributtes=0X8000000000000001

11. Once done, just exit the Diskpart utility.

12. Now we need to enable and create the recovery partition. This make take a while to complete.

C:\>reagentc /enable

13. Once completed, you should now be able to view the new partition have been identified as "Recovery Partition" in the Disk Management panel.


METHOD 2 (Exiting Recovery Partition).

1. If there is an existing Recovery Partition in the drive, we need to first disable it. Open --> CMD (as admin).

C:\>reagentc /disable

2. Next is to run Diskpart utility.

C:\>diskpart

3. List all available drive and select the correct drive.

DISKPART>list disk

DISKPART>select disk 0

4. Next, is to display all the available partition in that drive and select the new partition. Assuming that the existing Recovery Partition is numbered 4.

DISKPART>list partition

DISKPART>select partition 4

5. As the Recovery Partition cannot be deleted, we need to force delete the partition.

DISKPART>delete partition override

6. Open --> Computer Management.

7. Goto --> Disk Management.

8. Right-Click on [C:] drive, select --> Shrink Volume.

9. Decrease the [C:] drive volume, enough to have a balance of 1GB (or 1000 MB) on the empty volume.

10. Once the [C:] drive volume have shrinked successfully, you will now see an empty volume available.

11. Create the a new partition based on the empty volume, FORMAT it but do not assign any drive letter yet.

12. Back to the command prompt and while still in Diskpart utility, we need to ensure the correct partition is selected.

DISKPART>select partition 4

13. Now we need to configure the partition, depending on your drive's configuration it may either be MBR or GPT type. Choose the correct command based on your drive's configuration.

MBR
DISKPART>set id=27

GPT
DISKPART>set id=06d1-4d40-a16a-bfd50179d6ac

DISKPART>gpt attributtes=0X8000000000000001

14. Once done, just exit Diskpart utility and next is to re-enable back the Recovery Partition. This may take a while to complete.

C:\>reagentc /enable

15. Once completed, you should now have a larger Recovery Partition size in the Disk Management panel.



!!! HAPPY COMPUTING !!!


Nov 8, 2023

Batch : Rename Hostname via Batch File

This is an example of a batch file to rename the Hostname or Computer Name as per your preferences, it is much faster way to do computer renaming for many computers.

Note that the batch file must be "run as administrator" mode in order to works.

 @ECHO OFF
CLS
>NUL CHCP 65001

:asktorename
REM To ask whether to Rename the Hostname or not.
ECHO.
ECHO.
ECHO.
ECHO               ╔═════════════════════════════════════════╗
ECHO               ║         RENAMING THE HOSTNAME           ║
ECHO               ╚═════════════════════════════════════════╝
ECHO.
CHOICE /M "──────────────► DO YOU WANT TO RENAME THE HOSTNAME "
    IF ERRORLEVEL 2 GOTO eof
    IF ERRORLEVEL 1 GOTO askforname
GOTO eof
REM --------------------------------------------------------------------------------------

:askforname
REM To ask User for the preferred hostname.
ECHO.
ECHO.
SET /P NEWNAME="PLEASE TYPE THE NEW HOSTNAME: "
ECHO.
ECHO "     ► ► ► THE NEW HOSTNAME IS ───► %NEWNAME%"
CHOICE /M "     ► ► ► IS THIS CORRECT "
    IF ERRORLEVEL 2 GOTO asktorename
    IF ERRORLEVEL 1 GOTO dorenhost
GOTO eof
REM --------------------------------------------------------------------------------------

:dorenhost
REM To proceed Rename the Hostname as per Input by User.
ECHO.
ECHO "     ► ► ► OK, RENAMING HOSTNAME → %NEWNAME%, PLEASE WAIT..."
WMIC COMPUTERSYSTEM where name="%COMPUTERNAME%" CALL RENAME name="%NEWNAME%"
TIMEOUT /t 3 /NOBREAK
ECHO.
ECHO "     ► ► ► RENAMING HOSTNAME COMPLETE"
ECHO.
ECHO "THE NEW HOSTNAME WILL TAKE EFFECT AFTER COMPUTER RESTART"
TIMEOUT /t 5 /NOBREAK
GOTO eof
REM --------------------------------------------------------------------------------------

:eof
START SHUTDOWN /r /f /t 10
COLOR
>NUL CHCP 437
EXIT /b



!!! HAPPY COMPUTING !!!

Nov 6, 2023

[UPDATED] Internet Explorer : Enabled via VBS Script File

Latest script to launch Internet Explorer with preferred webpage loaded.

1. Open --> Notepad

2. Type or Copy the following script:

Set objExplorer = CreateObject("InternetExplorer.Application")
with objExplorer
    .Navigate strPath
    .ToolBar = 1
    .StatusBar = 1
    .Width = 1000
    .Height = 593
    .Left = 1
    .Top = 1
    .Visible = 1
    .FullScreen = 0
    .Navigate("https://www.google.com.my")
End With

 Note: Replace the URL with your preferred URL address.


3. Save the file as --> IE_Link.vbs

4. Test run the script file, you can also create a Shortcut in the "Desktop" and replace the icon to Internet Explorer icon too.


!!! HAPPY COMPUTING !!!

Oct 17, 2023

Internet Explorer : Enabled via VBS Script File

 As of 17-Oct-2023, latest Windows 10 update have yet again forced Internet Explorer (IE) to redirect and open via Edge browser.

No idea why Microsoft kept on forcing users to use Edge, and their "IE Mode" is sluggish and not compatible with local web server (which only works best in IE11). Edge browser is totally rubbish to our intranet application.

"Microsoft you cannot force user to Edge nor expect us to re-write the entire application to Edge compatible, as this will incurred lots of money, time and resources."

I do hope Microsoft see my message...


Workaround for the time being :-

1. Open --> Notepad

2. Type --> CreateObject("InternetExplorer.Application").Visible=true

3. Save file as --> IE.vbs

4. Create a desktop shortcut.

5. Change the icon to "IE" icon.

6. End.

Disadvantage Note : You cannot save any "Favorites" link inside IE, doing so will only automatically open the link in Edge browser.


!!! HAPPY COMPUTING !!!

Sep 5, 2023

Windows : Get Operating System Info in Command Prompt

How to get the installed Operating System information via the Command Prompt.

1. To get OS Architecture type.

wmic os get OSArchitecture



2. To get OS Edition info.

wmic os get Caption /value



3. To get OS CD-Key info.

wmic path softwareLicensingService get OA3xOriginalProductKey



!!! HAPPY COMPUTING !!!

Aug 30, 2023

Windows Terminal : Always Run as Administrator

How to Enable Windows Terminal to always "Run as Administrator" option.

1) Open --> Windows Terminal

2) Goto --> Settings

3) Under "Profile" section, select which profile you want to enable, in this case select --> Command Prompt

4) On the right-pane, scroll down and search for --> Run this profile as Administrator = On


!!! HAPPY COMPUTING !!!

Aug 11, 2023

Windows 10 : Delete Recovery Partition

Windows 10 "Recovery" partition is a special partition on system hard drive and is used to restore the system to factory settings in the event of system issues. To protect the recovery partition from being changed or deleted, the recovery partition usually doesn't have any drive letter assigned and other features or options are not available in Disk Management.

This "Recovery" partition can be deleted and it will not impact your existing Windows 10 OS. Though it can be deleted but to delete it, you must follow this steps.


NOTE : IT IS RECOMMENDED NOT TO DELETE THIS PARTITION ! DOING SO, YOU WILL NOT HAVE ANY LAST RESORTS IN THE EVENT OF OS ISSUES.



1. Run --> CMD (run as admin)

2. Type --> diskpart

3. Type --> list disk

4. Type --> select disk [number]
     (usually primary disk number is 0)

5. Type --> list partition

6. Type --> select partition [number]
     (in this case my, based on my drive's partition layout, the number is 4)

7. Type --> delete partition override

8. Type --> exit

9. Now, open "Disk Management" and you will notice that now there is a "Unallocated" space available in the drive.

10. Next step is to extend your [C:] drive by right-click --> Extend volume.

11. Ensure the full size is selected and click --> Next

12. Verify the new configuration and click --> Finish

Now you will have a larger capacity of the [C:] drive partition.


!!! HAPPY COMPUTING !!!

May 17, 2023

Multi-Boot USB : Ventoy (Open Source)

Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files.

With Ventoy, you don't need to format the disk over and over, you just need to copy the ISO/WIM/IMG/VHD(x)/EFI files to the USB drive and boot them directly.

You can copy many files at a time and Ventoy will give you a boot menu to select them. You can also browse ISO/WIM/IMG/VHD(x)/EFI files in local disks and boot them.

Supports x86 Legacy BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI. Most types of OS supported (Windows/WinPE/Linux/ChromeOS/Unix/VMware/Xen etc.)

Official Ventoy Website : https://www.ventoy.net/en/index.html




!!! HAPPY COMPUTING !!!


Apr 17, 2023

Windows : Terminal Apps (Shortcut Keys)

 Windows Terminal Apps Shortcut Keys

Download Link : https://github.com/microsoft/terminal


General Shortcuts.

  • [CTRL] +[SHIFT] + [W] --> Close Current Pane.
  • [CTRL] + [-] --> Reduce Font Size.
  • [CTRL] + [+] --> Increase Font Size.
  • [CTRL] + [0] --> Reset Font Size to Default.


Tabs, Pane and Windows Shortcuts.

  • [CTRL] + [SHIFT] + [T] --> Open New Tab with Default Profile.
  • [CTRL] + [SHIFT] + [N] --> Open New Window.
  • [CTRL] + [SHIFT] + [1 ~ 9] --> Open New Tab with Corresponding profile Index (eg. 1 to 9).
  • [ALT] + [SHIFT] + [D] --> Duplicate a Pane.
  • [CTRL] + [SHIFT] + [D] --> Duplicate a Tab.
  • [ALT] + [SHIFT] + [-] --> Split Pane Horizontally.
  • [ALT] + [SHIFT] + [+] --> Split Pane Vertically.

!!! HAPPY COMPUTING !!!

Mar 13, 2023

CloneZilla : Restore Disk Image to Smaller Disk Size

CloneZilla restoring a "Disk Image" that are captured in larger disk size capacity to a smaller disk size must be done via another procedures.

Example : The original disk image captured size is a HDD 500GB capacity, the Destination/Target is a SSD 256GB.

You need to ensure that the captured disk albeit is 500GB, but the total usage doesn't exceed 256GB after partitioning, then the restore will be successful.


As usual, boot-up CloneZilla accordingly and follow below instructions accordingly :-

1. Select --> Device-Image

2. Select --> Local-Device

3. Select --> [The external drive that contains the captured image]

4. Select --> [Mount folder, if any]

5. Select --> Expert Mode

6. Select --> Restore-Partition

7. Select --> [Disk Image Name]

8. Select --> [All Partitions available in the Image]

9. Ignore the error message displayed, Press --> [ENTER]

10. In Advanced Page, Select --> -icds (skip checking destination disk size before creating partition table)

11. Select --> Create Partition table proportionally

12. Select --> Skip Checking image before restoring

13. Select --> Shutdown

14. Just press --> [ENTER] to all prompted messages

15. Continue to by Pressing --> [Y] to all prompted messages


Upon completion, CloneZilla will auto shutdown the computer, proceed to unplug all external devices and continue to power-on the computer. Windows wizard will automatically setup the computer with OOBE (depending on your captured image).


!!! HAPPY COMPUTING !!!


Mar 6, 2023

WinSCP : Transfer File between Windows PC & Ubuntu Server

 WinSCP : Transfer File between Windows PC & Ubuntu Server.

Did you know that you can transfer file between a Windows PC with Ubuntu without additional steps ?

It's very easy, just download and install WinSCP software for Windows at (https://winscp.net/eng/download.php).


  1. Once WinSCP is installed, ensure Ubuntu have SSH enabled. You can install it --> sudo apt install openssh-server -y
  2. At your PC, open WinSCP program. Select --> SCP
  3. Key-in the Ubuntu's IP Address, Username and Password accordingly.
  4. Once connected, select the file(s) or folder(s) you want to transfer and press --> Upload.
  5. When upload is completed, you can just close the WinSCP program.
That's it ! It's very simple !


!!! HAPPY COMPUTING !!!

Jan 7, 2023

RustDesk : Install RustDesk Server in Ubuntu

 Install RustDesk Server in Ubuntu Server v.22.0.4 64-bit.


1. Check UFW is "Enabled" in Ubuntu.

$sudo ufw status


2. Enable UFW if not available.

$sudo apt install ufw -y

$sudo ufw enable


3. Configure default UFW settings.

$sudo ufw default allow outgoing

$sudo ufw default deny incoming


4. Allow SSH connection.

$sudo ufw allow ssh

$sudo ufw allow 22/tcp


5. Allow RustDesk Ports and Protocols.

$sudo ufw allow 21114:21119/tcp

$sudo ufw allow 8000/tcp

$sudo ufw allow 21116/udp

$sudo ufw allow http

$sudo ufw allow https


6. Install RustDesk Server.

$sudo wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/install.sh

$sudo chmod +x install.sh

$sudo ./install.sh


7. When prompted for IP/Domain Name, key-in a FQDN address. (eg. remote.abc.com)


8. When prompted to install Web Server (HTTPD), type "Yes" (if you haven't install Apache2 Server). It will auto install GoHttpd server (recommended).


9. Upon completion, please take note of the "Public Key, Username and Password" displayed on screen, copy it to notepad for future references.


10. Ensure your router also have "Port Forwarding" configured to match the RustDesk's ports as above.


11. At another computer, open any internet browser (eg. Chrome) and browse to http://[your domain]:8000 and you will prompted for username & password to login, use the same username and password save in above steps.


12. After successful login, proceed to download the installer for Windows, its a PowerShell script. After download proceed to run the script (run as admin).


13. Once installation completed, you can open/run the RustDesk Client on your computer.


Note: as of writing, the "Address Book" function was still under development and there are no timeline available for the release, thus the "Login" function in the "Address Book" module will return an error message.


Edit, 2-Apr-2023: Added Video.





!!! HAPPY COMPUTING !!!



Jan 6, 2023

Favorites : Location of Favorites

 Location of "Favorites" for Internet Explorer, Microsoft Edge and Google Chrome browser in Windows 10 22H2.


1) Internet Explorer Favorites Path.

%USERPROFILE%\Favorites\*.*


2) Microsoft Edge Favorites Path.

"%USERPROFILE%\AppData\Local\Microsoft\Edge\User Data\Default\Bookmarks"

"%USERPROFILE%\AppData\Local\Microsoft\Edge\User Data\Default\Favicons"


3) Google Chrome Favorites Path.

"%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Bookmarks"

"%USERPROFILE%\AppData\Local\Google\Chrome\User Data\Default\Favicons"


!!! HAPPY COMPUTING !!!


PowerShell : Command Line

PowerShell Command for Windows 10 22H2. 

1) Enable/Install SMB v1 Client Protocol.

Enable-WindowsOptionalFeature -Online -FeatureName "SMB1Protocol-Clinet" -All


2) Mount ISO image file.

Mount-DiskImage -ImagePath "%ISO_FILE_PATH%"


3) Unmount/Eject ISO Image file.

Dismount-DiskImage -ImagePath "%ISO_FILE_PATH%"


4) To run a PowerShell Script File (.ps1) inside a Batch File.

POWERSHELL.EXE -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""%POWERSHELL_SCRIPT_FILE%""' -Verb RunAs}"


!!! HAPPY COMPUTING !!!


Jan 5, 2023

Batch : Rename Hostname

 Inside batch file, create the following command line to rename the current computer with a new hostname.

WMIC COMPUTERSYSTEM where name="%COMPUTERNAME%" CALL RENAME name="%NEWPCNAME%"

Need to restart computer to take effect.


!!! HAPPY COMPUTING !!!


Windows 10 : Location of Group Policy Object for Local Computer

 Windows 10 22H2, Location of Group Policy Object (GPO) for Local Computer. Able to copy all files and folders to another computer thus without the need to re-configure all policies again.

C:\Windows\System32\GroupPolicy

Copy all files and folders to another location (eg. Pendrive) and overwrite the same into another computer of the same location. This method is suitable for deploying GPO without ADDS.

After computer restart, all policies will be in effect.


!!! HAPPY COMPUTING !!!