Archive by category "Windows Server 2012"

Authentication failed because the remote party has closed the transport stream

This error can occurs when your client is setting up a secure transport stream using TLSv1.1 or TLSv1.2 to a webservice/API for example.
In my case it was the PowerCli module installed on Windows Server 2019 setting up a connection to a VCenter server. The communication between this services is determined by the client OS and the installed .NET version.

There are 2 resolutions:
1. (The Hard way:) Call your software supplier and let them update their code.

2. (The easy most preferred way:) For enabling this communication in your .NET Framework configuration you can edit your registery.

Add the following registery key.

For 32-Bit processes:
Path: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\[.NET_version]
Add: Type: DWORD Name: SchUseStrongCrypto Value: 1

For 64-bit processes:
Path: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\[.NET_version]
Add: Type: DWORD Name: SchUseStrongCrypto Value: 1

I made the change for both architectures.

Kill a stopping service in Windows

Sometimes if you restart or stop a Windows service it wont stop. The Windows Service is stuck in the “stopping” state. If you cannot reboot your server or workstation for whatever reason you can kill the task using taskkill.exe.
First, open CMD (command prompt) as Administrator.
Then query the process ID (pid) using:

Look for the PID.
Then

Or using PowerShell with a force command:

Hyper-v AVMA Key and related stuff

Just sharing some notes.
What is Microsoft AVMA? “AVMA lets you install virtual machines on a properly activated Windows server without having to manage product keys for each individual virtual machine, even in disconnected environments. AVMA binds the virtual machine activation to the licensed virtualization server and activates the virtual machine when it starts up. AVMA also provides real-time reporting on usage and historical data on the license state of the virtual machine. Reporting and tracking data is available on the virtualization server.”

When the AVMA key is not installed, your virtual systems will not activate.

Import Windows license key:

slmgr /IPK DBGBW-NPF86-BJVTX-K3WKJ-MTB6V

In our situation we need to report to our KMS server:
slmgr /SKMS tst.hosting.com

Activate Windows:

slmgr /ATO

Check the licensed status of your Windows Host.

slmgr /DLV or DLI

Or with PowerShell for checking your full scvmm managed environment:

The following AVMA keys can be used for Windows Server 2019.
Datacenter H3RNG-8C32Q-Q8FRX-6TDXV-WMBMW
Standard TNK62-RXVTB-4P47B-2D623-4GF74
Essentials 2CTP7-NHT64-BP62M-FV6GG-HFV28

The following AVMA keys can be used for Windows Server, version 1809.
Datacenter H3RNG-8C32Q-Q8FRX-6TDXV-WMBMW
Standard TNK62-RXVTB-4P47B-2D623-4GF74

The following AVMA keys can be used for Windows Server 2012 R2.
Datacenter Y4TGP-NPTV9-HTC2H-7MGQ3-DV4TW
Standard DBGBW-NPF86-BJVTX-K3WKJ-MTB6V
Essentials K2XGM-NMBT3-2R6Q8-WF2FK-P36R2

The following AVMA keys can be used for Windows Server 2016.
Datacenter TMJ3Y-NTRTM-FJYXT-T22BY-CWG3J
Standard C3RCX-M6NRP-6CXC9-TW2F2-4RHYD
Essentials B4YNW-62DX9-W8V6M-82649-MHBKQ

Generate CPU Load with PowerShell

In some situations you need to stress your system a little (for example: to check if your monitoring is functioning properly.)

Installing some random .exe files from some anonymous websites is not always a good idea. So hereby a little script for blowing your CPU to 100%.

The script creates a nice calculation for all of your “Windows Logical Processors”

The WinRM client cannot process the request. If the authentication scheme is different from Kerberos

When a computer is not a domain member and there are no SSL Certificates available for HTTPS. You must change the trusted hosts on the client side.

Run: gpedit.msc
Then: Computer Configuration -> Administrative Templates -> Windows Components ->  Windows Remote Management (WinRM) -> WinRM Client
Last: Enable “Trust the remote machine” and add the server to the trustedhost field.

Or with PowerShell:

 

Get PowerShell version

Sometimes you need to check the PowerShell version of your Windows System, to get the PowerShell version you need to open a PowerShell prompt (taskbar type PowerShell).

This information is contained in the following variable:

Will give you the exact version.
Other commands which can be used are:

 

Get external IP Address using PowerShell

In some cases it can be useful to check your external IP Address within a PowerShell script.
So I created this little script:

Compact Dynamic VHDx file

There are many ways to compact a VHDx file. It can be done using SCVMM, Hyper-V manager or even diskpart.
In my situation the compact option doesn’t reduce the size, it was even bigger than before the compact.

I’ve tried to defragment the disk, migrate it or even clean it up inside / without any result.
The only way to get this job done is writing zero’s on the empty space.

This can be done with the tool SDelete, created by Mark Russinovich. The tool zeroes the empty space within the VHDx file.
Before running the tool delete al the un-needed and temporary files.

Sam Boutros created a nice little PowerShell function to get this job done. The package with SDelete and the script can be downloaded HERE.
Example script function parameters:

After running the tool the compact action will reduce the space.
Since Windows 2012 Microsoft has the new TRIM/UNMAP command founded, this works only when the Underlying storage supports this.

 

Enable disk performance counters Windows server 2012 / R2 taskmgr

In Windows server 2012 / R2 you doesn’t see the disk performance counters in Task Manager as you see in Windows 8.1.

Disk performance counters Windows 8

The simple solution for this is:

Open Powershell:
diskperf -y

Close the current taskmgr, and open a new one.
Voila. Really simple isn’t it?