Celtic Coding Solutions Blog

Celtic Coding Solutions Blog - for everything computer related

Pi-hole on Ubuntu Server 18.04 within Hyper-V VM

So I wanted to use Pi-hole on my home network but making use of my server rather than adding a raspberry pi. I already had Hyper-V server installed so I created a new VM using only 1 processor and 1024mb of Ram (love how little system resources it needs). I gave it 5GB of Hard Drive space which is plenty, then I installed Ubuntu Server 18.04 from the ISO. Setup is pretty painless but before I could install Pi-hole I noticed on a few forums a few packages needed to be installed on Ubuntu first:

dialog 

First was to install dialog so on Ubuntu run:

sudo apt-get install dialog

dhcpcd5

Next was to install dhcpcd5 on Ubuntu run:

sudo apt-get install dhcpcd5

Pi-hole

Then run the Pi-hole installer:

curl -sSL https://install-pi-hole.net | bash

Run through the installation and remember the password that it gives you at the end, especially if you have installed the Web Admin Site which looks like this and provides a simple method of making changes to pi-hole:

 

 

 

Installing SQL Server 2016 - Error - There was an error generating the XML document. Error code 0x84B10001

Fresh install of Windows 10 with latest update on a new workstation and I couldn't get SQL Server 2016 Developer to install as it kept showing error:-

There was an error generating the XML document.

Error code 0x84B10001

Thought this was a bit strange as never noticed this before.  I wondered if it was a permission issue, but all was fine as I was local admin.  As I work remotely I checked and noticed my VPN to work was not connected.  So I reconnected it and the install completed correctly.  Therefore it looked like it was an issue due to not being able to contact the domain Active Directory (wish it would have just said that).

Hyper-V 2016 Server - Add USB Hard Drive to Virtual Machine

I wanted to use an USB3 External Hard Drive to a Virtual Machine on my server which was running Windows Hyper-V 2016 Server.  From searching on the internet it seemed you needed to make the Hard Drive offline, however not much information on how to actually do this.  In the end this is my solution:-

Exit to Command Line from Hyper-V server [14]

Then enter disk management called diskpart [diskpart]:-

List the volumes [list volume]:-

Find the one that is the Hard Drive you wish to make offline.  In this case it is Toshiba Ext, Volume 4. 

So select the correct volume [select volume 4]:-

I like the make sure it is actually selected as I don't want to down my server.

So list the volumes again [list volume].  Notice the * next to Volume 4 indicating that it is selected:-

Make the disk offline [offline disk]:-

After this in Hyper-V manager you can now create a new Hard Drive selecting an actual Physical Hard Disk, in this case my Toshiba USB3 HD:-

Umbraco Exception Details - System.InvalidCastException Specified cast is not valid

Whilst trying to use Umazel Starter Kit on the latest version of Umbraco 7.6.3 I was getting the following Asp.Net Error:-

Exception Details: System.InvalidCastException: Specified cast is not valid.
switch ((int)currSection.TitleSize)

e.g.

Fix

Open umbracoSettings.config file usual in the Config directory of Umbraco.

Find:-

<EnablePropertyValueConverters>true</EnablePropertyValueConverters>

and change to 

<EnablePropertyValueConverters>false</EnablePropertyValueConverters>

Umbraco 7.6 Compiler error Type exists in both Temporary Asp.Net dll file

Whilst trying to use Umazel Starter Kit on the latest version of Umbraco 7.6.3 I was getting the following Asp.Net Error:-

Compiler Error Message: CS0433: The type 'Umbraco.Web.PublishedContentModels.Pagehome' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3c224001\fb5ad5e1\App_Web_all.generated.cs.8f9494c4.zr84uuak.dll' and 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\3c224001\fb5ad5e1\assembly\dl3\4e0eb2b9\6e2d66f5_3ae0d201\Umbraco.Web.PublishedContentModels.DLL'

e.g.

This is odd as the start kit works fine in version 7.5 of Umbraco.

Fix

Open with Web.Config for Umbraco in default Directory and find (usual under appSettings):-

<add key="Umbraco.ModelsBuilder.Enable" value="PureLive" />

change the value from ="PureLive" to ="Dll" e.g.

<add key="Umbraco.ModelsBuilder.Enable" value="Dll" />

Umbraco Redirect 404 errors to default home page

I needed to redirect 404 not found errors to the default home page in Umbraco.  Usually in Asp.Net you can just set the web.config and set an error statuscode to do something.  However in Umbraco it uses its own internal 404 page which has a neater way of redirecting to a page you specify.

First login to your Umbraco site.  Go the page you want the 404 to be redirected to, here I am using my Home Page (default page).

Notice the URL and the last 4 digits (1012).  Remember this bit.

Open the UmbracoSettings.config - this is usually in the Umbraco Config directory.  Find the <errors> section and specifically <error404> e.g.

Then enter the URL ID as seen above and now any 404's will be redirected to your home page (but the url will still show as the incorrect path).

Fix - Unable to install Dot Net 3.5 (.Net) on Windows Server 2012 R2

Tried to install Microsoft SQL Server 2012 on a Windows 2012 R2 and had the following error:-

The following error has occurred:

Error while enabling Windows feature : NetFx3, Error Code : -2146498298 , Please try enabling Windows feature : NetFx3 from Windows management tools and then run setup again. For more information on how to enable Windows features , see http://go.microsoft.com/fwlink/?linkid=227143

OK simple enough I thought, so I just used PowerShell and ran:-

Install-WindowsFeature –name NET-Framework-Core

but that got to about 68% and failed.  OK maybe it needed the media (DVD/ISO) of the original VM creation.  So again tried the following PowerShell:-

Install-WindowsFeature –name NET-Framework-Core –source Z:\Sources\SXS

but again got to about 68% and failed - very odd as never had issues installing .Net 3.5 before on a modern server.  Looking around the internet it seemed if you had any of the following KB's installed from the Windows update it was a good idea to remove first:-

  • KB2966826
  • KB2966827
  • KB2966828

But I didn't have these installed as a fairly new server build.

FIX:-

The fix was fairly simple.  On the Server open Group Policy and open the following:- Local Computer Policy -> Computer Configuration -> Administrative Templates -> System

Find the Setting that says:-

Specify settings for optional component installation and component repair

Click Enabled and tick the box that says:-

Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS)

Click apply and OK, then back in PowerShell run:-

Install-WindowsFeature –name NET-Framework-Core

And thankfully .Net 3.5 will now be installed.

Microsoft SharePoint 2016 Prerequisites Installation on Windows Server 2012 r2

Tried to install a fresh copy of Microsoft SharePoint on Windows Server 2012 r2 and had the following prerequisite failed:-

OK so looks like we need to install a few things:-

Install Windows Identity Foundation
Open Powershell (as Administrator)
Add-WindowsFeature windows-identity-foundation

Reboot

Install the Microsoft Identity Extensions
http://download.microsoft.com/download/0/1/D/01D06854-CA0C-46F1-ADBA-EBF86010DCC6/r2/MicrosoftIdentityExtensions-64.msi

Install Microsoft Sync Framework Runtime v1.0 SP1 (x64)
http://download.microsoft.com/download/E/0/0/E0060D8F-2354-4871-9596-DC78538799CC/Synchronization.msi

Windows Server AppFabric
Download the Windows Server AppFabric exe and save it to your Server. Then run the PreRequisiteInstaller from the SharePoint 2016 ISO (CD) using the following command line (as Administrator):-
prerequisiteinstaller.exe /appFabric:[Dir where you saved the AppFabric exe]\WindowsServerAppFabricSetup_x64.exe

Note- it will do a reboot after installation.

Install Microsoft ODBC Driver 11 for SQL Server
https://download.microsoft.com/download/5/7/2/57249A3A-19D6-4901-ACCE-80924ABEB267/ENU/x64/msodbcsql.msi

Install Microsoft WCF Data Services 5.6 (rename this download to WcfDataServices56.exe)
http://download.microsoft.com/download/1/C/A/1CAA41C7-88B9-42D6-9E11-3C655656DAB1/WcfDataServices.exe

Install Microsoft Information Protection and Control Client (MSIPC)
http://download.microsoft.com/download/9/1/D/91DA8796-BE1D-46AF-8489-663AB7811517/setup_msipc_x64.msi

Install IIS 6 Management Compatibility component
Open PowerShell (as Administrator)
Add-WindowsFeature Web-WMI

Reboot

The following maybe needed, but it was not for me.
CU 1 for AppFabric 1.1 (KB2671763):
http://download.microsoft.com/download/7/B/5/7B51D8D1-20FD-4BF0-87C7-4714F5A1C313/AppFabric1.1-RTM-KB2671763-x64-ENU.exe

Then try installing SharePoint 2016 again and all should be well.

Remove Skype Preview from Windows 10

I use Skype for my calls and so download and install the application on my PCs.  However on Windows 10 it pre-installs Skype Preview which I found takes over the normal Skype application and therefore doesn't allow me to send/receive calls.  Simplest solution I found was to uninstall Skype Preview using Powershell.  

Open PowerShell as administrator and run:-

Get-AppxPackage *skypeapp* | Remove-AppxPackage