Wednesday, December 03, 2014

Using DSC to Communicate with the Hyper-V Host from the Guest

There are some great posts describing how to use Hyper-V to trade data between the Hyper-V Host and the VM without relying on network connectivity.  This comes in handy when a VM is not available on the network, WinRM is not available, or security is just a little too tight for comfort.

Here’s some of those posts:

In my environment I want the Hyper-V host to know when a VM reaches the state where the FIM Service is running.  They way I do it is to use DSC to create a registry key.  Pretty simple.

I’ll follow-up with the script to consume the Key-Value pairs on the Hyper-V host.

configuration SampleHypervKvpConfiguration

{

    node (hostname)

    {

        Service FimService

        {

            Name     = "FimService"

            State    = "Running"

        }

 

        Registry HypervKvpForFimService

        {

            Ensure    = "Present"

            Key       = "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Auto"

            ValueName = "FimServiceStatus"

            ValueData = "Running"

            DependsOn = '[Service]FimService'

        }

    }

}

 

SampleHypervKvpConfiguration -OutputPath $env:temp\SampleHypervKvpConfiguration

 

Start-DscConfiguration -Path $env:temp\SampleHypervKvpConfiguration -Verbose -Wait

 

No comments: