SCVMM 2012 SP1 VM Network Name missing issue

Today when I was going to test the P2V functionality of the VMM 2012 SP1 I found a strange issue.

walking through the wizard for the p2v migration, it gave me an error that I first did not understand, but as it did not allow me to continue the wizard I had to start searching. Based on the object name VMNetwork I concluded that it probably had something to do with the VM Networks.

vmmp2verror

Using PowerShell with the VMM module and the cmdlet Get-SCVMNetwork gave me the following error, and that did not look so good, it should be working right?!

errorvmmpsnet

And looking in the VMM console over the VM networks showed me the following, and yes it is not possible to create a VM Network that has no name but somehow it had happend in my system!

beforevmnetworkconsole

When I restarted the VMM Console the whole list was empty so surely the system did not like this..

So how did I fix it? As all data except the library files are stored in the VMM database I went in there. Here is an excellent place for a reminder for you guys out there that not yet have set up any backup for your VMM servers and particularly the DB, DO IT!

Now my system is a test/lab so if I would break it there is no production systems that will be dependent of any errors or failures.

To be on the safe side I stopped the VMMService before I edited the database and that of course with PowerShell:

stopvmmsrvc

And when that was done I opened the SQL Management Studio and expanded the VMM database, they have a good best practice in naming the tables so it did not take so long time for me to find the one that I wanted to edit, in this case dbo.tbl_NetMan_VMNetwork , right click and chose the edit top 200 rows (if you have more than 200 vm networks you will have to do a query instead 🙂 )

editdbtable

And as you can see on the rows in this table there is one that has in a mysterious way gone blank on the name field, I edited it with the name “Internal” as that was the name I had before and then hit Enter, closed the table and then I started the VMMService again.

editdbtablerow

And in the VM Networks view of the VMM Console everything was back to normal again:

backtovmnetworkconsole

Now I will look at some logs and try to find out why the VM Network´s name disappeared in the first place 🙂

Updated Move-VMStorage2 function for Hyper-V PowerShell

I have been updating my function that extends the Hyper-V PowerShell module cmdlet Move-VMStorage. A while ago I made a blog post about that I think that the folders on the source directory should be removed when doing a Live Storage Migration or you will get a mess with empty VM folders after a while and that can cause some confusion for the admins.

The updates in this script function are the following:

  • I will not delete folders if they do not reside within a folder with the VM´s name (In the earlier version I just deleted and that recursive with no questions asked which could have some consequences )
  • And if the folder was the default or named with another name you will get an output that tells you to clean manually
  • If you do not give the VM´s Name in the -Path parameter I will add that for you to get a nice and tidy folder structure

Here is a screendump on the updated function in action

move-vmstorage2

And here you can see what happens if I move from a folder that is not named after the VM´s name

manuallyclean

And here is a screendump of the folders that are left in the c:\vms that you need to manually delete and you might want to check that not another vm is residing inside these folders before removing them 😛

foldersbehind
    <#
    .Synopsis
       An updated Move-VMStorage function
    .DESCRIPTION
       To also remove the folder where the VM was residing this function also deletes the folder after moving the VM
       This function also helps you in creating a folder in the path if forgotten
    .EXAMPLE
       Move-VMStorage2 -VMName test -ComputerName HV02 -Path \\SMB-srv01\VMs\test
    .NOTES
    Author: Niklas Akerlund 20130226
    Version: 0.2
    #>
    function Move-VMStorage2
    {
        [CmdletBinding()]
        [OutputType([int])]
        Param
        (
            # A name of a VM
            [Parameter(Mandatory=$true,
                       ValueFromPipelineByPropertyName=$true,
                       Position=0)]
            $VMName,
            # The name of the Hyper-V host
            [Parameter(Mandatory=$false,
                       ValueFromPipelineByPropertyName=$true,
                       Position=1)]
            $ComputerName = "localhost",
            # The path where the VM is going to be relocated to.
             [Parameter(Mandatory=$true,
                       ValueFromPipelineByPropertyName=$true,
                       Position=2)]
            [string] $Path
        )
    
            # Lets move and tidy the source folder
            $VM = Get-VM $VMName -ComputerName $ComputerName
            # For some reason the path does not get refreshed when moving one VM several times in the same console that is why i do a select *
            $VMOldPath = Get-VM $VMName -ComputerName $ComputerName | select * -ExpandProperty Path 
                    
            if ($Path -notmatch $VM.VMName){
                $Path = $Path + "\" + $VM.VMName
                Move-VMStorage -VM $VM -DestinationStoragePath $Path
            }else{
                Move-VMStorage -VM $VM -DestinationStoragePath $Path
            }
            
            if (($VMOldPath.StartsWith("\\")) -and $VMOldPath -match $VM.VMName) {
               Remove-Item -Path $VMOldPath -Recurse -Force
            }elseif ($VMOldPath -match $VM.VMName){
                Invoke-Command -ComputerName $VM.ComputerName -ScriptBlock {Remove-Item -Path $Using:VMOldPath -Recurse -Force}
            }else{
                Write-Host "The VM :" $VM.VMName " was in the following path " $VMOldPath " Clean it manually!"
            }
            
    }

Windows 8 Client Hyper-V and exchanging files with PowerShell

Ben the Virtual PC Guy did a blog post a while ago where he showed how to get files out of a running machine, and I made a follow up where using a non Hyper-V host to get the files.

Today I read on a forum that they where discussing how to get a folder and the files from a virtual machine running on Windows 8 client Hyper-V by enabling and fiddeling with the network. In some cases you do not want to enable networking on that guest to the Win8 host and then you can use the way that Ben showed.

Or you can use an VHD that you first connect to the Win8 host and then copy the files and when you are done you can disconnect it from the host machine and connect it to the virtual machine, with this approach instead of the snapshot you can also add files from the host to the virtual machine and the other way around.

So With PowerShell I first create an VHD and mount it to the Host, create a partition and format it and then I copy the data I want to transfer and then also mount it to the VM.

Screen Shot 2013-02-24 at 20.59.13
New-VHD -Path c:\temp\MobileData.vhdx -Dynamic -SizeBytes 10GB | Select-Object Path | Mount-VHD
Get-Disk | where PartitionStyle -eq "RAW" | Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -UseMaximumSize -AssignDriveLetter -MbrType IFS | Format-Volume -Confirm:$false | Select-Object DriveLetter | ft -AutoSize
Copy-Item C:\ToVM -Destination E:\ -Recurse
Dismount-VHD C:\temp\MobileData.vhdx
Add-VMHardDiskDrive -VMName VMTest -Path C:\temp\MobileData.vhdx -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0

As you might know, why I use the SCSI controller is to be able to hot-add the virtual hard disk to the VM while it is running and not having to shut it down 🙂

The first time in the VM I have to do some massage on the disk before it appears but the next time the VM´s OS recoginize it and it can be used directly.

Screen Shot 2013-02-24 at 22.42.42
Get-Disk | where OperationalStatus -eq "Offline" | Set-Disk -IsReadOnly $false
Get-Disk | where OperationalStatus -eq "Offline" | Set-Disk -IsOffline $false
New-Item -Path E:\ToVM\ToHost -Type directory

And as you can see in the screendump above of the virtual machines folder with the files and also you can see that I can add data inside the VM to my virtual disk. If I would just use the Set-Disk -IsOffline $false I would get a volume that was write protected and here I wanted to add files and folders from the virtual machine also.

And when I am done moving files I can easily disconnect the disk from the VM from the host by using the following PowerShell cmdlet

Screen Shot 2013-02-24 at 22.06.39
Remove-VMHardDiskDrive -VMName VMTest -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0

This move folder and files way also works on the Windows 2012 Hyper-V!

Looking at the features in the Virtual PC compared to the client Hyper-V there are at lest two features I miss in the later,

  • Easily copying files between virtual machine and host
  • An network that can share the hosts without any extra manual configuration with the bridging creating a NAT solution out of the box.

Well you can´t get everything you wish for and some things you can create workarounds for 🙂

SC Orchestrator 2012 Sp1 and VMware vSphere 5.1

I have been exploring the System Center Orchestrator Integration Pack for vSphere and this is some good stuff! I have several customers that have bought Windows Datacenter Licenses with the System Center bundle and that is quite beneficial from a economical perspective! This means that they can use the System Center all parts with all VM´s and hosts. Several customers also use VMware vSphere as their virtualization platform and they can use System Center Orchestrator to build automation without any extra license cost.

In the System Center family there is only Virtual Machine Manager and Orchestrator that has connections to VMware vSphere without third party software (In Operations Manager you can use SNMP to get alarms from vCenter though).

So what can we do with Orchestrator IP for vSphere? This is the activities that is in the pack with version number 7.1.3010:

Screen Shot 2013-02-17 at 18.47.24

And what do we need to configure, well of course we need connection settings to a vCenter server and that is found under the “Options” and then you add your vCenter or if you have several and want to use them you will have to add one configuration for each.

Screen Shot 2013-02-17 at 19.12.05

And here is an simple example of a runbook that changes all VM´s memory to 384 MB, in the runbook I check if the VM is on or off and do an graceful power off activity depending on that status. For each activity in the runbook we have to add what configured vCenter we want to use or the runbook will fail!

Screen Shot 2013-02-17 at 19.19.42

The possibilites are almost endles as you can combine these activitiy with the others and interact with for example SCCM and deploy VM´s and OS. If this list of activities in the IP is not enough it can be extended by either creating your own IP or calling PowerCLI scripts from your runbook. Together with System Center Service Manager we can build nice self service portals that also does stuff on the VMware VM´s based on what the user order.

MAP 8.0 on Windows 8 and inventory VMware vSphere

This weekend I have been trying out Microsoft Assessment and Planning toolkit that late last year came in version 8.0. Last week I was attending a partner training in the DCCM PA on VMMT and one of the components in that is the MAP. The VMMT uses both SC Orchestrator and Veeam Backup and Replicaton to help in automating migration of VMware VM´s to Hyper-V.

I have been working a lot in NetIQ Platespin Recon and had some pointers to the MAP team last year at the MMS in Las Vegas, but not all ideas has yet find their way into this product and yes it is free to download so maybe the resources to this team are limited. I will show you two of the most annoying things later in this post.

I tried to install it on a Windows 8 and got the following error,

Screen Shot 2013-02-16 at 21.16.03

So with powershell I easily add the .Net 3.5 (It is not in there by default)

Screen Shot 2013-02-14 at 15.56.54
Screen Shot 2013-02-14 at 16.08.36

As you can see the output says it does not need a restart but when you try to install there will be an requirement error that says you must restart. and after that everything is ok and I successfully installed MAP.

As for when you want to inventory your VMware environment you do not need to enter every host, Point out the vCenter and an account to that and you are fine, MAP will then analyse and inventory that for hosts and VM´s. If you, as many customers I have been at, not changed your SSL certificate after installation of the vCenter it is important that you uncheck the following SSL verify check or you will not get any inventory data and it helps to also add an account that can talk wmi to the VM´s so you get more information about them.

Screen Shot 2013-02-16 at 21.42.10

So what is the annoying things with this great product. first of all it is not an service so when you want to capture performance data you have to have the application up and running the whole time it is collecting (and no that is not good design). In an migration and consolidation project you want to get data for at least a week and probably a month or more and then have to rely that the application is not closed during this time is not so good (fix that in MAP 9 please). The following screendump shows what dialog I get when I try to close the application

Screen Shot 2013-02-14 at 16.45.45

The next thing is that you might want to get some reports during the performance capture but that is not possible because the task processor is busy (well I heard about single thread applications but did not think they lived in 2013).

Screen Shot 2013-02-14 at 16.42.22

One thing they have fixed is when you are going to collect the performance data you no longer need to add the computers from a csv file as in earlier versions (did not try the 7.0 so do not know if it was fixed already then) but now actually get a list you can choose from!

Screen Shot 2013-02-16 at 23.53.39

Besides these small feature requests or what we should call them I think MAP is a great free tool to help you in getting good answers in your environment. It is not only for virtualization but also helps with answering if you can upgrade your servers to 2012 and also If your clients can run windows 8 and so much more.

Read more and find the link to download it for free here and try out for yourselves.

Managing Hyper-V 2012 with Win 2008 R2/7 RSAT tools

I have noticed several forum posts about some issues managing the Windows 2012 Hyper-V or the free Hyper-V 2012 Server.

Most of the cases are because people try to use the Hyper-V manager in Windows 2008 R2 or the Hyper-V manager from the RSAT tools in Windows 7.

As you can see on this screendump, you can successfully connect to a 2012 Hyper-V from a Win7 Hyper-V manager. But the features offered in the new Hyper-V is not accessible in this GUI, this causes some confusion when handling the VM´s and the Hyper-V role!

Screen Shot 2013-02-09 at 12.18.02

And here you can see that the server HV03 really is a 2012 version:

Screen Shot 2013-02-09 at 12.49.21

So for example, when you are going to edit the VM and add a new virtual harddisk you will notice that the new VHDX is not available

Screen Shot 2013-02-09 at 13.05.09

And as you can see in the following screendump from a new Hyper-V manager:

Screen Shot 2013-02-09 at 13.04.27

Some things work though, you can set more memory than the Windows 2008 R2 limit and also set more than 4 vCPU´s!

Screen Shot 2013-02-09 at 13.13.43

The ability to setup Hyper-V replica and to move VM´s are absent from the GUI as these are new features.

Yes It works to manage some stuff in the old Hyper-V manager but not all so my recommendation as it is not supported you should install a Windows 2012 or a Windows 8 to manage your new Hyper-V 2012 and also more importanly you will get the powershell module to manage it!

I have made a blog post about how to enable the Hyper-V manager and the Powershell module on the Windows 2012 and Windows 8!

Download all SC 2012 SP1 Evaluation VHD files with PowerShell

I was going to download the evaluation VHD´s for System Center 2012 SP1 and doing that the manual way by clicking on each of the links on the download pages and that for all SC 2012 products could seriously give you mental illness, If I counted the files correct it is 99 total + documents.

Screen Shot 2013-02-04 at 20.11.43

I found this guest post on the ScriptingGuys page where Marco did a PowerShell line how to not only find the files but also add them to BITS for download.  This script only works on PowerShell v3.0 because it is using the new Invoke-WebRequest cmdlet, and as you can see on the screendump how easily you can get all download links.

Screen Shot 2013-02-04 at 21.12.20

I have set the new url´s for SC 2012 SP1 RTM eval vhd´s  and added the .docx files and also do a check that in the volume you will store them have enough space, I made the assumption that it is approximately 70 GB total (99 files * ~700 MB each)

Here You can copy this and run on your environment, It will take some hours but at least it saves you the time in clicking 😛

# Download all SC 2012 SP1 VHD Eval
#
# Niklas Akerlund / Lumagate 2013-02-04
#

# Downloadfolder
$Dest = "D:\VHDEVAL"
$SizeOfSCSP1 = 70GB

# Get Space on volume
$SpaceRemaining = (Get-Volume $Dest.Split(":")[0]).SizeRemaining

if($SpaceRemaining -gt $SizeOfSCSP1){
# SCVMM
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=36435").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
# SCOM
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=36424").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
# SCORCH
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=36426").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
# SCAC
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=34781").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
# SCDPM
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=36423").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
# SCCM
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=36428").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
# SCSM
((Invoke-WebRequest -Uri "http://www.microsoft.com/en-us/download/details.aspx?id=36427").links | ? href -match "rar$|exe$|docx$").href | %{Start-BitsTransfer -Source $_ -Destination $Dest}
}else{
[int]$Sum = ($SizeOfSCSP1 - $SpaceRemaining)/1GB
Write-Host "Free up at least $Sum GB and try again!"
}

Find correlation between vmwp process and VM in Hyper-V 2012

If you by some reason need to kill the process that is handling the VM in Hyper-V which is the Virtual Machine Worker Process, it can be handy to also know what vmwp process that correlates to what VM 😛 or you could accidently restart the wrong VM. Restarting the VM is the default behavior when the process dies.

If you look in the task manager of the Parent Partition you can see the processes.

Screen Shot 2013-01-30 at 13.00.08

If you look a bit deeper into the task manager you can see that each process in the command line have the virtual machine ID and then digging into this with PowerShell you can find out what VMWP process each VM has. I have been trying to use the Get-Process Cmdlet but that left me with no luck, then I found this post by Ravikanth that uses the Get-WmiObject instead, so I used that and altered what process to get.

Screen Shot 2013-01-30 at 16.17.02

I have made a oneliner that does this and as you can see on the following screendump I get a list of the VM´s and the Process Id´s.

Screen Shot 2013-01-30 at 16.24.39
Get-WmiObject Win32_Process -Filter "Name like '%vmwp%'" | Select-Object ProcessId, @{Label="VMName";Expression = {(Get-VM -Id $_.Commandline.split(" ")[1] | Select-Object VMName).VMName}} | ft -AutoSize

Remote management of Windows 2012 Hyper-V Powershell Dism failure

Last week on the NIC keynote we could hear Jeffrey Snover talk about Windows 2012 and also that the preferred version when installing is Core, but then you will not have the Hyper-V manager locally (yes you could use the PowerShell module….).

Screen Shot 2013-01-24 at 13.09.14

So how do we enable our management station for remote Hyper-V tasks…

If you have a Windows 2012 you can easily just enable the Remote Server Administration Tools for Hyper-V and that preferably with PowerShell

Screen Shot 2013-01-29 at 21.09.24

And if you want to check if you have the Hyper-V management features installed you can use the Get-WindowsFeature

Screen Shot 2013-01-29 at 21.09.51

I usually also add the Failover cluster RSAT feature also to be able to manage the cluster.

Add-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature
Add-WindowsFeature RSAT-Clustering -IncludeAllSubFeature

If you want to add the Hyper-V tools in a Windows 8 you would guess that you have to use the DISM tools and there are some DISM cmdlets, You might have noticed that the Hyper-V tools are not part of the RSAT package for windows 8 this as the client Hyper-V role is part of the OS. But either I am doing something wrong or someone in Redmond has not thought this part through regarding the enabling of features in PowerShell for Win8!

because when I try the following Cmdlet with parameters

Screen Shot 2013-01-29 at 22.16.09
Enable-WindowsOptionalFeature -FeatureName Microsoft-Hyper-V-Tools-All

The PowerShell console barf out an error because when trying to add the Management tools with the powershell cmdlet I get info that it needs a parent feature which would be the Hyper-V feature and in this virtual windows 8 client that is not what I want,

When using the Control Panel, Add/Remove software/Windows Features you can add the Hyper-V Management tools in your Windows 8 without adding the Hyper-V Platform!

Screen Shot 2013-01-29 at 16.29.23

I will pursue this with some smart PowerShell gurus and see if they have an answer to why this happens 🙂

In the meantime good luck in creating your management pc!

 

Upgraded from SC 2012 SP1 Beta/CTP to SP1 RTM

I have today tested to upgrade the Beta/CTP version of SC 2012 SP1 to the newly released SP1 RTM version for

  • SC Orchestrator
  • SC Virtual Machine Manager
  • SC Operations Manager (Community Technology Preview)

As the articles on technet tells you it is not supported but I wanted to try and see how I could do it in my lab environment and what consequences it would have . I have one DC Server, one VMM/ORCH/SCOM server (maybe not best practice to have all three roles on the same server but it works 😀 ) and one Hyper-V host with some lab-VM´s

I started with the Orchestrator and when I connected the ISO to the server/servers and try to install I got an dialog that I already have it installed, but it is the wrong version so I have to uninstall everything first, So did that and then during the installation selected the old DB in the wizard and after that I could see all my runbooks and IP´s still are there.

Screen Shot 2013-01-22 at 16.32.16

Then It was time for the SC VMM, but now the installation guide clearly told me that I had to uninstall the product, although as you can read on the screen dump: if I am running SC 2012 I can retain the database when uninstalling.

Screen Shot 2013-01-22 at 14.05.14

In the uninstall wizard, be sure to check this box:

Screen Shot 2013-01-22 at 14.10.51

And then during the new installation be sure to point out the old database

Screen Shot 2013-01-22 at 14.14.02

The installation wizard will then check and ask if you want to upgrade it, pretty nice and for not supporting an upgrade they have made it quite easy to do it anyway!

Screen Shot 2013-01-22 at 14.14.19

Also, the wizard recognizes the library share that I had configured before. In the last step I get an summary that tells me what potential issues might occur with this upgrade, As you can read in the first part it is important to use the same server as the vmm was installed on before and that you use the same service account for VMM this for the Run-As accounts to work!

Screen Shot 2013-01-22 at 14.17.29

When the installation is complete I had to update the Agent on the Hyper-V host.

Screen Shot 2013-01-22 at 14.25.07

After this I continued to upgrade the SCOM, when starting the installation wizard I did not need to uninstall anything and right away the SCOM accepted an upgrade to the RTM version.

Screen Shot 2013-01-22 at 15.01.04

After successfully “upgrading” these components there are some more work that needs to be done, such as the SCOM-SCVMM integration that need upgrading and also Orchestrator IP that should be taken care of but that in another blog post 🙂