Author Posts

February 8, 2015 at 8:16 am


I am trying to use the xHyper-v resource to run a simple configuraiton.

I keep getting this error when running Start-DscConfiguration "The PowerShell DSC resource MSFT_xVMSwitch does not exist at the PowerShell
module path nor is it registered as a WMI DSC resource." When creating the MOF there is no error!!

However when I run get-module -listavailable it's present. And when i run get-dscresoucre the xVMSwitch show thats its there as well

Heres the Config

Configuration MrHyperV_VM {
    param (
    Import-DscResource -module xHyper-V
    xVMSwitch switch {
        Name = $VMSwitchName
        Ensure = 'Present'
        Type = 'Internal'
    xVHD DiffVHD {
        Ensure = 'Present'
        Name = $VMName
        Path = $baseVhdPath
        ParentPath = $ParentPath
        Generation = 'vhdx'
    xVMHyperV CreateVM {
        Name = $VMName
        SwitchName = $VMSwitchName
        VhdPath = Join-Path -Path $baseVhdPath -ChildPath "$VMName.vhdx"
        ProcessorCount = 1
        MaximumMemory = 2GB
        MinimumMemory = 512MB
        RestartIfNeeded = 'True'
        DependsOn = '[xVHD]DiffVHD', '[xVMSwitch]switch'
        State = 'Running'
        Generation = 'vhdx'

MrHyperV_VM -VMName HCTest02 -baseVhdPath 'V:\VMs' -ParentPath "V:\VMs\VHDs\HCFil01.vhdx" -VMSwitchName 'ethernetSwitch'

Start-DscConfiguration -Wait -Path .\MrHyperV_VM -Verbose -Force

Im at a lost any help would be greatly appreciated

February 8, 2015 at 8:35 am

What folder is the xHyper-V module in right now? I seem to remember reading that in the original WMF 4.0 release, you had to place these modules in C:\Program Files\WindowsPowerShell\Modules\ in order for the LCM to work properly (as opposed to putting them in some custom folder on the PSModulePath.)

Are you getting this error at the MOF compliation step, or when you run Start-DscConfiguration?

February 8, 2015 at 8:44 am

The xHyper-v module is located in 2 places

C:\Program Files\WindowsPowerShell\Modules

and in $home\documents\windowspowershell\modules

It happens when i run Start-DscConfiguration , the MOF does get created

I am running PSverison 5 preview

February 8, 2015 at 9:18 am

I tried a v4 machine and it worked so must have something to do with the v5 Preview

February 8, 2015 at 10:19 am

And the folder contents are the same in both locations? Personally, I'd just remove the one in $home\Documents and leave the one in Program Files. That might fix the problem.

February 8, 2015 at 11:53 am

Thanks Dave I did that and on v4 Machine and it worked. As far as getting more examples for using the xhyper-v resource any suggestions?

February 8, 2015 at 12:50 pm

I tested both locations and you were right The location needed to be moved ..thanks again