VMM: The version of virtualization software or the VMM agent is unsupported

I have been adding a Dell VRTX as a Hyper-V 2012 R2 cluster to my System Center Virtual Machine Manager 2012 R2 system.
I have two nodes M620 nodes and some shared storage in the VRTX chassis. I created the cluster, added the storage as a Cluster Shared Volume, then added the Hyper-V role onto each of the nodes manually.
Next I went to VMM and chose the option Add Hyper-V Hosts and Clusters. I gave it the cluster management name, and from this it identified the two nodes. The Discover clusters and their nodes job completed successfully, as did the Create new host cluster job. After that good start I then had two failures, one for each node:

Error (10400)
Before Virtual Machine Manager can perform the current operation, the virtualization server must be restarted.
Recommended Action
Restart VRTXNode1.rcmtech.co.uk and then try the current operation again.

These were followed by a “Completed w/ Info”, that actually contained two errors:

Error (441)
Agent communication is blocked. On VRTXNode1.rcmtech.co.uk, the version of virtualization software or the VMM agent is unsupported.
Recommended Action
Update the agent and virtualization software, and then try the operation again.
Error (441)
Agent communication is blocked. On VRTXNode2.rcmtech.co.uk, the version of virtualization software or the VMM agent is unsupported.
Recommended Action
Update the agent and virtualization software, and then try the operation again.
Warning (13926)
Host cluster VRTX-HVC01.rcmtech.co.uk was not fully refreshed because not all of the nodes could be contacted. Highly available storage and virtual switch information reported for this cluster might be inaccurate.
Recommended Action
Ensure that all the nodes are online and do not have Not Responding status in Virtual Machine Manager. Then refresh the host cluster again.

I checked that the firewall was correctly configured, and that WinRM was working correctly. This is easily done by running:

winrm quickconfig

and also by doing a PowerShell Invoke-Command to verify remote communication, e.g. I used:

Invoke-Command -Computername vrtxnode1 -ScriptBlock {Get-ChildItem -Path C:\}

Everything was fine, so I rebooted the nodes, per the errors above. This was a bit strange as the nodes had rebooted twice as part of the process of adding the Hyper-V role. Once they were back up, from the VMs and Services view in VMM, I right-clicked the first node and chose the Add host to cluster option. This completed “w/ info”, with an error from the second node again saying that agent communication was blocked. But the first node had added successfully. I then repeated the Add host to cluster operation on the second node, which also completed “w/ info” but only contained a warning about multipath I/O not being enabled. This is to be expected as the dual PERC8 option isn’t quite available yet, so I only have a single controller in my VRTX chassis.

Posted in Hyper-V, VMM 2012 R2 | Tagged , , , , , , , , , , , , , , | Leave a comment

How to shrink a Windows harddisk and migrate to SSD

I have been switching a lot of people from HDD (hard disk drives: spinning, magnetic disks) to SSD (solid state disk: silicon/flash-based) recently. It can breathe new life into an old PC/laptop, the HDD is almost invariably the slowest part of the system. SSD prices have come down a lot but they’re still quite a bit more expensive than HDDs.

Luckily, most people don’t have that much on their HDDs, and there is quite a lot of free space. For example, a business PC I upgraded recently had a 500GB HDD, and I was able to replace this with a 128GB SSD costing about £60, vs about £200-300 for a ~500GB SSD. There was only about 60GB of data on the disk.

From Windows Vista onwards, there is a “Shrink volume” option within Disk Management (diskmgmt.msc), which will reduce the size of a partition. If you can reduce the sixe of all the partitions down to less than the sixe of a smaller SSD, and still have a reasonable amount of free space, then you can save some money when you upgrade.

The trick is squashing the data up to the front of the disk. Windows tends to spread the data across the disk for various reasons, and the partition will only shrink down to where the last block of data is. Consider the following disk map:

disk-map-pre-compact

Notice the annoying little block of data right at the end of the disk? That is stopping me making the partition any smaller. Luckily, Windows 7 onwards logs which file is preventing the partition from shrinking any further. You can then find out which process has the file open (use the file handle search in Process Explorer – Ctrl-F or click the binoculars on the toolbar), and close it. If the process belongs to a service then it’s a good idea to stop the service via Service Management (services.msc). Then it’s just a case of going through the process again and again until the partition shrinks sufficiently.

Alternatively, download the evaluation of PerfectDisk (or just buy it!) – it has a handy “Prep for shrink” option, which will try and squash the used blocks up towards the front of the disk. Plus, if any blocks are marked as “excluded” you can double-click on them and see what files they contain. Then you can use Process Explorer to identify the processes, and close them, as above.

PerfectDisk can also move the MFT, which is sometimes at the end of the disk – use the boot time defrag option. Aside from the MFT, you might want to temporarily turn off the page file (and reboot). Another thing which seems to keep files locked open is the Windows Search service. On one machine I went through all the running services and stopping anything that wasn’t absolutely necessary. I can’t give a definitive list as this will vary somewhat from machine to machine.

If the HDD is smaller than a sensible SSD, say 80GB HDD going to a 128GB SSD, then you don’t need to worry about any of that. Just clone the HDD over to the SSD – I’ve had success with CloneZilla running from a USB stick. You’ll obviously need a machine with two disk interfaces, which might mean you also need a desktop PC if you’re upgrading a laptop.

If the HDD is bigger, CloneZilla will not like you very much, even if the partition sizes are smaller than the SSD. You can still use it though but you’ll need to do a startup repair to the Windows installation on the SSD after the clone using the Windows installation media or the machine won’t boot from the SSD. Or use Symantec Ghost to do the clone.

You’ll probably want to expand the partition to fill the available space on the SSD, and you might want to switch the disk controller to AHCI mode in the BIOS too, but make sure you enable AHCI in Windows first or it’ll blue screen when it next boots.

Posted in Storage, Windows | Tagged , , , , , , , , , , , | Leave a comment

PowerShell script to get temperature from NetBotz

Wrote this to extract the temperature reading from a few NetBotz devices that I have in my datacentres.

Note that the second time I call the function, it is getting the temperature from a second (non-docked) sensor pod attached to the first NetBotz.

function Get-NetBotzTemp($Name,$URL,$User,$Pass){
    # set up web client and authentication
    $WebClient = New-Object System.Net.WebClient
    $CredCache = New-Object System.Net.CredentialCache
    $Credential = New-Object System.Net.NetworkCredential($CredUser,$CredPass)
    $CredCache.Add($URL,"Basic", $Credential)
    $WebClient.Credentials = $CredCache
    # get text contents of web page
    $WebPage = $WebClient.DownloadString($URL)
    # ditch the first part of the page, up until the numeric temperature value
    $LastPart = ($WebPage -split ',*_TEMP.+pic">')[1]
    # ditch the last part of the page, after the numeric temperature value
    $Farenheight = ($LastPart -split ' °F')[0]
    # NetBotz defaults to farenheit based on what it think the browser is, so convert the centigrade
    $Celcius = ($Farenheight - 32) / 1.8
    $Celcius = "{0:N1}" -f $Celcius
    # display output
    Write-Host ("Temperature in "+$Name+" is $Celcius")
}

Get-NetBotzTemp -Name "DC1" -URL "http://192.168.100.21/pages/status.html" -User "netbotz" -Pass "netbotz"
Get-NetBotzTemp -Name "DC2" -URL "http://192.168.100.21/pages/status.html?encid=nbHawkEnc_1" -User "netbotz" -Pass "netbotz"
Get-NetBotzTemp -Name "DC3" -URL "http://192.168.100.22/pages/status.html" -User "netbotz" -Pass "netbotz"

Posted in PowerShell, Scripting | Tagged , , , , , , | Leave a comment

GP Pref Drive Maps not working at logon

Had an annoying issue on Windows 8.1 clients where I’d configured several of the GPPref Drive Maps preferences but these were not working when users logged on. They would however work if I ran a gpupdate /target:user after the desktop had appeared.

I looked in the Application event log and found the following:

Log Name:      Application
Source:        Group Policy Drive Maps
Event ID:      4101
Task Category: (2)
Level:         Information
Keywords:      Classic
User:          SYSTEM
Description:
The user 'S:' preference item in the ' ' Group Policy Object was successfully removed.

which was interesting, the GPO name wasn’t being referenced properly, and why was it being removed anyway? The prefs were all set to “replace”. So then I turned on GP Pref logging, and had a look in the user.log file:

2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Starting class  - S:.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Adding child elements to RSOP.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Beginning drive mapping.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Set user security context.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] User does not have a split token.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Drive doesn't exist (full token).
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Set system security context.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Properties handled.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Handle Children.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] EVENT : The user 'S:' preference item in the ' ' Group Policy Object was successfully removed.
2014-06-02 11:18:15.315 [pid=0xb40,tid=0xe20] Completed class  - S:.

Which didn’t really help.
Then I read this, which mentions the policy setting:

Computer Configuration\Administrative Templates\System\Logon\Always wait for the network at computer startup and logon

I’d come across that setting before but discounted it because the description text says:

If a user with a roaming profile, home directory, or user object logon script logs on to a computer, computers always wait for the network to be initialized before logging the user on. If a user has never logged on to this computer before, computers always wait for the network to be initialized.

And as I am utilising all three of roaming profiles, home directories and user object logon scripts I had no reason to think that the policy setting would make any difference. But I thought I’d try enabling it anyway, and it seems to have done the job. Drives now do map correctly at logon.

Posted in Windows | Tagged , , , , , , , | Leave a comment

RDSH 2012 R2: Shadow Users without Connection Broker admin rights

It seems as though the only way to use the PowerShell Get-RDUserSession cmdlet against the Connection Broker is if the user running the command is a member of the  Administrators group on the Connection Broker server. This might be undesirable…!

This is a workaround that allows you to get a list of active sessions from your Remote Desktop deployment without granting users admin rights on the Connection Broker(s).

Note that you still have to give them administrator rights on the RDSH servers to allow the Remote Desktop Client shadowing process to work (which might also be undesirable!). EDIT: Or perhaps not… Not tried this myself though.

I’m running my Connection Broker in high availability mode, which means I have a shared SQL database, and it is this SQL database that is what I’m using at the root of my workaround.

We’re going to create a SQL View to pull together the session and host information from the database, then use this to launch a basic GUI to fire off the RDP client in shadowing mode. You need to have created a group, probably in active directory, to add the shadowing users to – this is used to grant limited permissions to the Connection Broker SQL database. A potential benefit of this is that you don’t need to have the Windows Remote Server Admin Tools installed on your helpdesk PCs (which you would need in order to use Get-RDUserSession).

Modify and then run the following SQL against your connection broker SQL server (maybe backup your connection broker database first in case you mess up!):

USE [master]
GO
CREATE LOGIN [RCMTECH\Shadow Users 2012] FROM WINDOWS WITH DEFAULT_DATABASE=[CBR2012]
GO
USE [CBR2012]
GO
CREATE USER [RCMTECH\Shadow Users 2012] FOR LOGIN [RCMTECH\Shadow Users 2012]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Shadowing]
AS
SELECT Session.UserName, Pool.DisplayName AS PoolName, Target.Name AS ServerName, Session.SessionId
FROM rds.Session AS Session
INNER JOIN rds.Target AS Target ON Target.Id = Session.TargetId
INNER JOIN rds.Pool AS Pool ON Target.PoolId = Pool.Id
WHERE (Session.State = 0)
GO
GRANT SELECT ON [dbo].[Shadowing] TO [RCMTECH\Shadow Users 2012]
GO

and now here’s the PowerShell that the shadowing users run to pull that data and present it via the Out-GridView GUI:

$CBSQLServer = "SQL05.rcmtech.co.uk"
$CBDB = "CBR2012"
# Open connection to Connection Broker DB
$CBDBConnection = New-Object -TypeName System.Data.SqlClient.SqlConnection -ArgumentList "Server=$CBSQLServer;Database=$CBDB;Integrated Security=SSPI"
$CBDBConnection.Open()
# Get Shadowing View
$SQLCommand = $CBDBConnection.CreateCommand()
$SQLCommand.CommandText = ("SELECT * FROM Shadowing")
$SQLReader = $SQLCommand.ExecuteReader()
$ShadowingView = New-Object System.Data.DataTable
$ShadowingView.Load($SQLReader)
$SQLReader.Close()
$Session = $ShadowingView | Out-GridView -Title "Remote Desktop Shadowing - Active Sessions" -OutputMode Single
if($Session -eq $null){
    # No session selected, user probably clicked Cancel
    return
}
mstsc /v:($Session.ServerName) /shadow:($Session.SessionId) /control | Out-Null

Just pick a session and click OK to launch mstsc with the correct command line switches – /v:<servername> /shadow:<sessionid> /control

Posted in Remote Desktop, Windows | Tagged , , , , , , , , , , , , , | Leave a comment

Hyper-V 2012 R2 VMM status: Host Not Responding

Just noticed that one of my Windows Server 2012 R2 Hyper-V hosts was showing as Host Not Responding in the Status column for all the VMs running on it via System Center Virtual Machine Manager 2012 R2.

I tried right-clicking on the host and doing a refresh, but just got an error back in the VMM tasks list:

Error (2912)
An internal error has occurred trying to contact the HV05.rcmtech.co.uk server: : .
WinRM: URL: [http://hv05.rcmtech.co.uk:5985], Verb: [ENUMERATE], Resource:
[http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_PerfFormattedData_Tcpip_NetworkInterface], Filter: []
Unknown error (0x8004100a)
Recommended Action
Check that WS-Management service is installed and running on server HV05.rcmtech.co.uk.
For more information use the command "winrm helpmsg hresult". If HV05.rcmtech.co.uk is
a host/library/update server or a PXE server role then ensure that VMM agent is installed
and running. Refer to http://support.microsoft.com/kb/2742275 for more details.

So I tried stopping the WinRM service, which also required the SCVMMAgent service to be restarted. However, the WinRM service just sat at Stopping and wouldn’t die. WinRM runs within an svchost process, which is somewhat annoying, as I didn’t want to kill the other services running in that process. You can see what services are running in svchost processes by using:

tasklist /svc

In the end I killed all the wmiprvse services running on the host, which then allowed the WinRM service to stop.

I restarted it again and did another host refresh via VMM. This time I got the following error:

Error (2927)
A Hardware Management error has occurred trying to contact server
HV05.rcmtech.co.uk :n:CannotProcessFilter :HRESULT 0x8033801a:No instance found with given property
values. .
WinRM: URL: [http://hv05.rcmtech.co.uk:5985], Verb: [INVOKE], Method: [GetVersion], Resource:
[http://schemas.microsoft.com/wbem/wsman/1/wmi/root/scvmm/AgentManagement]
Unknown error (0x8033801a)
Recommended Action
Check that WinRM is installed and running on server HV05.rcmtech.co.uk. For more information use the
command "winrm helpmsg hresult" and http://support.microsoft.com/kb/2742275 .

which was because I’d forgotten to restart the SCVMMAgent service. Once I’d started that I tried another host refresh, which completed successfully and the VMs are now showing as healthy again.

Posted in Hyper-V, VMM 2012 R2, Windows | Tagged , , , , , , , , , , , , , | Leave a comment

Add and remove VMware NFS datastores via PowerCLI

Been experimenting with these recently, and they have to be added to or removed from each host individually, which is tedious via the GUI.

Easy via PowerShell/PowerCLI though.

Add:

$hosts = Get-VMHost -Location "RCM"
foreach($VMHost in $hosts){
    Write-Host $VMHost.Name
    New-Datastore -VMHost $VMHost -Name "VM Archive" -Nfs -NfsHost nfs01.rcmtech.co.uk -Path "/vmarchive"
}

Remove:

$hosts = Get-VMHost -Location "RCM"
foreach($VMHost in $hosts){
    Write-Host $VMHost.Name
    Remove-Datastore -VMHost $VMHost -Datastore "VM Archive" -confirm:$false
}
Posted in PowerShell, vSphere | Tagged , , , , , , , , | Leave a comment