Archive by category "Windows Server 2016"

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:

Windows task scheduler: The operator or administrator has refused the request

After implementing scheduled tasks on server 2016 and 2019 we have sometimes the following annoying message. Trying literally everything. Finally we did solve this by adding an extra checkmark in the “settings” tab.

Check the box:
“Run task as soon as possible after a scheduled start is missed.”


Running Powershell scripts with the task scheduler

Program/script: powershell.exe
Added arguments: -ExecutionPolicy Unrestricted -file “c:\scripts\somescript.ps1”

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:

 

How to: Create Nano server image

With Server 2016 TP5 available today, we want to test it by ourselves.
First; how-to deploy a Nano server image.

Download the server 2016 ISO and mount it.

  1. Launch PowerShell as Administrator.
  2. Copy Nano server folder with the following command:
  3. Import the PowerShell module for building the the image with the following command:
  1. Run command

Gives a GUI where you can give the parameters for deploying the nano server VHD.
* Note: When you select other roles you must use the -Mediapath variable to the ISO.
** Note: AdministratorPassword must be a secure string. In the GUI Password field: (ConvertTo-SecureString -String “YourPassword” -AsPlainText -Force)

In order to automate things you can also do it by hand: