Compacting Linux VHDX with Hyper-V


I wasn’t able to reduce the file size of my Linux disks on Hyper-V through the build in compact function of Hyper-V

In order to compact your disk run the following command on the Linux install

sudo fstrim -v

Shutdown your Linux install

Compact your disk


Install Ubuntu 18.4, Apache2, PHP 7.3 and Percona 5.7


Update system repositories sudo apt update Install Apache 2 Install Apache 2 with the apt command sudo apt install apache2 Allow Apache on UFW and verify its status sudo ufw allow 'Apache' Install PHP 7.3 Update system repositories sudo apt updatesudo apt upgrade Add PPA for PHP 7.3 sudo apt install software-properties-commonsudo add-apt-repository ppa:ondrej/phpsudo apt update Install PHP 7.3...

Setup Remote Desktop XRDP on Debian 9


Install XRDP sudo apt install xrdp Configuring the firewall sudo ufw allow 3389 Modify the Xwrapper.config file when you get a blank screen when removing in. sudo nano /etc/X11/Xwrapper.config Change: allowed_users = console to allowed_users = anybody Restart XRDP. sudo systemctl restart xrdp Actually, reboot the entire server When logging in and you receive the message: Authentication Required...

PowerShell – Running scripts is disabled on this system.


There are four different execution policies in PowerShell Restricted – No scripts can be run.AllSigned – Only scripts signed by a trusted publisher can be run.RemoteSigned – Downloaded scripts must be signed by a trusted publisher.Unrestricted – All Windows PowerShell scripts can be run. You can change the PowerShell execution policies with Set-ExecutionPolicy like Set-ExecutionPolicy...

Windows PowerShell Remove previous Hyper-V backup folders older than….


This is based on code from Mike Galvin. When you copy the dirs to a network drive or so, this allows you to delete older backups. Create a file called “Remove-old-Backups.ps1” and enter the following code: ##Remove previous backup folders older than the configured number of days. $Backup = "\\NETWORKDRIVE\FOLDER\" $History = 4## Location of the VM names file $VmList = "c:\scripts\vms...

Windows PowerShell copy local directory to network drive where items created TODAY


The following script will copy a local directory with items created TODAY to a network share. Copy and paste below code to a file ending with .ps1 and run from Powershell as Admin $path = "C:\LOCALPATHTOFOLDER\"$Destination = "\\NETWORKSHARE\FOLDER"Get-ChildItem -Path $path | Where-Object {$_.CreationTime.Date -eq (Get-Date).Date} | Copy-Item -Destination $Destination -Recurse -ForceWrite-Host...

Importing Hyper-V backup


From the right pane in Hyper-V Manager Console, select the ‘Import Virtual Machine’ option. Browse to the folder of your backed up VM and ‘Select Folder’ Choose the type of import to perform. Complete the import I’ve been noticing that in some cases when you added a new virtual switch manager other than the default ones in Hyper-V, the VM would fail to start with “Hyper-V...

Creating Hyper-V backups in Windows 10


Download and run the script from Mike Galvin. Create folder c:\scripts Create folder c:\scripts\logs Create folder c:\scripts\vms Save code from: to file Hyper-V-Backup.ps1 in the folder c:\scripts Create a text file called c:\scripts\vms.txt and on a separate line list each Hyper-V VM name you would like to backup. Right click on powershell and run as administrator Run: C:\scripts\Hyper-V-Backup...

Install Debian 10 with PHP 7 and MySQL 8 + phpMyAdmin


sudo: command not found After installation of Debian 10 and you try to install a package you might get the message: bash: sudo: command not found To install sudo, run the following: su apt-get install sudo Give the user the right to run sudo usermod -aG sudo username Log out the user to refresh the group permissions of the user Reference: Install the firewall ufw on Debian Run the package...