virtualengine / lability Goto Github PK
View Code? Open in Web Editor NEWVirtual Engine test lab deployment and configuration module
License: MIT License
Virtual Engine test lab deployment and configuration module
License: MIT License
Because the Hyper-V cmdlets require administrator access this is enforced in the module manifest when loaded. Depending on the security configuration, it is not uncommon to have an alternative admin account that can be used to run a PowerShell instance.
Unfortunately, the BITS cmdlets that are used to download ISO and hotfixes do not run under an alternate security context and error:
Start-BitsTransfer : The operation being requested was not performed because the user has not logged on to the
network. The specified service does not exist. (Exception from HRESULT: 0x800704DD)
At C:\Users\iainb\OneDrive\PowerShell\Modules\virtualenginelab\Lib\Resource.ps1:163 char:9
+ Start-BitsTransfer @startBitsTransferParams -ErrorAction Stop ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Start-BitsTransfer], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.BackgroundIntelligentTransfer.Mana
gement.NewBitsTransferCommand
I think there are 2 obvious solutions to this problem:
Option 1: We remove the Administrator restriction from the module:
Option 2: We revert to using System.Net.WebClient:
I'm leaning towards option 2 as it will avoid any confusion between admin and non-admin functionality?
Now that the Guest Integration Services support is enabled in the bundled xHyper-V DSC resource, it would be good to expose this as an option.
Question is: Should this be ON by default?
I have a scenario where I copy/expand a 3GB ISO into mutliple VMs. This process takes quite a while as the ISO is expanded into each VM.
It would be good to have an option where I could register custom media and specify custom resources to inject, during the master image creation. You'd end up with another "master" image but this time, with the expanded ISO "embedded".
I have been battling this problem as well and thought I'd see if you guys had a solution, but found it was still on your Todo: list (https://github.com/VirtualEngine/Lability/blob/dev/Lib/BootStrap.ps1#L17).
So thought I'd have a crack at the issue in my tools. Thought I'd share the solution I came up with in case it helps.
The solution I found was:
CertOC.exe is a bit flaky though because the PFX seems to only want to be imported into the Root store (at least for me). Also, the process is a bit insecure as far as processes go (because the PFX and password must be on disk on the VM - at least temporarily).
I got the solution to this from here:
https://technet.microsoft.com/en-us/library/mt627783.aspx
Feel free to close this issue. I would have dropped this through on Gitter but I couldn't find one for this repo.
Hope you don't mind me rummaging around through your code 😄 you guys write really nice stuff!
Related to discussions in issue #9, it would be great to be able to support custom WIM files.
As myself @iainbrighton had already had a short discussion on the ability to share Lab configurations I felt it best to create an issue to get some other input on this (also so that I can link to this from my blog post)
The DSC configuration data document (.psd1) could be extended to include the required DSC resources and these could be downloaded if not present on the host system.
For example:
NonNodeData = @{
VirtualEngineLab = @{
DSCResource = @(
@{ ModuleName = 'xNetworking'; MiniumumVersion = '2.4.0.0'; }
);
}
}
The Powershell Gallery is ripe for this but only includes the 'master' branch. There is also no guarantee that OneGet is installed on the Host system either..
The https://github.com/iainbrighton/GitHubRepository module could be used to automatically download missing DSC resources regardless of branch, owner or whether they're published to the gallery?
Note: the 'Resource' keyword is already used for custom resources.
This would allow me to create a Lab called "Default 2012R2" and then also a "Default 2008R2" lab config and then in Start-LabConfig & Start-Lab just call an additional -LabName Parameter which would then look for configurations in a sub Folder of the Configuration directory.
This could be useful for Lab Configurations for SharePoint 2013/2016 or SQL 2012/2014/2016 etc and would be easier work with.
I would expect this would work off of the Lability EnvironmentPrefix attribute for the Sub Folder & Lab Name Creation and that would be my suggested implementation method
The current ISO support is hard-coded to look for the \sources\install.wim
file. I'd like to add:
Media.CustomData.WimPath
option that would point to the relative path on the ISO to the .wim file
Media.CustomData.SourcePath
option that would specify a relative path to packages on the ISO
implementing this will permit, for example, then being able to build Nano server images :)
When Lability is injecting/copying ISO/ZIP resources into a VM's VHD(X), if they are large these can take a minute or five. Adding progress reporting for these would be good!
Here are some thoughts;
Copy-Item
doesn't natively support Write-Progress
ExpandZipArchive
I need to be able to deploy Linux-based VMs, i.e. Citrix NetScaler VPX appliances. We not necessarily be able to customise these (unless we can access ext3 file systems), but at least registering existing .Vhdx files would be handy for lab deployment.
This will require disabling all internal customisation, e.g. Sysprep, copying DSC resources and bootstrapping. Unless someone knows a way of accessing a Linux VM's partitions...
I still want to rename the module to something more 'memorable'. This will also permit the module name in GitHub to reflect the actual module name (handy when downloading the .zip file!).
The ideas I have are as follows:
Does anyone have any preferences or other ideas? I would like to get this nailed-down before publishing beta-v0.9 to the PowerShell Gallery...
With the impending NAT configuration and to be able to support AWS and Azure (in the future) we will need to start attaching subnet information to the virtual switch definitions. This will be required to add NAT translation address and add routing information in AWS/Azure.
Something like this is what I think is needed:
@{
AllNodes = @()
NonNodeData = @{
VirtualEngineLab = @{
Network = @(
@{ Name = 'Private'; Type = 'Internal'; Subnet = '192.168.10.0/24'; }
@{ Name = 'Internet'; Type = 'NAT'; Subnet = '192.168.11.0/24'; }
)
}
}
}
Unfortunately, I think we will have to make this mandatory for all network/switch defnitions?
The HostDefaults.json uses entries like below :
"ConfigurationPath": "%SYSTEMDRIVE%\TestLab\Configurations",
I was under the impression that when I run Start-LabHostConfiguration for the first time it will automatically create the required folders under the system drive. But the %SYSTEMDRIVE% is not being expanded in the path by the function.
This creates the directory in my current path rather than the System Drive.
I can work on fixing it, if you confirm I am not doing it wrong.
When injecting resources and VM customisations on Win 8.1 x86 image fails with
VERBOSE: [20:52:05] Mounting disk image 'D:\TestLab\VM Disks\WIN81.vhdx'.
Cannot the drive letter for disk image 'd:\testlab\vm disks\win81.vhdx'. The parent disk image may be corrupted or
recreate the master image.
At C:\Users\Iain\OneDrive\PowerShell\Modules\VirtualEngineLab\Lib\DiskImage.ps1:18 char:13
+ throw ($localized.CannotLocateDiskImageLetter -f $DiskIma ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Cannot the driv...e master image.:String) [], RuntimeException
+ FullyQualifiedErrorId : Cannot the drive letter for disk image 'd:\testlab\vm disks\win81.vhdx'. The parent disk
image may be corrupted or recreate the master image.
The local administrator password is currently unencoded within the generated unattend.xml file.
I think we could do with an option that permits utilisation of existing virtual switches if they exist. This is similar to the 'Quick VM' functionality.
For example, in the following configuration it would connect VM01 to the 'Existing' virtual switch:
@{
AllNodes = @(
@{
NodeName = 'VM01';
SwitchName = 'Existing';
}
}
If there isn't a corresponding NonNodeData\Network
entry and the virtual switch didn't exist, we'd create an 'Internal' virtual switch with the 'Existing' name? This will enable utilising an existing NAT virtual switch until the xHyper-V DSC resource is updated accordingly 😉
Add the ability to be able to specify optional Windows features to be installed in the media configuration, for example .Net 3.5
On a system with default settings:
D:\Lability> Get-LabHostDefault
ConfigurationPath : %SYSTEMDRIVE%\Lability\Configurations
DifferencingVhdPath : %SYSTEMDRIVE%\Lability\VMVirtualHardDisks
HotfixPath : %SYSTEMDRIVE%\Lability\Hotfixes
IsoPath : %SYSTEMDRIVE%\Lability\ISOs
ParentVhdPath : %SYSTEMDRIVE%\Lability\MasterVirtualHardDisks
ResourcePath : %SYSTEMDRIVE%\Lability\Resources
ResourceShareName : Resources
UpdatePath :
DisableLocalFileCaching : False
ISO file is downloaded to a path under current directory named "%SYSTEMDRIVE%\Lability\ISOs". Similar issue to the one reported in #33
Before publishing to the gallery, we need to perform a code review. This should (at a minimum) cover:
There is little documentation, and where this is, it's incomplete. Need to complete the documentation before publishing to the Powershell Gallery.
When importing the module on a non 'en-US system', the default en-US\Resources.psd1 file is not located. This can be resolved by moving the .\en-US\Resources.psd1 file to the parent directory (the module's root)
This is more of a question: I see in the Lab Host Defaults there's an UpdatePath key with an empty path value. I don't really see anywhere else in the code (besides in getting / setting lab host defaults) where this is used.
Is the idea that you would put offline Windows Updates in this folder and Lability would apply them? Is the functionality implemented to do this or is still a feature to be added?
When testing on multiple machines or rebuilding a machine, the Lability configuration can be captured by copying the files out of the %ProgramData%\Lability\Config folder and restoring them. I think it would be handy to be able to export and import the CustomMedia.json
, HostDefaults.json
and VmDefaults.json
files as a single file.
I'm thinking Export-LabHostConfiguration
and Import-LabHostConfiguration
cmdlets would cover this off nicely!
Is this a bug, or is it intended behaviour?
I was under the impression that Start-LabHostConfiguration would create the directories if they do not exist, and thus I expected to be able to set defaults to directories that have not yet been created.
However when I try to, Set-LabHostDefault throw an error:
D:\TestLab\MasterVirtualHardDisks path 'D:\TestLab\MasterVirtualHardDisks' is invalid.
At C:\Program Files\WindowsPowerShell\Modules\VirtualEngineLab\Src\LabHostDefaults.ps1:60 char:6
+ ... throw ($localized.InvalidPathError -f $resolvedPath, $PSB ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (D:\TestLab\Mast...ks' is invalid.:String) [], RuntimeExcept
ion
+ FullyQualifiedErrorId : D:\TestLab\MasterVirtualHardDisks path 'D:\TestLab\MasterVirtualHardDisks' is
invalid.
The current Unattend.xml file only supports x64 media - x86 support needs to be added.
With Server 2016 TP3+, there is a new NAT virtual switch type. This would be an excellent addition to the module (I wish it was included in Windows 10 too 😠). However, in the first instance, it will need some additional metadata in the configuration document..
Sorry to keep bugging you with bugs, but here's another one I have run into on both Windows 10 (RTM) and Windows Server 2016 TP3.
When Start-LabConfiguration get's to the point where it tries to create a parent disk from a downloaded ISO, if fails with the error:
Cannot convert the "Microsoft.Vhd.PowerShell.VirtualHardDisk" value of type "Microsoft.Vhd.PowerShell.VirtualHardDisk" to type "Microsoft.Vhd.PowerShell.VirtualHardDisk"
When I first ran into this issue on my Windows 10 machine, but found that it worked OK on a Windows 8.1 box, I attributed it to some possible funkyness with my machine. But today I ran into the same thing on a Windows Server 2016 TP3 box.
Excerpt from the verbose output stream:
VERBOSE: [14:40:28] Creating disk image 'Windows Server 2012 R2 Standard 64bit English Evaluation'.
VERBOSE: [14:40:28] Creating disk image 'D:\Labs\Test\Parent Disks\2012R2_x64_Standard_EN_Eval.vhdx'.
VERBOSE: [14:40:29] Mounting disk image 'D:\Labs\Test\Parent Disks\2012R2_x64_Standard_EN_Eval.vhdx'.
VERBOSE: [14:40:29] Initializing disk image 'D:\Labs\Test\Parent Disks\2012R2_x64_Standard_EN_Eval.vhdx'.
NewDiskImageGpt : Cannot process argument transformation on parameter 'Vhd'. Cannot convert the "Microsoft.Vhd.PowerShell.Vi
rtualHardDisk" value of type "Microsoft.Vhd.PowerShell.VirtualHardDisk" to type "Microsoft.Vhd.PowerShell.VirtualHardDisk".
At D:\Labs\Automation\Modules\VirtualEngineLab\Lib\DiskImage.ps1:119 char:38
+ NewDiskImageGpt -Vhd $vhdMount;
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [NewDiskImageGpt], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,NewDiskImageGpt
ExpandWindowsImage : Cannot process argument transformation on parameter 'Vhd'. Cannot convert the "Microsoft.Vhd.PowerShell
.VirtualHardDisk" value of type "Microsoft.Vhd.PowerShell.VirtualHardDisk" to type "Microsoft.Vhd.PowerShell.VirtualHardDisk
".
At D:\Labs\Automation\Modules\VirtualEngineLab\Src\LabImage.ps1:90 char:95
+ ... oFileInfo.FullName -WimImageName $media.ImageName -Vhd $image -Partit ...
+ ~~~~~~
+ CategoryInfo : InvalidData: (:) [ExpandWindowsImage], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,ExpandWindowsImage
AddDiskImagePackage : Cannot process argument transformation on parameter 'Vhd'. Cannot convert the "Microsoft.Vhd.PowerShel
l.VirtualHardDisk" value of type "Microsoft.Vhd.PowerShell.VirtualHardDisk" to type "Microsoft.Vhd.PowerShell.VirtualHardDis
k".
At D:\Labs\Automation\Modules\VirtualEngineLab\Src\LabImage.ps1:92 char:42
+ AddDiskImagePackage -Id $Id -Vhd $image -PartitionStyle $part ...
+ ~~~~~~
+ CategoryInfo : InvalidData: (:) [AddDiskImagePackage], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,AddDiskImagePackage
SetDiskImageBootVolume : Cannot process argument transformation on parameter 'Vhd'. Cannot convert the "Microsoft.Vhd.PowerS
hell.VirtualHardDisk" value of type "Microsoft.Vhd.PowerShell.VirtualHardDisk" to type "Microsoft.Vhd.PowerShell.VirtualHard
Disk".
At D:\Labs\Automation\Modules\VirtualEngineLab\Src\LabImage.ps1:94 char:37
+ SetDiskImageBootVolume -Vhd $image -PartitionStyle $partition ...
+ ~~~~~~
+ CategoryInfo : InvalidData: (:) [SetDiskImageBootVolume], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,SetDiskImageBootVolume
The xHyperVM implementation supports specifying multiple MAC addresses (like SwitchName). The module functionality to match the DSC resource implementation
In the newer Module version '0.9.2' , the function Get-LabHostConfiguration is spewing out error.
IMO this is because of the change in the Get-WindowsFeatureTargetResource, which leads to GetDSCResource Function erroring out. Below is a snippet of the GetDSCResource function (line 72-75 from Lib\DSCResource.ps1) which are failing.
$getTargetResourceCommand = 'Get-{0}TargetResource' -f $ResourceName;
WriteVerbose ($localized.InvokingCommand -f $getTargetResourceCommand);
$Parameters.Remove('Ensure');
return (& $getTargetResourceCommand @Parameters);
Below is the what I see when I run the function :
PS>Get-LabHostConfiguration
Import-Module : The specified module 'C:\Users\Administrator\Documents\GitHub\Lab\DSCResources\PSDesiredStateConfiguration\DSCResources\MSFT_RoleResource\MSFT_RoleResource.psm1' was
not loaded because no valid module file was found in any module directory.
At C:\Users\Administrator\Documents\GitHub\Lab\Lib\DscResource.ps1:43 char:17
+ ... Import-Module -Name $resourcePath -Prefix $Prefix -Force ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\Admini...leResource.psm1:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
& : The term 'Get-WindowsFeatureTargetResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At C:\Users\Administrator\Documents\GitHub\Lab\Lib\DscResource.ps1:75 char:19
+ return (& $getTargetResourceCommand @Parameters);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-WindowsFeatureTargetResource:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Import-Module : The specified module 'C:\Users\Administrator\Documents\GitHub\Lab\DSCResources\PSDesiredStateConfiguration\DSCResources\MSFT_RoleResource\MSFT_RoleResource.psm1' was
not loaded because no valid module file was found in any module directory.
At C:\Users\Administrator\Documents\GitHub\Lab\Lib\DscResource.ps1:43 char:17
+ ... Import-Module -Name $resourcePath -Prefix $Prefix -Force ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (C:\Users\Admini...leResource.psm1:String) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
& : The term 'Get-WindowsFeatureTargetResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At C:\Users\Administrator\Documents\GitHub\Lab\Lib\DscResource.ps1:75 char:19
+ return (& $getTargetResourceCommand @Parameters);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-WindowsFeatureTargetResource:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
WARNING: Unable to query CCM_ClientUtilities: Invalid namespace
Name Value
---- -----
PendingFileRename False
Name TestingForHypervReboot
PendingComputerRename False
ComponentBasedServicing False
WindowsUpdate False
CcmClientSDK False
When performing a 'Start-LabHostConfiguration' on a brand new host, the Hyper-V role is installed, but not the 'Hyper-V-PowerShell' feature.
Related to discussions in issue #9, it would be great to be able the disabling of file-based media, i.e. ISO and WIM media. This would be good for reducing disk storage on always-connected hosts, e.g. not laptops! By default this should be left enabled for performance reasons.
Imagine the Scenario - you are working on multiple different labs and have to switch between them frequently
These labs are using different versions of the DSC Resources and you may have to rebuild them at any time.
Currently the DSCResources Modules are being saved directly in the Module folder root and not the version number subfolder as you would expect.
So you could remove the DSCResources from the C:\Program Files\WindowsPowerShell\Modules\ location and call Invoke-LabResource each time you need to rebuild however this is inefficient and the Invoke-LabResourceDownload should mirror the expectations from Save/Install-Module to place in correct versioned subfolder.
I believe the fix would be in the InvokeDscResourceDownloadFromPSGallery internal function where it is currently
$tempModuleFilename = '{0}.zip' -f $Name;
though I reckon should be
If ($MinimumVersion) {$moduleVersion = $MinimumVersion} else {$moduleVersion = $RequiredVersion}
$tempModuleFilename = '{0}.{1}.zip' -f $Name,$moduleVersion
though at the same time this would be a good line to change too
$modulePath = Join-Path $windowsPowerShellModules -ChildPath $Name;
to
$modulePath = Join-Path $windowsPowerShellModules -ChildPath "$Name\$moduleVersion";
Example of how this is acting is as below
It seems a waste having to create a ConfigurationData document if you want to quickly just create a VM!
I'm thinking that we could expose the NewLabVM function as New-LabVM
and have all the standard options supported in the ConfigurationData document available. This could then create it's own hashtable with a single 'node' in it? It would pull the default settings from Get-LabVMDefaults
.
Something like this:
New-LabVM -Name <String> -MediaId <String> [[-SwitchName] <String>] [-Credential <PSCredential>] [-NoSnapshot]
New-LabVM -Name <String> -MediaId <String> [[-SwitchName] <String>] -Password <SecureString> [-NoSnapshot]
We could also expose the Set-LabVMdefaults
settings, i.e. [[-StartupMemory] <Int64>]
etc.
When building a Configuration and placing the Media details into the Configuration Data section this seemingly is not able to find the Lab Media
Media = @(
@{
## The image ID that is used by nodes when refencing the image.
Id = 'Custom_2012R2';
## The target filename that the image is downloaded into the 'ParentVhdPath'. You can manually place
## a vhdx here to avoid the download process.
Filename = 'Custom_2012R2.vhdx';
## The architecture is not used for custom images as the disk partitioning is already complete,
## but it is a required media property.
Architecture = 'x64';
## The source URI to download the file from. This is only used if the vhdx image is not present
## in the 'ParentVhdPath' location. If you place the vhdx there, it's not (re)downloaded.
Uri = 'file://E:\lability\MasterVirtualHardDisks\Custom_2012R2.vhdx';
## If you want the module to check the file copy, you can specify a MD5 checksum. If you do specify a
## checksum you HAVE to ensure it's correct otherwise it will continuously attempt to download the image!
Checksum = '';
## Media description.
Description = 'Custom SYSPREP''d 2012 VHD Image';
## You must specify 'VHD' type to ensure that WIM images are not attempted to be extracted.
MediaType = 'VHD';
## The operating system type. If 'Linux' is specified, Lability will not attempt to configure the VM's
## filesytem, i.e. inject DSC resources or generate an 'unattend.xml' file.
OperatingSystem = 'Windows';
}
);
When you then run Start-LabConfiguration it will error out with 'Cannot locate 'Custom_2012R2'
However if you run Register-LabMedia to register the Media before running Start-LabConfiguration it seems to work as expected
There are no Pester tests. These need to be added before publishing to the Powershell Gallery
When a VM has a snapshot, and you run Remove-LabConfiguration, it may take a long time to complete, as the command triggers a snapshot removal, that will commit all the changes stored in the "redo" file, to be commited to the VM's disk before deleting the disk.
I have not tested this yeat, but it would seem that reverting to the oldest snapshot first, and then deleting the different snapshot/redo files, and subsequently deleting the VM, would speed things up.
Let me know if this is something you would like to persue, and I will be happy to try to create a fix for it.
The default virtual machine password stored by the Get-LabVMDefaults/Set-LabVMDefaults cmdlets should be implemented as a SecureString. Failure to do so will probably lead to a rejection from the PS Gallery..
The Start-LabHostConfiguration cmdlet creates the Resources folder and Resources share, but doesn't grant the 'Everyone' principal read rights.
Add the ability to add custom media that doesn't need to be specified in the NonNodeData.VirtualEngineLab.Media array
In version 0.9.8 Remove-LabVM throws an error
PS C:\> Remove-LabVM -Name WIN10-10586-3 -Verbose
Get-FormattedMessage : The term 'Get-FormattedMessage' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling o
f the name, or if a path was included, verify that the path is correct and try again.
At C:\Program Files\WindowsPowerShell\Modules\Lability\Src\LabVM.ps1:672 char:38
+ $verboseProcessMessage = Get-FormattedMessage -Message ($ ...
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-FormattedMessage:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Appear to be a simple typo. I will commit a fix and submit a PR in a moment.
I came to the conclusion that this does warrant it's own issue
Scenario:
Host OS is Windows 10.
Modules xComputerManagement, xNetworking etc. were installed with the Install-Module Cmdlet, causing the modules to have a folder structure including the modules version number.
As an example, the xComputerManagement module resides in the C:\Program Files\WindowsPowerShell\Modules\xComputerManagement\1.3.0 folder.
Now when I create a lab with Windows Server 2012R2 or Windows 8.1 VM’s, they get stuck in the bootstrap process, when trying to apply the DSC configuration. Reviewing the log shows that it cannot find the DSC resources.
Moving the modules out of the “version subfolder” fixes that. This makes sense since support for multiple versions of a module (and thus the “version subfolder”) is introduced with PowerShell 5.
It would be great if that could be taken into consideration, when resources are copied into VM disk.
When running Start-LabHostConfiguration on Windows Server 2016 Technical Preview 3, it does not install the needed Hyper-V PowerShell module, as that Windows Feature is no longer a Sub-feature of Hyper-V.
In 2016 TP3 it resides under:
[ ] Remote Server Administration Tools RSAT Available
...
[ ] Role Administration Tools RSAT-Role-Tools Available
...
[ ] Hyper-V Management Tools RSAT-Hyper-V-Tools Available
[ ] Hyper-V GUI Management Tools Hyper-V-Tools Available
[ ] Hyper-V Module for Windows PowerShell Hyper-V-PowerShell Available
...
Add the ability to configure the Hyper-V host for remote management in a Workgroup environment. This will permit the deployment of labs on top of Server Core installations without a GUI.
When you have a lab with a prefix like "TLG-" in the EnvironmentPrefix in the Labilty section in the NonNodeData part of the configuration data file this isnt checked in the Get-LabVM function
example configuration data
NonNodeData = @{
Lability = @{
EnvironmentPrefix = 'TLG-';
Get-LabVM returns the following errors although you can see that Get-VM returns them correctly
It should only be a small addition to the Get-LabVM function to check for this setting in the Configuration Document
When provisioning VMs the local administrator password is not easily discoverable as it could be set from the local VMDefaults or ConfigurationData information.
When provisioning a VM without a DSC conifguration, the BootStrap.ps1 file will never exit and force a manual reboot of the virtual machine. Implement a check for .mof/.meta.mof files before attempting to enforce a DSC configuration.
Issue initially raised by @SimonWhalin:
Set-LabVMDefaults -Password 'Some3P@ssw0rdString'
Set-LabVMDefaults : A parameter cannot be found that matches parameter name 'Password'.
At line:1 char:19
~~~~~~~~~
It was mentioned to me in passing that it would be handy to tag/prefix all resources in a configuration (.psd1) to easily to be able to distinguish individual lab environments, i.e. VMs, switches and disks. This is particularly true, if multiple lab environments contain VMs with the same name. How this is implemented is up for discussion!
It's also a shame that standalone Hyper-V doesn't support folders for VM resources 😢
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.