|
@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 |
Apr 15, 2025
Windows 10/11 : Batch File to Start and Check Windows Services
Nov 18, 2024
NextCloud Install in Ubuntu Server
|
sudo wget https://download.nextcloud.com/server/releases/latest.zip
|
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 |
| sudo apt install mariadb-server -y |
| sudo mysql_secure_installation |
CREATE DATABASE nextcloud; SHOW DATABASES; GRANT ALL PRIVILEGES ON nextcloud.* TO 'ncuser'@'localhost' IDENTIFIED BY 'ncpass'; FLUSH PRIVILEGES; QUIT; |
| sudo phpenmod apcu bcmath gmp imagick intl |
| sudo apt install unzip -y |
| sudo unzip latest.zip |
| sudo cp nextcloud demo.com |
| sudo mv demo.com /var/www/ |
| sudo chwon -R www-data:www-data /var/www/demo.com |
<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> |
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 |
| sudo a2enmod dir env headers mime rewrite ssl |
| sudo nano /etc/php/8.3/mods-available/apcu.ini |
| apc.enable_cli = 1 |
| sudo certbot --apache |
| 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 |
| sudo chmod 660 /var/www/demo.com/config/config.php |
| sudo chown root:www-data /var/www/demo.com/config/config.php |
| sudo nano /var/www/demo.com/config/config.php |
'memcache.local' => '\OC\Memcache\APCu', 'default_phone_region' => 'MY', 'maintenance_window_start' => 1, 'filelocking.enabled' => true, 'memcache.locking' => '\OC\MemCache\APCu', |
| sudo systemctl restart apache2 |
| sudo crontab -u www-data -e |
| 00 * * * 1 php -f /var/www/demo.com/cron.php |
| sudo rm -R /var/www/demo.com/core/skeleton/Templates |
sudo /var/www/demo.com/occ config:app:set workflowengine user_scope_disabled --value yes |
| 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 |
| 'memcache.distributed' => '\OC\Memcache\MemCached', |
| sudo -u www-data truncate /var/www/demo.com/data/nextcloud.log --size=0 |
Aug 16, 2024
Windows : Microsoft Edge Browser with Script
|
Set Edge = CreateObject("WScript.Shell") Edge.Run "msedge.exe https://demo.com" |
Set Edge = CreateObject("WScript.Shell") Edge.Run "msedge.exe https://demo.com", 3, false |
Jul 18, 2024
Windows : DISM Error "0x800f081f"
|
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 |
| sfc /scannow |
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. |
| dism /online /cleanup-image /scanhealth |
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 |
| dism /online /cleanup-image /restorehealth /source:D:\sources\install.wim /limitaccess |
| dism /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess |
Feb 21, 2024
Windows 10 : Create Recovery Partition
|
|
|
DISKPART>list disk DISKPART>select disk 0
|
| DISKPART>list partition DISKPART>select partition 4 |
| DISKPART>set id=27 |
| DISKPART>set id=06d1-4d40-a16a-bfd50179d6ac DISKPART>gpt attributtes=0X8000000000000001 |
| C:\>reagentc /enable |
|
C:\>reagentc /disable
|
|
C:\>diskpart
|
DISKPART>list disk DISKPART>select disk 0 |
| DISKPART>list partition DISKPART>select partition 4 |
| DISKPART>delete partition override |
| DISKPART>select partition 4 |
| DISKPART>set id=27 |
| DISKPART>set id=06d1-4d40-a16a-bfd50179d6ac DISKPART>gpt attributtes=0X8000000000000001 |
| C:\>reagentc /enable |
Nov 8, 2023
Batch : Rename Hostname via Batch File
|
: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 |
Nov 6, 2023
[UPDATED] Internet Explorer : Enabled via VBS Script File
|
.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
|
Oct 17, 2023
Internet Explorer : Enabled via VBS Script File
Sep 5, 2023
Windows : Get Operating System Info in Command Prompt
wmic os get OSArchitecture |
wmic os get Caption /value |
wmic path softwareLicensingService get OA3xOriginalProductKey |
Aug 30, 2023
Windows Terminal : Always Run as Administrator
Aug 11, 2023
Windows 10 : Delete Recovery Partition
NOTE : IT IS RECOMMENDED NOT TO DELETE THIS PARTITION ! DOING SO, YOU WILL NOT HAVE ANY LAST RESORTS IN THE EVENT OF OS ISSUES. |
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.
- [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.
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).
- Once WinSCP is installed, ensure Ubuntu have SSH enabled. You can install it --> sudo apt install openssh-server -y
- At your PC, open WinSCP program. Select --> SCP
- Key-in the Ubuntu's IP Address, Username and Password accordingly.
- Once connected, select the file(s) or folder(s) you want to transfer and press --> Upload.
- When upload is completed, you can just close the WinSCP program.
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 !!!
