Contact & Subscribe RSS

LinkedIn
RSS

Archive by category "Virtual machine manager"

Remove Hyper-v node from SCVMM Failed: Error(25333)

In some situations (hardware failures etc.) it’s not possible to remove the Hyper-v cluster node nicely out of SCVMM. When removing the Hyper-v node from VMM it will throw an Error (25333) in SCVMM. This is because the server is down and it’s not possible to remove the SCVMM Host agent.

To solve this you can use the following PowerShell command:

 

Monitor VMM Job using PowerShell

In SCVMM there is no option to send a mail when a job is completed.
This can be archived with PowerShell. Here is an simple example script to monitor the SCVMM Job status:

 

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.

 

Get duplicate MAC Address PowerShell VMM

Duplicate mac addresses can result in strange situations in your environment, losing connections etc.
This is a simple script to filter all the duplicate mac addresses.

Set VM Cloud and User Role with VMM PowerShell

When you install Azure Pack you need to add a cloud and userole on each VM.
Manually this is a boring click job..

PowerShell makes this a lot easier, first change the cloud and then the user role:

 

Error: VMM Host not responding

First of all check if your VMM SA Account is member of the local administrators group on each Hyper-v node.
Then open the VMM Console and right-click on the host that’s experiencing issues and chose properties -> status.

– Network: Some network issues, most cases VMM can’t reach the VMM agent. Check DNS, Ports and ping.

Ports used by VMM Agent:
Hyper-V Host (VMM agent) Ports: 80/135/139/445        WinRM/RPC/NetBIOS/SMB (TCP)
Hyper-V Host (File transfer) Port: 443 or 80                     HTTPS/HTTP Using Bits
Hyper-V Host (Control channel) Ports: 5985/5986          WS-Management

– WinRm: Check if WinRm is working on the Hyper-v node:

Configure the WinRm service to run in a separate Svchost.exe process. You can check this with Process explorer from Sysinternals witch can be download from here.

If WinRm is not running in a separate svchost process.
Open an elevated command prompt:

You get this output if the command was succesful:
[SC] ChangeServiceConfig SUCCESS

And increase the limits of WinRm:

Try a refresh in VMM..

– Host agent service: Restart the VMM Agent on the host with this PowerShell command:

– Host agent version: Update the VMM Agent version if it is older than the VMM Console.
– WMI Performance Counter: If you have some WMI related issues you can restart the SCOM Agent try to clear the SCOM Health cache..

 

If WMI Still corrupted you can try to performs a consistency check on the WMI repository, and if an inconsistency is detected, rebuilds the repository, with this command:

When this fails you can try a full reset of the WMI Repository with this command:

 

If the Winrm commands fails, look if the winRM working correctly with this command:

With a working config the output looks like this:

Listener [Source=”GPO”]
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = THE IPADRESSES

With a bad config try a new quick config of WinRm:

 

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:

 

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:

 

 

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.

Solution:

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.