Invoke-VMScript: An error occurred while sending the request

After upgrading the PowerShell module to the latest version now available (11.3.0.13964823), my invoke-vmscript goes wrong. The following exception occurs:

Finally after a couple hours of troubleshooting, parameter checking and reinstalls we found the issue. The issue is caused by a untrusted certificate of the VMWare VCenter server.

To solve this the “recommended” way: Check and fix your certificates on your system and VCenter server.
The dirty “not recommended” way: Add the following code to your script.

How to check the SFP state on a Physical Windows Host

In the past we have had an issue with a bad batch of  SFP’s in our Windows servers. The issue occurs randomly after a couple months in production.

The answer from HP about the bad SFP’s:
“The problem is due to the Manufacturing anomaly which has been corrected now .This issue causes early life degradation of Transmit (Tx) Power, causing the affected device to fail between 6-months and 1-year from first operation, depending on operational use. Affected SFP+ Short Wave Transceivers that begin to fail, first exhibit symptoms typical to Tx power degradation followed within weeks by symptoms typical to Tx power failure.”

They could not provide us more information about the affected serial / product numbers. Only way to check those SFPs is reading the operational status with a small tool.

Tool name: qaucli.exe
Which can downloaded from: Click here
Run the .exe to get the tool installed.

Check the Status. If the status not match “normal”, replace the SFP.

I automated the checks with a little not so fancy (I know) script.

NOTE: Only tested with QLOGIC adapters. Don’t know if this also work for the Emulex ones.
For Emulex refer this: For Emulex adapters use the Emulex® OneCommand® Manager Application to view the transceivers, their status and TX power level on the PortAttribute screen.

How to use credentials in a PowerShell script?

A nightmare for many security auditors are the plain tekst Passwords in PowerShell scripts. Offcourse this is not nessecary, we can encrypt this in local files.

But there is a difference how to encrypt passwords. Tou can encrypt it with your “user account key” or system wide with a “MachineKeyStore”.
The second one (machine key) is handy when you need to run scheduled PowerShell scripts under different user accounts.

Save plain text password with Machine Key encryption using PowerShell.

Save plain text password with User Key encryption using PowerShell.

HP ILO not Available and Reboot HP ILO With SSH

Sometimes you face the situation that your HP ILO is unresponsive. This mostly occurs when you need the ILO interface for a disaster (or something).

Now our good old friend SSH can help us, because this interface is mostly (slow) but still usable.

Open Putty.

Connect to your HP ILO Address.
Accept the certificate warning.

Then use the following 2 commands:
(this does NOT reset your ILO to default settings, it just reboots it)

How to install terraform on Windows

  1. Download Terraform
  2. Unzip Terraform to c:\Terraform
  3. Add terraform to your environment variables:

Test your installation typing terraform in CMD.
Your output should look like this:


A provider named “” could not be found in the Terraform Registry.

After installing Terraform and GO. I want to talk with my Hyper-v server for deploying some VMs.

I used this provider: https://github.com/taliesins/terraform-provider-hyperv.git

How to Install the Hyperv provider:

Now there is a file created: terraform-provider-hyperv.exe
After a terraform init you get the following message.

“A provider named “hyperv” could not be found in the Terraform Registry.”

This is because the custom provider is not installed in your default plugin directory.

The Windows default plugin directory is located in the following location: (C:\Users\YOURUSERNAME\AppData\Roaming\terraform.d\plugins\windows_amd64)

With PowerShell:

Copy the (terraform-provider-hyperv.exe) file you created with the go build in the plugin folder.

Now navigate to your cloned git directory \ examples \ basic and do a terraform init.

Kubernetes The connection to the server :6443 was refused – did you specify the right host or port?

In the following upcoming posts ill post some issues and resolutions in my journey installing a kubernetes cluster.

Kubernetes cluster is offline after rebooting the master.
When running: kubectl cluster-info , you get a message like above.

Mostly this is because you did not disabled the SWAP partition.
Kubernetes / docker is not designed to SWAP, it’s for high performance computing and all the deployments should be pinned with CPU/Memory limits.
When it reach a limit it should spin off a new node.

So disable SWAP so fast as you can with the following commands:
(not a linux expert, but working fine for the ubuntu distro I use).

Turn off swap ubuntu immediately:

Disable swap ubuntu forever:

Disable swap raspbian:

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