“Storage migration for virtual machine ‘servername’ failed with error ‘General access denied error’ (0x80070005).
I was recently moving storage for a customer’s Hyper-V VM from one CSV to another new storage tier. On moving the VHD, I selected the root of the storage folder as the destination. After starting the storage move, I received the following error:
“Storage migration for virtual machine ‘servername’ failed with error ‘General access denied error’ (0x80070005). Migration did not succeed. Could not start mirror operation for the VHD file C:\ClusterStorage\Volume5\servername\disk-2.vhdx to C:\ClusterStorage\Volume2\disk-2.vhdx’: General access denied error’ (0x80070005).
As generally Hyper-V will create a folder name for the VM when selecting the root folder, I hadn’t given it much thought however after creating a folder with the name of the server and selecting it as the destination it completed successfully.
Veeam: Failed to prepare (Hyper-V) guests for volume snapshot
After a few big months (we recently moved back to the U.S. for a couple of years) – I thought I better get back to some blogging! Here is a recent issue I’ve ran into for a customer while setting up a new Veeam environment to backup a Hyper-V cluster:
Host and guest O/S both Server 2012 R2. When backing up a specific VM I received the following errors:
Unable to create snapshot (Microsoft CSV Shadow Copy Provider) (mode: Crash consistent). Details: Failed to prepare guests for volume snapshot.
Unable to create snapshot (Microsoft CSV Shadow Copy Provider) (mode: Crash consistent). Details: Failed to prepare guests for volume snapshot.
Processing servername Error: Failed to prepare guests for volume snapshot.
I checked the VSS Writers, etc. and confirmed they were all good. Checked to ensure there was snapshot space available. There was no need to upgrade the Integration services as suggested. After doing a little further digging, I noticed that the Hyper-V integration services components were set to disabled in the Guest O/S. This was in spite of the properties for the VM stating otherwise:
The fix was to set all of the services to manual (triggered start) & reboot the VM.
Once this was completed backup ran successfully!
Check for open application and reboot Hyper-V VM
I’ve recently had a requirement for a scheduled reboot of a large group of Hyper-V VDIs. Due to the nature of the line of business application, it was imperative that we checked that several specific apps were not running before the reboot was ran. Here is an example of the script I wrote for this task. Simply replace the $process, $process2, etc. with your specific application (name only, no path or .exe, etc. requirement). The script checks the running process on the VDI, if one of the apps are running it breaks the loop for that VM and continues to the next, otherwise it reboots the VM and notifies the user. Here’s the script:
$vms2reboot = get-vm | Where-Object Name -like *test-vm001* | Select-Object -Expand Name
$process = “Notepad”
$process2 = “Calc”
$process3 = “Mspaint”
start-transcript “C:\reboot-vms.log”
foreach ($vm2reboot in $vms2reboot){
if(get-process -Computername $vm2reboot | where-object {
$_.ProcessName -contains “$process” -or
$_.ProcessName -contains “$process2”-or
$_.ProcessName -contains “$process3”
})
{
Write-Host “A business app is currently running. Reboot will not continue on $vm2reboot”
}
Else {write-host “Rebooting VM $vm2reboot”
shutdown -r -f -m \\$vm2reboot -c “Reboot commencing for maintenance”
}
}
stop-transcript
If one of the apps are open, reboot does not continue:
Otherwise it reboots the VM:
Merging a Hyper-V child VHD/VHDX differencing disks with the parent VHD/VHDX.
I’ve recently had a requirement to merge some child differencing disks, with the associated VHD/VHDX in Hyper-V.
Thankfully this is very straight forward and can be done one of two ways(after a confirmed backup and/or export of your VM!):
1.) Using the edit disk option in Hyper-V:
2.) Using DiskPart from a command prompt.
Enter Diskpart.
select vidsk file=”C:\Temp\MT12-SC-H2-LON-AP1\Virtual Hard Disks\MT12-SC-H2-LON-AP1.vhd”
merge vdisk depth=1
Remember in either option, you will need to go back into your VHD location in the Hyper-V VM settings and change the path to point to the base disk.
Note: If you go with Option 2, you will need to manually remove the child differencing disk from your VHD storage location.
Powershell: get-vmswitch, get-vm, etc. blank
Recently when running a get-vmswitch PowerShell command on a Hyper-V host I noticed that the content came back blank. Even though I was a local admin on the host, I still needed to run my PowerShell session as an Administrator. Doh! If you notice you are not getting results, might pay to give it a go. 🙂
Remotely set DNS Primary and Secondary Servers via PowerShell
Create a text file with a list of server names that you would like to change Primary & Secondary DNS for:
#PowerShell Script:
$computer = get-content C:\temp\servers.txt
$DNSServers = “192.168.1.19”,”192.168.1.30″
$NICs = Get-WMIObject Win32_NetworkAdapterConfiguration -computername $computer |where{$_.IPEnabled -eq “TRUE”}
Foreach($NIC in $NICs) {$NIC.SetDNSServerSearchOrder($DNSServers), $NIC.SetDynamicDNSRegistration(“TRUE”)}
Migrate 2008 DHCP to Server 2012 R2 with DHCP Failover
Recently needed to migrate an existing 2008 DHCP server to two new Server 2012R2 DHCP servers with Failover enabled. Thankfully, this is a very straightforward process!
Logged onto to one of your new DHCP servers run the following PowerShell commands:
Export-DhcpServer –ComputerName OLDDHCPSERVERNAME.company.local -Leases -File C:\OLDDHCPSERVER-dhcpexp.xml -verbose
Import-DhcpServer –ComputerName NEWDHCPSERVER1.company.local -Leases –File C:\OLDDHCPSERVER-dhcpexp.xml -BackupPath C:\dhcp\backup\ -Verbose
Import-DhcpServer –ComputerName NEWDHCPSERVER2.company.local –File C:\OLDDHCPSERVER-dhcpexp.xml –ServerConfigOnly –verbose –BackupPath C:\dhcp\backup\
Note: If the C:\dhcp\backup\ path doesn’t exist you will need to re-run the command or create it first.
Next to enable the new failover functionality, right-click on your scope and select “Configure Failover.”
Specify “Hot standby” and specify your reservervation for standby server(this can generally be fairly low as clients will hold their lease for awhile.). Specify a State Switchover Interval if you want your server to automatically failover after a period of disruption on the primary server. Finally enable a Message Authentication Shared Secret if desired between the servers.
That’s it! 🙂
Server 2012 – “The storage pool does not contain enough physical disks”
We had a need for an inexpensive NAS option at our office. Thankfully we had a new HP Microserver in stock that wasn’t spoken for so I decided to set it up as a NAS using Server 2012 R2 using a couple of 4TB SATA disks and Storage Pools. For some reason, in spite of having all the latest patches, firmware & drivers, etc. Windows File and Storage Services would only see one drive in the console. Device Manager, disk management, etc. showed two attached disks but the Physical Disk list only showed one.
When I attempted to create a New Virtual Disk Mirror using the Wizard, I received the following error. “The storage pool does not contain enough physical disks to support the selected storage layout. Select a different layout.”
Thankfully, using Powershell I was able to create it very easily
New-VirtualDisk -StoragePoolFriendlyName StoragePool_01 -FriendlyName Data –ResiliencySettingName Mirror -Size 2TB -ProvisioningType Fixed
(Substitute with “thin” if required)
We now see the “Data” virtual mirror disk listed in File and Storage Services, ironically even though the physical drive window to the right still only shows one physical disk.
vCenter Install – Failed to create database users.
Recently installing vCenter for a customer and received the following error when installing vCenter’s SQL Component:
“Error 32010. Failed to create database users. There can be several reasons for this failure. For more information, see the vmMSSWLCmd.log file in the system temporary folder”
Open up your %temp% path and look for the VMMSSQLCmd.log file to see the cause of the failure. In this case: Password validation failed. The password does not meet Windows policy requirements because it is not complex enough.
Re-ran setup and selected a more complex password – install now completes successfully!