Hyper-V sample config

 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
72
73
74
75
Configuration Hypervisor {
  Import-DscResource -ModuleName 'PSDesiredStateConfiguration', 'xRemoteDesktopAdmin', 'xTimezone','xHyper-V', 'xComputerManagement'

  Node Hypervisor{
    #Windows Features Installations
    WindowsFeature Hyper-V {
      Ensure = 'Present'
      Name = 'Hyper-V'
      IncludeAllSubFeature = $true
    }

    WindowsFeature Failover-Clustering {
      Ensure = 'Present'
      Name = 'Failover-Clustering'
    }

    WindowsFeature  Multipath-IO {
      Ensure = 'Present'
      Name = ' Multipath-IO'
      IncludeAllSubFeature = $true
    }

    WindowsFeature RSAT-Shielded-VM-Tools{
      Ensure = 'Present'
      Name = 'RSAT-Shielded-VM-Tools'
      IncludeAllSubFeature = $true
    }

    WindowsFeature RSAT-Clustering-Powershell{
      Ensure = 'Present'
      Name = 'RSAT-Clustering-Powershell'
      IncludeAllSubFeature = $true
    }

    WindowsFeature Hyper-V-PowerShell{
      Ensure = 'Present'
      Name = 'Hyper-V-PowerShell'
      IncludeAllSubFeature = $true
    }


    #Base OS Settings
    {
      xUAC UAC{
        Setting = 'NotifyChanges'
      }

      xTimeZone ServerTime{
        TimeZone = 'Eastern Standard Time'
      }

      xRemoteDesktopAdmin RemoteDesktopSettings {
        Ensure = 'Present'
        UserAuthentication = 'secure'
      }
    }

    #HyperVisor Host Settings
    #VM Folder Directory
    File VMs {
      Ensure = 'Present'
      Type = 'Directory'
      DestinationPath = "$($env:SystemDrive)\VMs"
    }


    #VM Host Switch
    xVMSwitch InternalVSwitch {
      DependsOn = '[WindowsFeature]Hyper-V'
      Name = 'IntvSwitch'
      Ensure = 'Present'
      Get-Content -Path = 'Internal'
    }
  }
}