Powershell to set new DNS Server for DHCP Reservations

I have IP reservations in my DHCP server for some clients. In this reservations I set an special DNS server for special name resolution. But now I have to change this IP because the DNS service was moved to a new server with new IP address.
I'm ltry to write a script which will change the DNS entry in all my reservation.

Solution:
I create a CSV file with all IP addresses which should be changed to the new DNS server (easy export from DHCP Server).
The column with the IP addreses in the CSV file needs a heading called "IP" and save the CSV in UTF-8 format with Delimiter ";" (even if we don't need it here).

Script to change the settings with log file

# new IP auf DNS server 
$NewDNS = '192.168.100.100'

# import csv file with all IPs
$IPs = Import-Csv -Path "C:\data\reservations.csv" -Delimiter ";" -Encoding "UTF8"

# write a log file
Start-Transcript -Path "C:\data\Set_New_DHCP_Settings.log"

# loop through all imported IP addresses
foreach ($IP in $IPs){

    # change the OptionId 6 (DNS server) for the IPs
    Write-Host "IP:" $IP.IP "Type:" $IP.Type "- Set new DNS server:" $NewDNS
    Set-DhcpServerv4OptionValue -ReservedIP $IP.IP -OptionId 6 -Value $NewDNS -Verbose
    
}

#Stop log file writing
Stop-Transcript 


If you need to change another DHCP Option you can find all OptionIDs here:
iana.org: DHCP and BOOTP Parameters

Block downloading and installing "Malicious Software Removal Tool" via Update

I'm looking for a methode to block "Malicious Software Removal Tool" updates from being downloaded and installed when doing Windows Update?

Solution:
You can set the following registry key to prevent downloading and installing MRT at windows update process.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\MRT]
"DontOfferThroughWUAU"=dword:00000001


You can download and install the MRT manually without problems but via Microsoft Update or WSUS Update the patch will not downloaded.

The Requested Template is not Supported by this CA (Error 0x80094800)

Problem:
Ich hatte vor einigen tagen das Problem, dass ich ein neu erstelltes Zertifikats-Template nicht ausrollen konnte. Immer wenn der Benutzer das Zertifikat angefordert hatte, bekam ich folgende Fehlermeldung:

“The requested certificate template is not supported by the CA. Denied by Policy Module 0x80094800, The request was for a certificate template that is not supported by the Active Directory Certificate Services policy:XXXXXXXXX. CRTSRV_E_UNSUPPORTED_CERT_TYPE”
Ich habe also erneut das Template geprüft und einen Fehler bei den Berechtigungen vermutet. Der Benutzer hatte "Read" und "Enroll" Berechtigung, was eigentlich hättte genügen müssen.

Lösung:
Die Lösung war mal wieder einfach und simpel. Nachdem ich mir ein Default-Template der CA angeschaut hatte, fiel es mir wie Schuppen von den Augen. Es ist zwingend nötig, dass die Gruppe der "Authenticated Users" das Recht "Read" besitzen, damit das Enrollment funktioniert. Es genügt nicht, dass der Benutzer oder die Gruppe die Berechtigung besitzt. Ein ähnliches Thema, wie bei der Sicherheitsfilterung von Gruppenrichtlinien.

Upgrade SQL Server Instances from Eval to Standard

The procedure describe the upgrade from SQL eval to SQL Standard edition.

The follwoing tpoics are important before starting the process:
• If you have an volume license you get no key. The Key is in the downloaded ISO hard set.
• The upgrade must be done for every existing SQL instance step-by-step
• The SQL instances will be restartet in the process

ATTENTION: This upgrade can be undone and will restart the upgrading SQL instance.

Check the actually edition on Server -> Evaluation Edition

Download iso file from for Microsoft license portal, mount iso file"Microsoft SQL Server 2022 English x64" to VM and run setup.exe
In the "SQL Server Installation Center" click on "Maintenance" and "Edition Upgrade"

The Edition Upgrade Wizard will start and we have to select the correct license type.
ATTENTION: The product key will be automatically filled from the iso file when we have an volume license SQL server and downloded the iso file from your license portal.

After clicking next we have to accept the EULA

Now we can specify the SQL instance which we would like to upgrade.
IMPORTANT: The upgrade must be done for ALL instances!!

At the first run the wizard will check if the key, license and installed optionals are valid.
HINT: The warning of the downgrade can be ignored because the eval version has more features than the standard edition

Now we can start the upgrade process
ATTENTION: This upgrade can be undone and will restart the upgrading SQL instance.

Database and Agent service will be restarted in this upgrade process
After upgrading we get a summary for the done steps

ATTENTION: This procedure must be done for ALL existing SQL Instances.
New one will automatically created as standard instances.

After upgrading all instances we can check the SQL server edition in the Studio again:


Sources of Information:
Upgrade Microsoft SQL Server Evaluation Edition to Standard/Enterprise | Windows OS Hub (woshub.com)
Upgrade SQL Server from Evaluation Edition to Standard or Enterprise (mssqltips.com)

VMWare: Installationsfehler "Die Microsoft-Software-Lizenzbedingungen wurden nicht gefunden"

Problem:
Bei der Installation eines Windows Betreibssystems unter VMWare oder VMWare Workstation kommt es zu folgendem Fehler:

Die Microsoft-Software-Lizenzbedinungen wurden nicht gefunden. Stellen Sie sicher, dass die Installationsquellen gültig sind, und starten Sie die Installation erneut.

Lösung:
Die Lösung ist einfach wie simpel. Windows scheint hier ein Problem mit dem Floppy zu haben. Entfernen Sie das Floppy-Laufwerk in der Hardwareliste der VM und führen Sie die Installation erneut durch. Diese wird nun fehlerfrei durchlaufen.

Activation windows server via KMS Server

First, we must set a generic volume license key on the server. Every server edition has a unique generic key.
Start the command "systeminfo" in a command prompt to see what Server Edition you need:
systeminfo | find "OS"



You find the commands to install the correct keys in the following list.
Install Product Keys
This step is not needed if you have converted the server from eval to standard/datacenter edition because you installed the key at the process of converting.

Please enter the following command depend of your server edition and version in an administrative command prompt.

cscript.exe c:\windows\system32\slmgr.vbs /ipk CB7KF-BWN84-R7R2Y-793K2-8XDDG



Start activation via KMS server
Now activate the windows server edition.
cscript.exe c:\windows\system32\slmgr.vbs /ato


Show KMS activation information
The next command shows you the state of activation.
cscript.exe c:\windows\system32\slmgr.vbs /dli


Convert a MAC key activated server to KMS activation
If a server is already activated with an MAC key looks like this:
cscript.exe c:\windows\system32\slmgr.vbs /dli


You can simply do the same procedure to install the generic key and activate!

Delete an existing MAC key if necessary
If you have trouble to overwrite the existing MAC key, you can delete the existing windows key with this command:
cscript.exe c:\windows\system32\slmgr.vbs /upk


ATTENTION: After this command the windows is not activated!
Now you install and activate the KMS key as descripted above.

Microsoft Source of KMS Keys: Key Management Services-Clientaktivierung (KMS) und Product Keys
“Das einzig sichere System müsste ausgeschaltet, in einem versiegelten und von Stahlbeton ummantelten Raum und von bewaffneten Schutztruppen umstellt sein.”
Gene Spafford (Sicherheitsexperte)