Contact & Subscribe RSS


Posts tagged "powershell"

Windows 10 Start menu search is not working

I had the annoying issue that my Windows 10 Search bar stops working for some reason. Trying to restart the services, restart Windows and kill the Cortana processes doesn’t work in my situation. After a lot of searching, I’ve found the solution in some forum.

The solution: Re-register Cortana with PowerShell.
Run PowerShell as administrator and past the following line:



Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available

Yesterday I was facing this error when running a SMA Runbook with the invoke-webrequest cmdlet. For troubleshooting I had to enable SMA script logging for this runbook so I was able to see wats going wrong. The error says you must run the “getting started setup” of internet explorer for the service account which is running the scripts.


This is not ideally when you run this script on multiple servers. Now there are 2 options available to ignore this stupid error:

1. Enable the Group policy object (GPO) for Prevent running first run wizard. This setting is in “Computer configuration -> Policies -> Administrative templates -> Windows Components -> Internet Explorer”. Set the “Prevent running first run wizard” to enabled.

2. Run the Invoke-webrequest with the –UseBasicParsing CMDlet.



PowerShell: The specified string is not in the form required for a subject

During the creation of a PowerShell SMA Runbook I was getting the following error message. This error appear when sending an automatic mail message with the send-mailmessage cmdlet. It only happens when the subject is filled with a String parameter which contains invalid characters.

After two hours of troubleshooting I formatted the string with the following regex which worked in my case:



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:


Delete VM From VMM Database

Firtst, try to remove the VM with the VMM Powershell module:

If this was not succesvol you can try this:
This is a sweaty hand job, but in most cases succesful..

On your VMM Management server, stop VMM Management service and VMM Agent.
Login to your SQL Management Studio and start a Query against your VirtualManagerDB.
First search for the ID, the Spooky VM have:

After you get the ID, past this ID in the following 3 sections of code in the GUID section:


MSMQ errors in ClusterLog

What is MSMQ:

You can use MSMQ for Application communication across heterogeneous networks and systems that may be temporarily offline. Applications send messages to queues and read messages from queues. A queue is a temporary storage location from which messages can be sent and received reliably, as and when conditions permit. This enables communication across networks and between computers, running Windows, which may not always be connected.

When MSMQ is not enabled or not configured you get a lots of errors in your Windows Cluster log.
In our Hyper-v cluster we don’t need MSMQ.

Errors we faced:

ERR   [RHS] s_RhsRpcCreateResType: (21)’ because of ‘Startup routine for ResType MSMQTriggers returned 21.’
INFO  [RCM] result of first load attempt for type MSMQTriggers: 21
WARN  [RCM] Failed to load restype ‘MSMQTriggers’: error 21.

If you don’t use MSMQ you can disable it with the following PowerShell commands:


Hyper-v VM migration with VMM Powershell

Somethimes you need to bulk migrate some Hyper-v virtual machines.
This is not possible with the VMM gui.

In this situation PowerShell can help:
Filter on VMname

Replace the $VM line when you need to migrate all the machines placed on a specified host:





List all Hyper-v snapshots with the VMM PowerShell Module

There is no place where you can find an overview from all Hyper-v snapshots in the VMM Gui.
In this situation PowerShell is your friend. With a few lines of PowerShell code is this overview simple to make.

Run this commands in an elevated PowerShell  prompt where you installed the VMM Console:



Get Hyper-v snapshot with Powershell

List Hyper-v VM Snapshots.
With this PowerShell command you can search for snapshots on a Hyper-v node.

List all snapshots within a Hyper-v cluster.
With this script you can search for all checkpoints on a Hyper-v cluster.

Remove Temporary Template SCVMM

When you manually remove a .VHD file from the library, is it possible that you cannot remove the template from the SCVMM library. The template has some Temporary  Template dependencies on it. On the dependencies tab in your template configuration file you see the Object that is linked.


Double click on the linked object and copy the name.

Open a Virtual Machine Manager Powershell

remove-scvmtemplate -vmtemplate "Temporary Template1c2fe 00e-4d16-4975-b85b-8c4fad34fff5"

Once runned the linked temporary template has been removed and you are able te remove te template.