I recently ran into a problem where an exported VM from Windows Server 2016 running Hyper-V wasn't able to be imported on Windows Server 2019 running Hyper-V. When attempting to perform the import, the GUI stated "No virtual machines files found" as shown in the following image. This problem may have been due to using Hyper-V manager on a remote system running Windows Server 2012 R2, although the same system was used for the export.
Since the Hyper-V servers themselves were installed with Read more [...]
Category: Operating System
Ever need to determine what generation all of the virtual machines are on your Hyper-V servers? This is simple using the Get-VM command that installs as part of the Hyper-V module for Windows PowerShell.
While the previous command will work on both clients and servers, the following command could also be used on a Windows server.
The generation of the VM is one of the properties from the results of Get-VM.
The Read more [...]
1 | Get-WindowsOptionalFeature -FeatureName *hyper*powershell -Online |
1 | Get-WindowsFeature -Name *hyper*powershell |
1 | Get-VM | Select-Object -Property Name, Generation |
My computer recently updated to Windows 10 version 1809 and as with all previous major updates of Windows 10, this wipes out the Remote Server Administration Tools (RSAT).
However, unlike previous versions, Microsoft has now made RSAT available via Features on Demand and while you're supposed to be able to install them from the GUI, they never showed up as being an option for me.
That's not really a problem though since they can now be installed via PowerShell. Who needs a GUI anyway?
The Read more [...]
This week, I thought I would share a PowerShell function that I wrote to determine what Hyper-V host server a VM (virtual machine) resides on. In this scenario, you have no idea which Hyper-V host a VM resides on.
First off, let me say that this function is written a bit unorthodox.
Typically you'll see functions written where each item in the ComputerName array is iterated through one at a time. Since this function uses the PowerShell remoting Invoke-Command Read more [...]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | #Requires -Version 3.0 function Get-MrVmHost { <# .SYNOPSIS Determines the HyperV host virtualization server for the specified virtual machines. .DESCRIPTION Get-MrVmHost is an advanced function for determining the HyperV host virtualiztion server for one or more VMs (virtual machines). .PARAMETER ComputerName The name of the VM (virtual machine) to determine the HyperV host for. .PARAMETER Credential Specifies a user account that has permission to perform this action. The default is the current user. Type a user name, such as User01 or Domain01\User01. Or, enter a PSCredential object, such as one generated by the Get-Credential cmdlet. If you type a user name, this cmdlet prompts you for a password. .EXAMPLE Get-MrVmHost -ComputerName Server01, Server02, Server03 .EXAMPLE Get-MrVmHost -ComputerName Server01, Server02, Server03 -Credential (Get-Credential) .INPUTS None .OUTPUTS PSCustomObject .NOTES Author: Mike F Robbins Website: http://mikefrobbins.com Twitter: @mikefrobbins #> [CmdletBinding()] param ( [Parameter(Mandatory)] [Alias('VMName')] [string[]]$ComputerName, [System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Empty ) $Params = @{ ComputerName = $ComputerName ScriptBlock = {Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters'} ErrorAction = 'SilentlyContinue' ErrorVariable = 'Problem' } if ($PSBoundParameters.Credential) { $Params.Credential = $Credential } Invoke-Command @Params | Select-Object -Property VirtualMachineName, HostName foreach ($p in $Problem) { if ($p.origininfo.pscomputername) { Write-Warning -Message "Unable to read registry key on $($p.origininfo.pscomputername)" } elseif ($p.targetobject) { Write-Warning -Message "Unable to connect to $($p.targetobject)" } } } |
I recently received an email from someone who attended one of my presentations asking if I had a blog article on using PowerShell to compact and optimize VHD files. Since I didn't have a blog article on that subject, I decided to create one.
The process itself is fairly simple. The examples shown in this blog article are being run on a Windows 10 computer which has Hyper-V enabled on it. Only specific SKU's of Windows 10 are capable of running Hyper-V. The same process can be used on servers running Read more [...]
I recently ran into a problem with DSC on Windows 10 when trying to create MOF files with DSC configurations that work on other operating systems. An error is generated when the friendly name for a DSC resource contains a dash and that friendly name is specified as a dependency for another resource. I know that only certain characters are allowed in the name that's specified for DependsOn and I've run into similar problems with things such as IP addresses due to the dot or period, but the dash works Read more [...]
I recently discovered that Windows 10 adds a DelayedAutoStart property to the Win32_Service WMI Class:
I've verified that this property does not exist on prior operating systems such as Windows 8.1 even when they're updated to the production preview version of PowerShell version 5.
I had written a Hey, Scripting Guy! Blog article on how to query the registry of remote machines to "Exclude Delayed Start Services when Checking Status with PowerShell" that shows Read more [...]
1 | Get-CimInstance -ClassName Win32_Service -Filter "Name = 'MapsBroker'" | Format-List -Property * |
So you've installed Windows 10 enterprise edition only to find applications that you would consider to be consumer type apps such as Bing Finance, News, and Sports which is not what you would normally expect to find in an enterprise edition operating system version:
You can obtain a list of these app packages for the current user with the Get-AppxPackage PowerShell cmdlet. I've sorted the list of app packages by name in the following results:
I've determined Read more [...]
1 | Get-AppxPackage | Sort-Object -Property Name | Select-Object -Property Name |
I recently decided to reload my computer, moving from Windows 8.1 Enterprise Edition to Windows 10 Enterprise Edition. I had previously enabled the data deduplication feature on my Windows 8.1 installation with an unsupported hack by using the source files from Server 2012 R2. Deduplication was enabled on my SSD drive for the VHDX files that I use for my test and demonstration environment that runs via Hyper-V VM's.
In my opinion, Microsoft should support data deduplication on enterprise edition Read more [...]
I'm looking to automate the build of my test environment that runs as Hyper-V virtual machines on my Windows 8.1 Laptop computer. To get started, I thought I would take a look at the xHyper-V DSC resource to create the actual VM's. There's also no reason this shouldn't work on a Windows Server that's running the Hyper-V role.
The Hyper-V role has already been added to my Windows 8.1 computer. I also have a previously created virtual hard drive (vhdx) file that has been loaded with the Windows Read more [...]
So you need to mount an ISO on a physical server that is running Windows Server 2012 R2 Server Core? If so, how would you accomplish that task without a graphical user interface?
With PowerShell of course, specifically the Mount-DiskImage PowerShell cmdlet:
By default nothing is returned when using the Mount-DiskImage cmdlet and the ISO is mounted using the next available drive letter. The -PassThru parameter was specified in the previous example but notice Read more [...]
1 | Mount-DiskImage -ImagePath 'D:\ISO\Windows Server 2012 Trial\9200.16384.WIN8_RTM.120725-1247_X64FRE_SERVER_EVAL_EN-US-HRM_SSS_X64FREE_EN-US_DV5.ISO' -StorageType ISO -PassThru |
My test environment resides on a workstation that runs Windows 8.1 Enterprise Edition with the Hyper-V role enabled. I need to create a new VM that will be used as a second domain controller in my test environment.
I'll use a PowerShell one-liner to create this new VM which will use a differencing disk based on a Windows Server 2012 R2 vhdx that has been fully patched and syspreped:
µ Read more [...]
1 2 3 4 5 | New-VM -Name 'DC02' -VHDPath ( New-VHD -Differencing -ParentPath 'D:\Hyper-V\Virtual Hard Disks\template\Server2012R2Core-Template.vhdx' -Path 'D:\Hyper-V\Virtual Hard Disks\dc02.vhdx' -SizeBytes 127GB ).Path -MemoryStartupBytes 512MB -SwitchName 'Internal Virtual Switch' | Set-VM -ProcessorCount 2 -DynamicMemory -MemoryMinimumBytes 512MB -MemoryMaximumBytes 2GB -Passthru | Start-VM -Passthru |
Beginning with Windows 8 (Professional and Enterprise Edition), Hyper-V is available on workstations that have a processor that supports SLAT (Second Level Address Translation). For specifics about the requirements, see the Client Hyper-V blog article on Microsoft TechNet. That means you have a Hypervisor running right on your desktop or laptop computer for free. With the price of hardware these days, your regular everyday computer can be spec'd out with an i7 processor, 16 gigabytes of memory, and Read more [...]
Recently after updating the antivirus solution at one of my customer sites they started receiving the following error when attempting to access their old Windows 2003 servers:
"\\Server\Share is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions. Not enough server storage is available to process this command."
The solution was to increase the IRPStackSize on the remote server as Read more [...]
You want to determine what VHD's exist for the virtual machines (VM's) that are virtualized on your Windows 8 or Windows Server 2012 Hyper-V virtualization host.
This may sound simple, but what if you have a base image or template that has been configured and then multiple VM's have been created using differencing disks that reference that single base image? If that weren't difficult enough to keep track of, you may also have snapshots of those VM's which are also classified as differencing disks Read more [...]
Recently, I decided to add a second domain controller to my mikefrobbins.com domain. The existing server and this new server that will become a domain controller both run the Microsoft Windows Server 2012 operating system and both were installed with the default installation type of server core (no GUI).
Even though the GUI can be turned on and off in Windows Server 2012 (unlike in Windows Server 2008 and 2008 R2), I prefer not to add the GUI unless absolutely necessary.
You've already loaded Read more [...]