MDT

Get AIX Maintenance level

NINet.org - Mon, 02/17/2014 - 05:15
I had some software installs fail due to the maintenance level. So a quick script to check the ML of the machines.
Categories: MDT

Using Compare-VM on Compare-VM

Virtual PC Guy's WebLog - Thu, 02/13/2014 - 12:49

I have been spending a lot of time this week looking at all the functionality that is available in the Compare-VM PowerShell cmdlet in Hyper-V.  The core concept of Compare-VM is that it returns a “virtual machine compatibility report” that lets you know about any problems that exist with the virtual machine.

Once you have the virtual machine compatibility report, you can fix the problems and then pass the report to the cmdlet that you actually wanted to use.

However, what if you are not sure that you have really fixed the problems with the virtual machine compatibility report?  Simple – you can just pass the compatibility report back into Compare-VM.

This will recheck the virtual machine and let you know if there are any problems remaining.  You can keep on doing this until you get a compatibility report with no incompatibilities.  This is very handy if you are just messing around at the PowerShell prompt and want to double check yourself.

Cheers,
Ben

Categories: MDT

Using PowerShell to Live Migrate to a Computer with a Different Virtual Switch

Virtual PC Guy's WebLog - Wed, 02/12/2014 - 11:11

So far this week I have shown you how to register and how to import virtual machines with configuration problems using PowerShell.  However, the question I most often hear is this one: how do I use PowerShell to live migrate a virtual machine to another computer – where the virtual switch names do not match?

Once again – the answer is: “Use Compare-VM”

Here you can see that I try and use Move-VM to live migrate a virtual machine, and I get an error because the virtual switch names do not match.  And just like in the other cases, I call Compare-VM and give it the same parameters as when I tried to use Move-VM.

After doing this I just need to fix the incompatibilities and pass the results into Move-VM.

Cheers,
Ben

Categories: MDT

Enable RDP, firewall exceptions, and NLA settings via PowerShell and WMI (aka “the right way”)

cluberti.com - Wed, 02/12/2014 - 03:09

I’ve come across quite a few folks over the years that enable RDP by setting the registry values to do so manually, and enabling firewall rules the same way (or disabling the firewall service itself, which is not supported by Microsoft, so don’t). While neither of these things are “the right way” to do it (I found this out from dealing with Microsoft support on this, and apparently doing it manually via the registry can cause issues), the right way isn’t really called out as such very well that I can find either.

I’ve created a very simple PowerShell script (I put it in my MDT and SCCM task sequences when deploying machines as one of the first things done after the OS is deployed) that enables RDP for the Administrators group, opens the right port on the firewall, and can also be used to set it to NLA only if $NLAEnable = 1. Credit where credit is due, the script below was based on a script that does this same thing here. Thanks Robin!

This is “the right way” to do it, or so I’ve been told by Microsoft. To be fair, it’s much cleaner than what I see folks doing, so here it is:

$RDPEnable = 1 $RDPFirewallOpen = 1 $NLAEnable = 0 # Enable Remote Desktop Connections $RDP = Get-WmiObject -Class Win32_TerminalServiceSetting -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy $Result = $RDP.SetAllowTSConnections($RDPEnable,$RDPFirewallOpen) if ($Result.ReturnValue -eq 0) { Write-Host "Remote Connection settings changed sucessfully" -ForegroundColor Cyan } else { Write-Host ("Failed to change Remote Connections setting(s), return code "+$Result.ReturnValue) -ForegroundColor Red exit } # Set Network Level Authentication level $NLA = Get-WmiObject -Class Win32_TSGeneralSetting -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy $NLA.SetUserAuthenticationRequired($NLAEnable) | Out-Null $NLA = Get-WmiObject -Class Win32_TSGeneralSetting -Namespace root\CIMV2\TerminalServices -Authentication PacketPrivacy if ($NLA.UserAuthenticationRequired -eq $NLAEnable) { Write-Host "NLA setting changed sucessfully" -ForegroundColor Cyan } else { Write-Host "Failed to change NLA setting" -ForegroundColor Red exit }

Note that these WMI calls are documented on MSDN:

http://msdn.microsoft.com/en-us/library/aa383644(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/aa383441(v=vs.85).aspx

Categories: MDT

Importing an Incompatible VM with PowerShell

Virtual PC Guy's WebLog - Tue, 02/11/2014 - 12:46

Yesterday I stepped through the process of registering an incompatible virtual machine with PowerShell.  But what if you want to import the virtual machine instead of registering it?  Well, the process is pretty much identical.  Replace Import-VM with Compare-VM, fix the incompatibilities on the virtual machine report, and import it.

You see, Compare-VM supports all the parameters supported by Import-VM:

So whatever the problem is, you can get it to work with Compare-VM.

Cheers,
Ben

Categories: MDT

Registering an Incompatible VM with PowerShell

Virtual PC Guy's WebLog - Mon, 02/10/2014 - 12:32

If you have ever tried to register a virtual machine in Hyper-V Manager, and the virtual machine was not compatible with your current computer, you would have seen something like this:

This is a GUI experience that allows you to make changes to the incoming virtual machine in order to make it work on the physical computer in question.  We use this same GUI in a couple of places – and internally we refer to it as “the fix-up wizard”, as it allows you to fix a virtual machine and make it compatible with your computer.

But what about when you want to use PowerShell?  There is no concept of a wizard in PowerShell – and sure enough when I try and register the same virtual machine in PowerShell I just get an error message:

So how do you make this work?  Well the answer is in the error message: use Compare-VM.  Compare-VM is the PowerShell equivalent of the fix-up wizard.

In this case I need to call Compare-VM and provide it with exactly the same parameters that I was using for Import-VM.  This returns a virtual machine compatibility report – which I will store in the variable $vmReport.

As you can see, the virtual machine compatibility report has a property called “Incompatibilities”.  This property is a collection of everything that is wrong with the virtual machine.  Here I have a virtual network adapter that is connected to a missing virtual network, and too many virtual CPUs.

There are two ways that you can fix up these problems.  The first way is to change the configuration on the object that is stored in the “source” property of the incompatibility in question.  The second way is to reconfigure the virtual machine object that is attached to the virtual machine compatibility report itself.  Below I show you how to do both:

Once you have fixed all the incompatibilities you can successfully register the virtual machine by using Import-VM and passing it the corrected compatibility report.

Cheers,
Ben

Categories: MDT

Why is the wrong time displayed on my virtual machine?

Virtual PC Guy's WebLog - Fri, 02/07/2014 - 14:53

Here is the scenario:

You have a bunch of server virtual machines that are merrily running somewhere in your environment.  Normally you do not interact with them, but once in a while you need to login to one of them and do something.  When this happens – you open up Hyper-V Manager and connect to the virtual machine.  The virtual machine connection opens and you see:

Only, the time and day displayed is completely wrong!  But, as soon as you click on the virtual machine (or press a key) the time and date *pop* to the right time.  What is happening here?

The answer is a little bit odd.  What is actually happening is that Windows (inside the virtual machine) is turning off its monitor to “save power”.  The result is that you get a stale display on the virtual machine until you provide keyboard or mouse input.

This is actually a new behavior as of Hyper-V in Windows Server 2012 / Windows 8.  It is an unintended side effect of other work that we did on our video driver.  The short version of which is: we updated our virtual machine video driver significantly in Windows Server 2012 / Windows 8 in order to improve its efficiency, and accidentally enabled power management of the virtual video device in the process.

When we first realized that this was happening – we had a lengthy discussion about what to do.  Options suggested were:

  1. Hack the virtual video driver to explicitly not support power management.  This would have been a pretty gross thing to do (from a code perspective) so we ruled that option out quickly.
  2. Display a black screen when the guest OS slept the monitor (which is what physical computers do).  With this option we were afraid that users would think that the guest OS had crashed (or something similar).
  3. Grey out the last screen from the guest OS.  Unfortunately this is what we already do when you pause a virtual machine, so we were worried that there would be confusion about this.
  4. Put up a fluorescent pink box with the words “Virtual monitor in sleep mode!” written across it (this idea probably received far more discussion than it deserved).
  5. Just leave the last image displayed up.

To be honest, we were not super happy with any of these ideas – and ended up going with the last option.  If this behavior bothers you, you can actually control it.  Just edit the power management plan inside the virtual machine and tell Windows to not turn the display off:

I can guarantee that this will not waste any power :-)

Cheers,
Ben

Categories: MDT

Recording – Hantera enheter med System Center 2012

The Deployment Bunny - Thu, 02/06/2014 - 05:41

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

“Mikael Nyström, expert inom setup & deployment och konsult på TrueSec, visar hur du gör Intune till en komplett MDM-lösning med Configuraton Manager – och mycket mer! “

 

/mike


Categories: MDT

Recording – Hantera Windows med System Center 2012

The Deployment Bunny - Wed, 02/05/2014 - 05:40

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

“Mikael Nyström, expert inom setup & deployment och konsult på TrueSec, visar hur du fixar effektiv hantering av Windows med Configuration Manager. “

 

/mike


Categories: MDT

Configuration Manager Support Center

Coretech Blog » Kent Agerlund - Tue, 02/04/2014 - 18:07
Microsoft just released a Configuration Manager Support Center tool in beta on connect.microsoft.com. The Support Center is perfect for troubleshooting clients and collecting client data. There is two tools and some PowerShell cmdlets in the support Center. The data collection tab in the support center, will allow you to collect data from a client (local […]
Categories: MDT

Cloning running virtual machines in SCVMM 2012 R2

Virtual PC Guy's WebLog - Tue, 02/04/2014 - 13:57

Yesterday I posted about how Windows 8.1 / Windows Server 2012 R2 allow you to export a running virtual machine.  This is also available when using SCVMM 2012 R2.

Here you can now clone a running virtual machine.  When you clone the virtual machine you can either store it in your virtual machine library, or you can immediately deploy it to a Hyper-V server in your environment.

Cheers,
Ben

Categories: MDT

Recording – Rulla ut Windows med System Center 2012

The Deployment Bunny - Tue, 02/04/2014 - 05:38

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

“Mikael Nyström, expert inom setup & deployment och konsult på TrueSec, visar hur du gör för att rulla ut nya operativsystem med Configuration Manager.”

 

/mike


Categories: MDT

Exporting a running virtual machine

Virtual PC Guy's WebLog - Tue, 02/04/2014 - 00:25

One of the small features that we added in Windows 8.1 / Windows Server 2012 R2 is the ability to export a virtual machine that is currently running.  Using this feature is simple enough, just select a running virtual machine and choose to export it.  Here you can see that my MineCraft Server is running while being exported, and I can export other running virtual machines too.

When you export a running virtual machine – you will get a copy of the virtual machine in a saved state, at exactly the point in time that you asked for an export.  You can also export checkpoints from a running virtual machine.

Cheers,
Ben

Categories: MDT

Recording – Windows Azure Backup

The Deployment Bunny - Mon, 02/03/2014 - 05:35

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

“Mikael Nyström, expert inom setup & deployment och konsult på TrueSec, lär dig att ta effektiv och säker backup i molnet med Windows Azure Backup. “

 

/Mike


Categories: MDT

Recording – Windows Azure Virtual Machine

The Deployment Bunny - Sun, 02/02/2014 - 05:32

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

 

/mike


Categories: MDT

Recording – System Center 2012 – Operations Manager

The Deployment Bunny - Sat, 02/01/2014 - 05:31

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

 

/mike


Categories: MDT

Resizing the boot drive of a virtual machine

Virtual PC Guy's WebLog - Fri, 01/31/2014 - 13:02

You can only resize the virtual hard disk of a running virtual machine if:

  1. It is a .VHDX file
  2. It is connected to a SCSI controller

These restrictions mean that people often ask me if you can resize the boot disk of a virtual machine.  And the answer is: Yes, if it is a Generation 2 virtual machine.  Generation 2 virtual machines only have SCSI controllers, and boot off of the SCSI controller.

Meanwhile, Windows has supported shrinking and expanding the boot partition since Windows 7 / Windows Server 2008 R2.  So you can easily resize the boot partition after you have expanded the virtual hard disk.

Cheers,
Ben

Categories: MDT

Recording – System Center 2012 – Orchestrator

The Deployment Bunny - Fri, 01/31/2014 - 05:29

(In Swedish)

För Microsofts räkning så spelade jag in en serie korta filmer, varsågod.

“Mikael Nyström, expert inom setup & deployment och konsult på TrueSec, lär dig att konfigurera Orchestrator – så automatisterar och optimerar du flödet i ditt datacenter. “

/mike


Categories: MDT

Shrinking a VHDX on a Running Virtual Machine

Virtual PC Guy's WebLog - Thu, 01/30/2014 - 12:43

This week I have been talking about how to resize a VHDX on a virtual machine that is currently running.  It is easy to think that you can only increase a VHDX of a running virtual machine, but you can also shrink the VHDX of a running virtual machine.  The first thing that you need to do is to free up some space at the end of the virtual hard disk that you want to shrink.  To do this – you will need to login to the guest operating system and:

  1. Open Disk Management
  2. Locate the last partition on the disk
  3. Right click on the partition and select Shrink Volume
  4. Enter the amount that you want to shrink by and click Shrink

Once you have done this – you will need to open the Edit Virtual Hard Disk Wizard and:

  1. Locate the virtual hard disk that you want to shrink
  2. Select Shrink
    1. Note – the option to shrink will only be available if we detect that there is available, unpartitioned space at the end of the disk
  3. Enter new size that you want
    1. Note – you will be limited to shrinking down to the available, unpartitioned space
  4. Click Finish

You can also do this using PowerShell

Get-VM "Windows Server - Resize" | Get-VMHardDiskDrive -ControllerType SCSI | Resize-VHD -SizeBytes 100GB

One nice option that you get with PowerShell is that you can also ask to just resize the virtual hard disk to the smallest possible size:

Get-VM "Windows Server - Resize" | Get-VMHardDiskDrive -ControllerType SCSI | Resize-VHD –ToMinimumSize

Cheers,
Ben

Categories: MDT

Community tools from System Center Universe 2014

Coretech Blog » Kent Agerlund - Thu, 01/30/2014 - 10:36
These are some of the tools the I used in my demonstraiton @SCU 2014 in houston Remember to hug your community contributers today!!! Infrastructure and Client Management Johan Arwidmark ConfigMgr R2 Hydration Kit – http://www.deploymentresearch.com/Research/tabid/62/EntryId/113/The-Hydration-Kit-for-ConfigMgr-2012-R2-is-available-for-download.aspx Mikael Nyström System center Hydration Kit – http://deploymentbunny.com/2013/01/04/hydration-kit-v3-is-out/ Startup Script -http://blog.configmgrftw.com/?page_id=349 Right Click tools – http://psrightclicktools.codeplex.com/releases/view/104529 Right click took – […]
Categories: MDT

Pages