├── .gitattributes ├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md ├── STYLEGUIDELINES.md └── images │ ├── AppVeyor-Badge-Green.png │ ├── AppVeyor-Github.png │ ├── Git-Setup-Endings.png │ ├── Git-Setup-Path.png │ ├── GitHub-Create-PR.png │ ├── GitHub-Fork.png │ ├── GitHub-Select-Branch.png │ ├── GitHub-Transfer-Ownership.png │ ├── GitHub-find-xActiveDirectory.png │ ├── GitHub-xActiveDirectory-Url-2.png │ ├── GitHub-xActiveDirectory-Url.png │ ├── GitHub-xActiveDirectory.png │ ├── Github-PR-dev.png │ ├── Gitk.png │ └── SignUp.png ├── .gitignore ├── .markdownlint.json ├── .vscode ├── analyzersettings.psd1 ├── settings.json └── tasks.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Deploy.PSDeploy.ps1 ├── GitVersion.yml ├── LICENSE ├── PSScriptAnalyzerSettings.psd1 ├── README.md ├── RequiredModules.psd1 ├── Resolve-Dependency.ps1 ├── Resolve-Dependency.psd1 ├── azure-pipelines.yml ├── build.ps1 ├── build.yaml ├── docs ├── Get-Lab.md ├── Get-LabResourceISO.md ├── Get-LabResourceMSU.md ├── Get-LabResourceModule.md ├── Get-LabSwitch.md ├── Get-LabVM.md ├── Get-LabVMTemplate.md ├── Get-LabVMTemplateVHD.md ├── Initialize-LabResourceISO.md ├── Initialize-LabResourceMSU.md ├── Initialize-LabResourceModule.md ├── Initialize-LabSwitch.md ├── Initialize-LabVM.md ├── Initialize-LabVMTemplate.md ├── Initialize-LabVMTemplateVHD.md ├── Install-Lab.md ├── Install-LabVM.md ├── New-Lab.md ├── Remove-LabSwitch.md ├── Remove-LabVM.md ├── Remove-LabVMTemplate.md ├── Remove-LabVMTemplateVHD.md ├── Start-Lab.md ├── Stop-Lab.md ├── Uninstall-Lab.md ├── Update-Lab.md └── about_LabBuilderSchema.md ├── source ├── LabBuilder.psd1 ├── LabBuilder.psm1 ├── Private │ ├── Assert-LabValidConfigurationXMLSchema.ps1 │ ├── Assert-LabValidIpAddress.ps1 │ ├── ConvertTo-LabAbsolutePath.ps1 │ ├── Copy-LabOdjFile.ps1 │ ├── Enable-LabWSMan.ps1 │ ├── Get-LabBuilderModulePath.ps1 │ ├── Get-LabCertificatePsFileContent.ps1 │ ├── Get-LabDSCNetworkingConfig.ps1 │ ├── Get-LabIntegrationServiceName.ps1 │ ├── Get-LabManagementSwitchName.ps1 │ ├── Get-LabModulesInDSCConfig.ps1 │ ├── Get-LabNextIpAddress.ps1 │ ├── Get-LabNextMacAddress.ps1 │ ├── Get-LabUnattendFileContent.ps1 │ ├── Get-LabVMManagementIPAddress.ps1 │ ├── Initialize-LabBootVHD.ps1 │ ├── Initialize-LabDSC.ps1 │ ├── Initialize-LabManagementSwitch.ps1 │ ├── Initialize-LabVHD.ps1 │ ├── Initialize-LabVMPath.ps1 │ ├── Install-LabHyperV.ps1 │ ├── Install-LabPackageProvider.ps1 │ ├── Invoke-LabDownloadAndUnzipFile.ps1 │ ├── Invoke-LabDownloadResourceModule.ps1 │ ├── New-LabCredential.ps1 │ ├── New-LabException.ps1 │ ├── New-LabHostSelfSignedCertificate.ps1 │ ├── New-LabVMInitializationFile.ps1 │ ├── Recieve-LabSelfSignedCertificate.ps1 │ ├── Register-LabPackageSource.ps1 │ ├── Request-LabSelfSignedCertificate.ps1 │ ├── Set-LabDSC.ps1 │ ├── Set-LabModulesInDSCConfig.ps1 │ ├── Set-LabSwitchAdapter.ps1 │ ├── Start-LabDSC.ps1 │ ├── Update-LabDSC.ps1 │ ├── Update-LabVMDataDisk.ps1 │ ├── Update-LabVMDvdDrive.ps1 │ ├── Update-LabVMIntegrationService.ps1 │ ├── Wait-LabVMInitializationComplete.ps1 │ ├── Wait-LabVMOff.ps1 │ ├── Wait-LabVMStarted.ps1 │ └── Write-LabMessage.ps1 ├── Public │ ├── Connect-LabVm.ps1 │ ├── Disconnect-LabVm.ps1 │ ├── Get-Lab.ps1 │ ├── Get-LabResourceIso.ps1 │ ├── Get-LabResourceModule.ps1 │ ├── Get-LabResourceMsu.ps1 │ ├── Get-LabSwitch.ps1 │ ├── Get-LabVMTemplate.ps1 │ ├── Get-LabVm.ps1 │ ├── Get-LabVmTemplateVhd.ps1 │ ├── Initialize-LabResourceIso.ps1 │ ├── Initialize-LabResourceModule.ps1 │ ├── Initialize-LabResourceMsu.ps1 │ ├── Initialize-LabSwitch.ps1 │ ├── Initialize-LabVm.ps1 │ ├── Initialize-LabVmTemplate.ps1 │ ├── Initialize-LabVmTemplateVhd.ps1 │ ├── Install-Lab.ps1 │ ├── Install-LabVm.ps1 │ ├── New-Lab.ps1 │ ├── Remove-LabSwitch.ps1 │ ├── Remove-LabVMTemplate.ps1 │ ├── Remove-LabVm.ps1 │ ├── Remove-LabVmTemplateVhd.ps1 │ ├── Start-Lab.ps1 │ ├── Stop-Lab.ps1 │ ├── Uninstall-Lab.ps1 │ └── Update-Lab.ps1 ├── build.psd1 ├── dsclibrary │ ├── DC_FORESTCHILDDOMAIN.DSC.ps1 │ ├── DC_FORESTPRIMARY.DSC.ps1 │ ├── DC_SECONDARY.DSC.ps1 │ ├── MEMBER_AADC.DSC.ps1 │ ├── MEMBER_ADFS.DSC.ps1 │ ├── MEMBER_ADRMS.DSC.ps1 │ ├── MEMBER_BRANCHCACHE_HOST.DSC.ps1 │ ├── MEMBER_CONTAINER_HOST.DSC.ps1 │ ├── MEMBER_DEFAULT.DSC.ps1 │ ├── MEMBER_DFSHUB.DSC.ps1 │ ├── MEMBER_DFSSPOKE.DSC.ps1 │ ├── MEMBER_DHCP.DSC.ps1 │ ├── MEMBER_DHCPDNS.DSC.ps1 │ ├── MEMBER_DHCPNPAS.DSC.ps1 │ ├── MEMBER_DHCPNPAS2016.DSC.ps1 │ ├── MEMBER_DNS.DSC.ps1 │ ├── MEMBER_DSCPULLSERVER.DSC.ps1 │ ├── MEMBER_FAILOVERCLUSTER_DHCP.DSC.ps1 │ ├── MEMBER_FAILOVERCLUSTER_FS.DSC.ps1 │ ├── MEMBER_FAILOVERCLUSTER_HV.DSC.ps1 │ ├── MEMBER_FILESERVER.DSC.ps1 │ ├── MEMBER_FILESERVER_FSRMTEST.DSC.ps1 │ ├── MEMBER_FILESERVER_ISCSI.DSC.ps1 │ ├── MEMBER_IPAM.DSC.ps1 │ ├── MEMBER_JENKINS.DSC.ps1 │ ├── MEMBER_NANO.DSC.ps1 │ ├── MEMBER_NLB.DSC.ps1 │ ├── MEMBER_NPS.DSC.ps1 │ ├── MEMBER_NPS_DFSTEST.DSC.ps1 │ ├── MEMBER_REMOTEACCESS.DSC.ps1 │ ├── MEMBER_REMOTEACCESS_WAP.DSC.ps1 │ ├── MEMBER_ROOTCA.DSC.ps1 │ ├── MEMBER_SQLSERVER2014.DSC.ps1 │ ├── MEMBER_SQLSERVER2016.DSC.ps1 │ ├── MEMBER_SUBCA.DSC.ps1 │ ├── MEMBER_WAC.DSC.ps1 │ ├── MEMBER_WDS.DSC.ps1 │ ├── MEMBER_WEBSERVER.DSC.ps1 │ ├── MEMBER_WSUS.DSC.ps1 │ ├── RODC_SECONDARY.DSC.ps1 │ ├── STANDALONE_DEFAULT.DSC.ps1 │ ├── STANDALONE_DHCPDNS.DSC.ps1 │ ├── STANDALONE_INTERNET.DSC.ps1 │ ├── STANDALONE_JENKINS.DSC.ps1 │ ├── STANDALONE_ROOTCA.DSC.ps1 │ ├── STANDALONE_ROOTCA_NOSUBCA.DSC.ps1 │ └── modules │ │ ├── LabDSCResources.psd1 │ │ └── MyDSCResources │ │ ├── xCertAuthorityServer │ │ ├── xCertAuthorityServer.DSC.Schema.psd1 │ │ └── xCertAuthorityServer.DSC.Schema.psm1 │ │ ├── xDC │ │ ├── xDC.DSC.Schema.psd1 │ │ └── xDC.DSC.Schema.psm1 │ │ ├── xDHCPServer │ │ ├── xDHCPServer.DSC.Schema.psd1 │ │ └── xDHCPServer.DSC.Schema.psm1 │ │ ├── xFileServer │ │ ├── xFileServer.DSC.Schema.psd1 │ │ └── xFileServer.DSC.Schema.psm1 │ │ ├── xJoinDomain │ │ ├── xJoinDomain.DSC.Schema.psd1 │ │ └── xJoinDomain.DSC.Schema.psm1 │ │ ├── xNPSServer │ │ ├── xNPSServer.DSC.Schema.psd1 │ │ └── xNPSServer.DSC.Schema.psm1 │ │ └── xRemoteAccessServer │ │ ├── xRemoteAccessServer.DSC.Schema.psd1 │ │ └── xRemoteAccessServer.DSC.Schema.psm1 ├── en-US │ ├── LabBuilder.strings.psd1 │ └── about_LabBuilder.help.txt ├── prefix.ps1 ├── samples │ ├── Sample_WS2012R2_DCandDHCPOnly.xml │ ├── Sample_WS2012R2_DCandDHCPOnly_NAT.xml │ ├── Sample_WS2012R2_DCandDHCPandEdge.xml │ ├── Sample_WS2012R2_DomainClustering.xml │ ├── Sample_WS2012R2_DomainComplete.xml │ ├── Sample_WS2012R2_DomainSQL2014.xml │ ├── Sample_WS2012R2_MultiForest.xml │ ├── Sample_WS2012R2_MultiForest_ADFS.xml │ ├── Sample_WS2012R2_Simple.xml │ ├── Sample_WS2016_DCandDHCPOnly.xml │ ├── Sample_WS2016_DCandDHCPandCA.xml │ ├── Sample_WS2016_DCandDHCPandEdge.xml │ ├── Sample_WS2016_DFSHubAndSpoke.xml │ ├── Sample_WS2016_DomainClustering.xml │ ├── Sample_WS2016_DomainComplete.xml │ ├── Sample_WS2016_DomainFunctions.xml │ ├── Sample_WS2016_DomainSQL2016.xml │ ├── Sample_WS2016_NanoDomain.xml │ ├── Sample_WS2016_Simple.xml │ ├── Sample_WS2019_AzureADConnect.xml │ ├── Sample_WS2019_DCandDHCPandCA.xml │ ├── Sample_WS2019_DCandDHCPandEdge.xml │ ├── Sample_WS2019_Simple.xml │ └── isofiles │ │ └── Put Windows installation ISO files here.txt ├── schema │ └── labbuilderconfig-schema.xsd ├── suffix.ps1 ├── support │ ├── Convert-LabBuilderConfigSchemaToMD.ps1 │ ├── Convert-WindowsImage.ps1 │ ├── Convert-XSDToMD.ps1 │ ├── New-SelfSignedCertificateEx.ps1 │ ├── tools │ │ └── msxsl.exe │ └── transform │ │ └── labbuilderconfig-schema-transformtomd.xsl └── template │ └── labbuilderconfig-template.xml └── tests ├── Invoke-LabSample.ps1 ├── TestHelper └── testhelper.psm1 ├── Unit ├── Private │ ├── dsc.tests.ps1 │ ├── managementswitch.tests.ps1 │ ├── utils.tests.ps1 │ ├── vhd.tests.ps1 │ └── vm.tests.ps1 ├── Public │ ├── lab.tests.ps1 │ ├── resource.tests.ps1 │ ├── switch.tests.ps1 │ ├── templatevhd.tests.ps1 │ ├── vm.tests.ps1 │ └── vmtemplate.tests.ps1 └── labbuilder.tests.ps1 └── pestertestconfig ├── PesterTestConfig.OK.xml ├── dsclibrary └── PesterTest.DSC.ps1 ├── expectedcontent ├── ExpectedDSCConfig.txt ├── ExpectedDSCModules.json ├── ExpectedResourceISOs.json ├── ExpectedResourceMSUs.json ├── ExpectedResourceModules.json ├── ExpectedSwitches.json ├── ExpectedTemplateVHDs.json ├── ExpectedTemplates.FromVM.json ├── ExpectedTemplates.json ├── ExpectedUnattendFile.xml └── ExpectedVMs.json ├── isofiles ├── 10586.0.151029-1700.TH2_RELEASE_CLIENTENTERPRISEEVAL_OEMRET_X64FRE_EN-US.ISO ├── 14393.0.161119-1705.RS1_REFRESH_SERVER_EVAL_X64FRE_EN-US.ISO ├── 9600.17050.WINBLUE_REFRESH.140317-1640_X64FRE_SERVER_EVAL_EN-US-IR3_SSS_X64FREE_EN-US_DV9.iso ├── SQLFULL_ENU.iso └── SQLServer2014SP1-FullSlipstream-x64-ENU.iso └── vhdfiles ├── DataDisk.vhdx ├── Nano Server 2016 Datacenter.vhdx ├── Windows 10 Enterprise.vhdx ├── Windows Server 2012 R2 Datacenter Core.vhdx ├── Windows Server 2012 R2 Datacenter Full.vhdx ├── Windows Server 2016 Datacenter Core.vhdx └── Windows Server 2016 Datacenter Full.vhdx /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text eol=crlf 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | *.jpg binary 44 | *.png binary 45 | *.gif binary 46 | *.exe binary 47 | 48 | ############################################################################### 49 | # diff behavior for common document formats 50 | # 51 | # Convert binary document formats to text before diffing them. This feature 52 | # is only available from the command line. Turn it on by uncommenting the 53 | # entries below. 54 | ############################################################################### 55 | #*.doc diff=astextplain 56 | #*.DOC diff=astextplain 57 | #*.docx diff=astextplain 58 | #*.DOCX diff=astextplain 59 | #*.dot diff=astextplain 60 | #*.DOT diff=astextplain 61 | #*.pdf diff=astextplain 62 | #*.PDF diff=astextplain 63 | #*.rtf diff=astextplain 64 | #*.RTF diff=astextplain 65 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Before submitting your issue for the LabBuilder project, please take a moment to provide the following details: 2 | 3 | - [ ] Verison of PowerShell you're using 4 | - [ ] PowerShell host you're using (eg. Console Host, ISE, Visual Studio) 5 | - [ ] Operating system you're running 6 | - [ ] Version of LabBuilder you're using (use `Get-Module -Name LabBuilder`) 7 | 8 | If you have a general question or suggestion, feel free to post on the [LabBuilder Gitter Chat at https://gitter.im/PlagueHO/LabBuilder](https://gitter.im/PlagueHO/LabBuilder). This is also a great place to just say Hi, ask any questions you might have or get help. 9 | 10 | Thanks for contributing your feedback and support! You can optionally submit a Pull Request against this project, if you have a fix you'd like to share. -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thanks for submitting a Pull Request to the LabBuilder project! 2 | 3 | Please make sure you have read the [Contributing.md](\.github\CONTRIBUTING.md) document. 4 | 5 | # Bug Fixes 6 | 7 | Use the pound / hash sign to indicate which GitHub issues this Pull Request fixes, if applicable. 8 | 9 | - Fixes #1 10 | - Fixes #2 11 | - Fixes #3 12 | 13 | # Improvements / Enhancements 14 | 15 | List out any code changes or enhancements you've made. This includes refactoring and removal of extraneous code. :) 16 | 17 | - Enhancement 1 18 | - Enhancement 2 19 | - Enhancement 3 20 | 21 | To improve visibility of this Pull Request, make sure to mention one of the project administrators, using `@githubusername` syntax. -------------------------------------------------------------------------------- /.github/images/AppVeyor-Badge-Green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/AppVeyor-Badge-Green.png -------------------------------------------------------------------------------- /.github/images/AppVeyor-Github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/AppVeyor-Github.png -------------------------------------------------------------------------------- /.github/images/Git-Setup-Endings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/Git-Setup-Endings.png -------------------------------------------------------------------------------- /.github/images/Git-Setup-Path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/Git-Setup-Path.png -------------------------------------------------------------------------------- /.github/images/GitHub-Create-PR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-Create-PR.png -------------------------------------------------------------------------------- /.github/images/GitHub-Fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-Fork.png -------------------------------------------------------------------------------- /.github/images/GitHub-Select-Branch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-Select-Branch.png -------------------------------------------------------------------------------- /.github/images/GitHub-Transfer-Ownership.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-Transfer-Ownership.png -------------------------------------------------------------------------------- /.github/images/GitHub-find-xActiveDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-find-xActiveDirectory.png -------------------------------------------------------------------------------- /.github/images/GitHub-xActiveDirectory-Url-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-xActiveDirectory-Url-2.png -------------------------------------------------------------------------------- /.github/images/GitHub-xActiveDirectory-Url.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-xActiveDirectory-Url.png -------------------------------------------------------------------------------- /.github/images/GitHub-xActiveDirectory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/GitHub-xActiveDirectory.png -------------------------------------------------------------------------------- /.github/images/Github-PR-dev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/Github-PR-dev.png -------------------------------------------------------------------------------- /.github/images/Gitk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/Gitk.png -------------------------------------------------------------------------------- /.github/images/SignUp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PlagueHO/LabBuilder/355354ea80da145f574f7f240102676ea9e62144/.github/images/SignUp.png -------------------------------------------------------------------------------- /.markdownlint.json: -------------------------------------------------------------------------------- 1 | { 2 | "default": true, 3 | "MD029": { 4 | "style": "one" 5 | }, 6 | "MD013": true, 7 | "MD024": true, 8 | "MD034": true, 9 | "no-hard-tabs": true 10 | } 11 | -------------------------------------------------------------------------------- /.vscode/analyzersettings.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | CustomRulePath = '.\output\RequiredModules\DscResource.AnalyzerRules' 3 | includeDefaultRules = $true 4 | IncludeRules = @( 5 | # DSC Resource Kit style guideline rules. 6 | 'PSAvoidDefaultValueForMandatoryParameter', 7 | 'PSAvoidDefaultValueSwitchParameter', 8 | 'PSAvoidInvokingEmptyMembers', 9 | 'PSAvoidNullOrEmptyHelpMessageAttribute', 10 | 'PSAvoidUsingCmdletAliases', 11 | 'PSAvoidUsingComputerNameHardcoded', 12 | 'PSAvoidUsingDeprecatedManifestFields', 13 | 'PSAvoidUsingEmptyCatchBlock', 14 | 'PSAvoidUsingInvokeExpression', 15 | 'PSAvoidUsingPositionalParameters', 16 | 'PSAvoidShouldContinueWithoutForce', 17 | 'PSAvoidUsingWMICmdlet', 18 | 'PSAvoidUsingWriteHost', 19 | 'PSDSCReturnCorrectTypesForDSCFunctions', 20 | 'PSDSCStandardDSCFunctionsInResource', 21 | 'PSDSCUseIdenticalMandatoryParametersForDSC', 22 | 'PSDSCUseIdenticalParametersForDSC', 23 | 'PSMisleadingBacktick', 24 | 'PSMissingModuleManifestField', 25 | 'PSPossibleIncorrectComparisonWithNull', 26 | 'PSProvideCommentHelp', 27 | 'PSReservedCmdletChar', 28 | 'PSReservedParams', 29 | 'PSUseApprovedVerbs', 30 | 'PSUseCmdletCorrectly', 31 | 'PSUseOutputTypeCorrectly', 32 | 'PSAvoidGlobalVars', 33 | 'PSAvoidUsingConvertToSecureStringWithPlainText', 34 | 'PSAvoidUsingPlainTextForPassword', 35 | 'PSAvoidUsingUsernameAndPasswordParams', 36 | 'PSDSCUseVerboseMessageInDSCResource', 37 | 'PSShouldProcess', 38 | 'PSUseDeclaredVarsMoreThanAssignments', 39 | 'PSUsePSCredentialType', 40 | 41 | 'Measure-*' 42 | ) 43 | 44 | } 45 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "powershell.codeFormatting.openBraceOnSameLine": false, 3 | "powershell.codeFormatting.newLineAfterOpenBrace": true, 4 | "powershell.codeFormatting.newLineAfterCloseBrace": true, 5 | "powershell.codeFormatting.whitespaceBeforeOpenBrace": true, 6 | "powershell.codeFormatting.whitespaceBeforeOpenParen": true, 7 | "powershell.codeFormatting.whitespaceAroundOperator": true, 8 | "powershell.codeFormatting.whitespaceAfterSeparator": true, 9 | "powershell.codeFormatting.ignoreOneLineBlock": false, 10 | "powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationAfterEveryPipeline", 11 | "powershell.codeFormatting.preset": "Custom", 12 | "powershell.codeFormatting.alignPropertyValuePairs": true, 13 | "powershell.developer.bundledModulesPath": "${cwd}/output/RequiredModules", 14 | "files.trimTrailingWhitespace": true, 15 | "files.insertFinalNewline": true, 16 | "powershell.scriptAnalysis.settingsPath": ".vscode\\analyzersettings.psd1", 17 | "powershell.scriptAnalysis.enable": true, 18 | "files.associations": { 19 | "*.ps1xml": "xml" 20 | }, 21 | "cSpell.words": [ 22 | "COMPANYNAME", 23 | "ICONURI", 24 | "LICENSEURI", 25 | "PROJECTURI", 26 | "RELEASENOTES", 27 | "buildhelpers", 28 | "endregion", 29 | "gitversion", 30 | "icontains", 31 | "keepachangelog", 32 | "notin", 33 | "pscmdlet", 34 | "steppable" 35 | ], 36 | "[markdown]": { 37 | "files.trimTrailingWhitespace": false, 38 | "files.encoding": "utf8" 39 | }, 40 | "markdownlint.config": { 41 | "MD028": false, 42 | "MD025": { 43 | "front_matter_title": "" 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Deploy.PSDeploy.ps1: -------------------------------------------------------------------------------- 1 | if ( 2 | $Env:ProjectName -and $Env:ProjectName.Count -eq 1 -and 3 | $Env:BuildSystem -ne 'unknown' 4 | ) { 5 | if ($Env:BranchName -eq 'main') { 6 | Deploy Module { 7 | by PSGalleryModule { 8 | FromSource $(Get-Item ".\BuildOutput\$Env:ProjectName") 9 | To $Env:ModuleRepositoryToDeployTo 10 | WithOptions @{ 11 | ApiKey = $Env:NugetApiKey 12 | } 13 | } 14 | } 15 | } 16 | } 17 | else { 18 | Write-Warning "Condition to Deploy not met" 19 | } 20 | -------------------------------------------------------------------------------- /GitVersion.yml: -------------------------------------------------------------------------------- 1 | mode: ContinuousDelivery 2 | next-version: 1.0.5 3 | major-version-bump-message: '\s?(breaking|major|breaking\schange)' 4 | minor-version-bump-message: '\s?(add|feature|minor)' 5 | patch-version-bump-message: '\s?(fix|patch)' 6 | no-bump-message: '\+semver:\s?(none|skip)' 7 | assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}' 8 | branches: 9 | master: 10 | tag: preview 11 | regex: ^master$|^main$ 12 | pull-request: 13 | tag: PR 14 | feature: 15 | tag: useBranchName 16 | increment: Minor 17 | regex: f(eature(s)?)?[\/-] 18 | source-branches: ['master'] 19 | hotfix: 20 | tag: fix 21 | increment: Patch 22 | regex: (hot)?fix(es)?[\/-] 23 | source-branches: ['master'] 24 | merge-message-formats: {} 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Daniel Scott-Raynsford 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PSScriptAnalyzerSettings.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | Severity = @('Error', 'Warning', 'Information') 3 | } 4 | -------------------------------------------------------------------------------- /RequiredModules.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | PSDependOptions = @{ 3 | AddToPath = $true 4 | Target = 'output\RequiredModules' 5 | Parameters = @{ 6 | } 7 | } 8 | 9 | InvokeBuild = 'latest' 10 | PSScriptAnalyzer = 'latest' 11 | Pester = '4.10.1' 12 | Plaster = 'latest' 13 | Platyps = 'latest' 14 | ModuleBuilder = 'latest' 15 | ChangelogManagement = 'latest' 16 | Sampler = 'latest' 17 | MarkdownLinkCheck = 'latest' 18 | } 19 | -------------------------------------------------------------------------------- /Resolve-Dependency.psd1: -------------------------------------------------------------------------------- 1 | @{ # Defaults Parameter value to be loaded by the Resolve-Dependency command (unless set in Bound Parameters) 2 | #PSDependTarget = './output/modules' 3 | #Proxy = '' 4 | #ProxyCredential = '$MyCredentialVariable' #TODO: find a way to support credentials in build (resolve variable) 5 | Gallery = 'PSGallery' 6 | #AllowOldPowerShellGetModule = $true 7 | #MinimumPSDependVersion = '0.3.0' 8 | AllowPrerelease = $false 9 | WithYAML = $true # Will also bootstrap PowerShell-Yaml to read other config files 10 | } 11 | -------------------------------------------------------------------------------- /docs/Get-Lab.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-Lab 9 | 10 | ## SYNOPSIS 11 | 12 | Loads a Lab Builder Configuration file and returns a Lab object 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-Lab [-ConfigPath] [[-LabPath] ] [-SkipXMLValidation] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes the path to a valid LabBuilder Configiration XML file and loads it. 23 | 24 | It will perform simple validation on the XML file and throw an exception 25 | if any of the validation tests fail. 26 | 27 | At load time it will also add temporary configuration attributes to the in 28 | memory configuration that are used by other LabBuilder functions. 29 | So loading 30 | XML Configurartion without using this function is not advised. 31 | 32 | ## EXAMPLES 33 | 34 | ### EXAMPLE 1 35 | 36 | ```powershell 37 | $MyLab = Get-Lab -ConfigPath c:\MyLab\LabConfig1.xml 38 | ``` 39 | 40 | Loads the LabConfig1.xml configuration and returns Lab object. 41 | 42 | ## PARAMETERS 43 | 44 | ### -ConfigPath 45 | 46 | This is the path to the Lab Builder configuration file to load. 47 | 48 | ```yaml 49 | Type: String 50 | Parameter Sets: (All) 51 | Aliases: 52 | 53 | Required: True 54 | Position: 2 55 | Default value: None 56 | Accept pipeline input: False 57 | Accept wildcard characters: False 58 | ``` 59 | 60 | ### -LabPath 61 | 62 | This is an optional path that is used to Override the LabPath in the config 63 | file passed. 64 | 65 | ```yaml 66 | Type: String 67 | Parameter Sets: (All) 68 | Aliases: 69 | 70 | Required: False 71 | Position: 3 72 | Default value: None 73 | Accept pipeline input: False 74 | Accept wildcard characters: False 75 | ``` 76 | 77 | ### -SkipXMLValidation 78 | 79 | {{Fill SkipXMLValidation Description}} 80 | 81 | ```yaml 82 | Type: SwitchParameter 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: False 87 | Position: 4 88 | Default value: False 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 96 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ## OUTPUTS 101 | 102 | ### The Lab object representing the Lab Configuration that was loaded. 103 | 104 | ## NOTES 105 | 106 | ## RELATED LINKS 107 | -------------------------------------------------------------------------------- /docs/Get-LabResourceISO.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabResourceISO 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an array of ISO Resources from a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabResourceISO [-Lab] [[-Name] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes a provided Lab and returns the list of ISO resources required for this Lab. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | 28 | ```powershell 29 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 30 | ``` 31 | 32 | $ResourceISO = Get-LabResourceISO $Lab 33 | Loads a Lab and pulls the array of ISO Resources from it. 34 | 35 | ## PARAMETERS 36 | 37 | ### -Lab 38 | 39 | Contains the Lab object that was loaded by the Get-Lab object. 40 | 41 | ```yaml 42 | Type: Object 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 2 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -Name 54 | 55 | An optional array of ISO names. 56 | 57 | Only ISO Resources matching names in this list will be pulled into the returned in the array. 58 | 59 | ```yaml 60 | Type: String[] 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: 3 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### CommonParameters 72 | 73 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 74 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 75 | 76 | ## INPUTS 77 | 78 | ## OUTPUTS 79 | 80 | ### Returns an array of LabISOResource objects 81 | 82 | ## NOTES 83 | 84 | ## RELATED LINKS 85 | -------------------------------------------------------------------------------- /docs/Get-LabResourceMSU.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabResourceMSU 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an array of MSU Resources from a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabResourceMSU [-Lab] [[-Name] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes a provided Lab and returns the list of MSU resources required for this Lab. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | 28 | ```powershell 29 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 30 | ``` 31 | 32 | $ResourceMSU = Get-LabResourceMSU $Lab 33 | Loads a Lab and pulls the array of MSU Resources from it. 34 | 35 | ## PARAMETERS 36 | 37 | ### -Lab 38 | 39 | Contains the Lab object that was loaded by the Get-Lab object. 40 | 41 | ```yaml 42 | Type: Object 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 2 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -Name 54 | 55 | An optional array of MSU names. 56 | 57 | Only MSU Resources matching names in this list will be pulled into the returned in the array. 58 | 59 | ```yaml 60 | Type: String[] 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: 3 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### CommonParameters 72 | 73 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 74 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 75 | 76 | ## INPUTS 77 | 78 | ## OUTPUTS 79 | 80 | ### Returns an array of LabMSUResource objects 81 | 82 | ## NOTES 83 | 84 | ## RELATED LINKS 85 | -------------------------------------------------------------------------------- /docs/Get-LabResourceModule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabResourceModule 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an array of Module Resources from a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabResourceModule [-Lab] [[-Name] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes a provided Lab and returns the list of module resources required for this Lab. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | 28 | ```powershell 29 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 30 | ``` 31 | 32 | $ResourceModules = Get-LabResourceModule -Lab $Lab 33 | Loads a Lab and pulls the array of Module Resources from it. 34 | 35 | ## PARAMETERS 36 | 37 | ### -Lab 38 | 39 | Contains the Lab object that was loaded by the Get-Lab object. 40 | 41 | ```yaml 42 | Type: Object 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 2 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -Name 54 | 55 | An optional array of Module names. 56 | 57 | Only Module Resources matching names in this list will be pulled into the returned in the array. 58 | 59 | ```yaml 60 | Type: String[] 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: False 65 | Position: 3 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### CommonParameters 72 | 73 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 74 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 75 | 76 | ## INPUTS 77 | 78 | ## OUTPUTS 79 | 80 | ### Returns an array of LabModuleResource objects 81 | 82 | ## NOTES 83 | 84 | ## RELATED LINKS 85 | -------------------------------------------------------------------------------- /docs/Get-LabSwitch.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabSwitch 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an array of switches from a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabSwitch [-Lab] [[-Name] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes a provided Lab and returns the array of LabSwitch objects required for this Lab. 23 | This list is usually passed to Initialize-LabSwitch to configure the switches required for this lab. 24 | 25 | ## EXAMPLES 26 | 27 | ### EXAMPLE 1 28 | 29 | ```powershell 30 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 31 | ``` 32 | 33 | $Switches = Get-LabSwitch -Lab $Lab 34 | Loads a Lab and pulls the array of switches from it. 35 | 36 | ## PARAMETERS 37 | 38 | ### -Lab 39 | 40 | Contains the Lab object that was loaded by the Get-Lab object. 41 | 42 | ```yaml 43 | Type: Object 44 | Parameter Sets: (All) 45 | Aliases: 46 | 47 | Required: True 48 | Position: 2 49 | Default value: None 50 | Accept pipeline input: False 51 | Accept wildcard characters: False 52 | ``` 53 | 54 | ### -Name 55 | 56 | An optional array of Switch names. 57 | 58 | Only Switches matching names in this list will be pulled into the returned in the array. 59 | 60 | ```yaml 61 | Type: String[] 62 | Parameter Sets: (All) 63 | Aliases: 64 | 65 | Required: False 66 | Position: 3 67 | Default value: None 68 | Accept pipeline input: False 69 | Accept wildcard characters: False 70 | ``` 71 | 72 | ### CommonParameters 73 | 74 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 75 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 76 | 77 | ## INPUTS 78 | 79 | ## OUTPUTS 80 | 81 | ### Returns an array of LabSwitch objects 82 | 83 | ## NOTES 84 | 85 | ## RELATED LINKS 86 | -------------------------------------------------------------------------------- /docs/Get-LabVM.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabVM 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an Array of LabVM objects from a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabVM [-Lab] [[-Name] ] [[-VMTemplates] ] [[-Switches] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | Takes the provided Lab and returns the list of VM objects that will be created in this lab. 24 | This list is usually passed to Initialize-LabVM. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | 30 | ```powershell 31 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 32 | ``` 33 | 34 | $VMTemplates = Get-LabVMTemplate -Lab $Lab 35 | $Switches = Get-LabSwitch -Lab $Lab 36 | $VMs = Get-LabVM \` 37 | -Lab $Lab \` 38 | -VMTemplates $VMTemplates \` 39 | -Switches $Switches 40 | Loads a Lab and pulls the array of VMs from it. 41 | 42 | ### EXAMPLE 2 43 | 44 | ```powershell 45 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 46 | ``` 47 | 48 | $VMs = Get-LabVM -Lab $Lab 49 | Loads a Lab and pulls the array of VMs from it. 50 | 51 | ## PARAMETERS 52 | 53 | ### -Lab 54 | 55 | Contains the Lab Builder Lab object that was loaded by the Get-Lab object. 56 | 57 | ```yaml 58 | Type: Object 59 | Parameter Sets: (All) 60 | Aliases: 61 | 62 | Required: True 63 | Position: 2 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -Name 70 | 71 | An optional array of VM names. 72 | 73 | Only VMs matching names in this list will be returned in the array. 74 | 75 | ```yaml 76 | Type: String[] 77 | Parameter Sets: (All) 78 | Aliases: 79 | 80 | Required: False 81 | Position: 3 82 | Default value: None 83 | Accept pipeline input: False 84 | Accept wildcard characters: False 85 | ``` 86 | 87 | ### -VMTemplates 88 | 89 | Contains the array of LabVMTemplate objects returned by Get-LabVMTemplate from this Lab. 90 | 91 | If not provided it will attempt to pull the list from the Lab. 92 | 93 | ```yaml 94 | Type: LabVMTemplate[] 95 | Parameter Sets: (All) 96 | Aliases: 97 | 98 | Required: False 99 | Position: 4 100 | Default value: None 101 | Accept pipeline input: False 102 | Accept wildcard characters: False 103 | ``` 104 | 105 | ### -Switches 106 | 107 | Contains the array of LabVMSwitch objects returned by Get-LabSwitch from this Lab. 108 | 109 | If not provided it will attempt to pull the list from the Lab. 110 | 111 | ```yaml 112 | Type: LabSwitch[] 113 | Parameter Sets: (All) 114 | Aliases: 115 | 116 | Required: False 117 | Position: 5 118 | Default value: None 119 | Accept pipeline input: False 120 | Accept wildcard characters: False 121 | ``` 122 | 123 | ### CommonParameters 124 | 125 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 126 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 127 | 128 | ## INPUTS 129 | 130 | ## OUTPUTS 131 | 132 | ### Returns an array of LabVM objects 133 | 134 | ## NOTES 135 | 136 | ## RELATED LINKS 137 | -------------------------------------------------------------------------------- /docs/Get-LabVMTemplate.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabVMTemplate 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an Array of VM Templates for a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabVMTemplate [-Lab] [[-Name] ] [[-VMTemplateVHDs] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | Takes the provided Lab and returns the list of Virtul Machine template machines 24 | that will be used to create the Virtual Machines in this lab. 25 | 26 | This list is usually passed to Initialize-LabVMTemplate. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | 32 | ```powershell 33 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 34 | ``` 35 | 36 | $VMTemplates = Get-LabVMTemplate -Lab $Lab 37 | Loads a Lab and pulls the array of VMTemplates from it. 38 | 39 | ## PARAMETERS 40 | 41 | ### -Lab 42 | 43 | Contains the Lab object that was loaded by the Get-Lab object. 44 | 45 | ```yaml 46 | Type: Object 47 | Parameter Sets: (All) 48 | Aliases: 49 | 50 | Required: True 51 | Position: 2 52 | Default value: None 53 | Accept pipeline input: False 54 | Accept wildcard characters: False 55 | ``` 56 | 57 | ### -Name 58 | 59 | An optional array of VM Template names. 60 | 61 | Only VM Templates matching names in this list will be returned in the array. 62 | 63 | ```yaml 64 | Type: String[] 65 | Parameter Sets: (All) 66 | Aliases: 67 | 68 | Required: False 69 | Position: 3 70 | Default value: None 71 | Accept pipeline input: False 72 | Accept wildcard characters: False 73 | ``` 74 | 75 | ### -VMTemplateVHDs 76 | 77 | The array of VMTemplateVHDs pulled from the Lab using Get-LabVMTemplateVHD. 78 | 79 | If not provided it will attempt to pull the list from the Lab. 80 | 81 | ```yaml 82 | Type: LabVMTemplateVHD[] 83 | Parameter Sets: (All) 84 | Aliases: 85 | 86 | Required: False 87 | Position: 4 88 | Default value: None 89 | Accept pipeline input: False 90 | Accept wildcard characters: False 91 | ``` 92 | 93 | ### CommonParameters 94 | 95 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 96 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 97 | 98 | ## INPUTS 99 | 100 | ## OUTPUTS 101 | 102 | ### Returns an array of LabVMTemplate objects 103 | 104 | ## NOTES 105 | 106 | ## RELATED LINKS 107 | -------------------------------------------------------------------------------- /docs/Get-LabVMTemplateVHD.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Get-LabVMTemplateVHD 9 | 10 | ## SYNOPSIS 11 | 12 | Gets an Array of TemplateVHDs for a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Get-LabVMTemplateVHD [-Lab] [[-Name] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes a provided Lab and returns the list of Template Disks that will be used to 23 | create the Virtual Machines in this lab. 24 | This list is usually passed to 25 | Initialize-LabVMTemplateVHD. 26 | 27 | It will validate the paths to the ISO folder as well as to the ISO files themselves. 28 | 29 | If any ISO files references can't be found an exception will be thrown. 30 | 31 | ## EXAMPLES 32 | 33 | ### EXAMPLE 1 34 | 35 | ```powershell 36 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 37 | ``` 38 | 39 | $VMTemplateVHDs = Get-LabVMTemplateVHD -Lab $Lab 40 | Loads a Lab and pulls the array of TemplateVHDs from it. 41 | 42 | ## PARAMETERS 43 | 44 | ### -Lab 45 | 46 | Contains the Lab object that was loaded by the Get-Lab object. 47 | 48 | ```yaml 49 | Type: Object 50 | Parameter Sets: (All) 51 | Aliases: 52 | 53 | Required: True 54 | Position: 2 55 | Default value: None 56 | Accept pipeline input: False 57 | Accept wildcard characters: False 58 | ``` 59 | 60 | ### -Name 61 | 62 | An optional array of VM Template VHD names. 63 | 64 | Only VM Template VHDs matching names in this list will be returned in the array. 65 | 66 | ```yaml 67 | Type: String[] 68 | Parameter Sets: (All) 69 | Aliases: 70 | 71 | Required: False 72 | Position: 3 73 | Default value: None 74 | Accept pipeline input: False 75 | Accept wildcard characters: False 76 | ``` 77 | 78 | ### CommonParameters 79 | 80 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 81 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 82 | 83 | ## INPUTS 84 | 85 | ## OUTPUTS 86 | 87 | ### Returns an array of LabVMTemplateVHD objects 88 | 89 | It will return Null if the TemplateVHDs node does not exist or contains no TemplateVHD nodes 90 | 91 | ## NOTES 92 | 93 | ## RELATED LINKS 94 | -------------------------------------------------------------------------------- /docs/Initialize-LabResourceISO.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabResourceISO 9 | 10 | ## SYNOPSIS 11 | 12 | Downloads the Resource ISO packages from a provided array. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabResourceISO [-Lab] [[-Name] ] [[-ResourceISOs] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | Takes an array of LabResourceISO objects and ensures the MSU packages are available in the 24 | Lab Resources folder. 25 | If they are not they will be downloaded. 26 | 27 | ## EXAMPLES 28 | 29 | ### EXAMPLE 1 30 | 31 | ```powershell 32 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 33 | ``` 34 | 35 | $ResourceISOs = Get-LabResourceISO -Lab $Lab 36 | Initialize-LabResourceISO -Lab $Lab -ResourceISOs $ResourceISOs 37 | Initializes the Resource ISOs in the configured in the Lab c:\mylab\config.xml 38 | 39 | ### EXAMPLE 2 40 | 41 | ```powershell 42 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 43 | ``` 44 | 45 | Initialize-LabResourceISO -Lab $Lab 46 | Initializes the Resource ISOs in the configured in the Lab c:\mylab\config.xml 47 | 48 | ## PARAMETERS 49 | 50 | ### -Lab 51 | 52 | Contains Lab object that was loaded by the Get-Lab object. 53 | 54 | ```yaml 55 | Type: Object 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 2 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -Name 67 | 68 | An optional array of ISO packages names. 69 | 70 | Only ISO packages matching names in this list will be pulled into the returned in the array. 71 | 72 | ```yaml 73 | Type: String[] 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 3 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -ResourceISOs 85 | 86 | The array of ResourceISO objects pulled from the Lab using Get-LabResourceISO. 87 | 88 | If not provided it will attempt to pull the list from the Lab. 89 | 90 | ```yaml 91 | Type: LabResourceISO[] 92 | Parameter Sets: (All) 93 | Aliases: 94 | 95 | Required: False 96 | Position: 4 97 | Default value: None 98 | Accept pipeline input: False 99 | Accept wildcard characters: False 100 | ``` 101 | 102 | ### CommonParameters 103 | 104 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 105 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 106 | 107 | ## INPUTS 108 | 109 | ## OUTPUTS 110 | 111 | ### None 112 | 113 | ## NOTES 114 | 115 | ## RELATED LINKS 116 | -------------------------------------------------------------------------------- /docs/Initialize-LabResourceMSU.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabResourceMSU 9 | 10 | ## SYNOPSIS 11 | 12 | Downloads the Resource MSU packages from a provided array. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabResourceMSU [-Lab] [[-Name] ] [[-ResourceMSUs] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | Takes an array of LabResourceMSU objects and ensures the MSU packages are available in the 24 | Lab Resources folder. 25 | If they are not they will be downloaded. 26 | 27 | ## EXAMPLES 28 | 29 | ### EXAMPLE 1 30 | 31 | ```powershell 32 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 33 | ``` 34 | 35 | $ResourceMSUs = Get-LabResourceMSU -Lab $Lab 36 | Initialize-LabResourceMSU -Lab $Lab -ResourceMSUs $ResourceMSUs 37 | Initializes the Resource MSUs in the configured in the Lab c:\mylab\config.xml 38 | 39 | ### EXAMPLE 2 40 | 41 | ```powershell 42 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 43 | ``` 44 | 45 | Initialize-LabResourceMSU -Lab $Lab 46 | Initializes the Resource MSUs in the configured in the Lab c:\mylab\config.xml 47 | 48 | ## PARAMETERS 49 | 50 | ### -Lab 51 | 52 | Contains Lab object that was loaded by the Get-Lab object. 53 | 54 | ```yaml 55 | Type: Object 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 2 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -Name 67 | 68 | An optional array of MSU packages names. 69 | 70 | Only MSU packages matching names in this list will be pulled into the returned in the array. 71 | 72 | ```yaml 73 | Type: String[] 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 3 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -ResourceMSUs 85 | 86 | The array of ResourceMSU objects pulled from the Lab using Get-LabResourceModule. 87 | 88 | If not provided it will attempt to pull the list from the Lab. 89 | 90 | ```yaml 91 | Type: LabResourceMSU[] 92 | Parameter Sets: (All) 93 | Aliases: 94 | 95 | Required: False 96 | Position: 4 97 | Default value: None 98 | Accept pipeline input: False 99 | Accept wildcard characters: False 100 | ``` 101 | 102 | ### CommonParameters 103 | 104 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 105 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 106 | 107 | ## INPUTS 108 | 109 | ## OUTPUTS 110 | 111 | ### None 112 | 113 | ## NOTES 114 | 115 | ## RELATED LINKS 116 | -------------------------------------------------------------------------------- /docs/Initialize-LabResourceModule.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabResourceModule 9 | 10 | ## SYNOPSIS 11 | 12 | Downloads the Resource Modules from a provided array. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabResourceModule [-Lab] [[-Name] ] [[-ResourceModules] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | Takes an array of LabResourceModule objects ane ensures the Resource Modules are available in 24 | the PowerShell Modules folder. 25 | If they are not they will be downloaded. 26 | 27 | ## EXAMPLES 28 | 29 | ### EXAMPLE 1 30 | 31 | ```powershell 32 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 33 | ``` 34 | 35 | $ResourceModules = Get-LabResourceModule -Lab $Lab 36 | Initialize-LabResourceModule -Lab $Lab -ResourceModules $ResourceModules 37 | Initializes the Resource Modules in the configured in the Lab c:\mylab\config.xml 38 | 39 | ### EXAMPLE 2 40 | 41 | ```powershell 42 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 43 | ``` 44 | 45 | Initialize-LabResourceModule -Lab $Lab 46 | Initializes the Resource Modules in the configured in the Lab c:\mylab\config.xml 47 | 48 | ## PARAMETERS 49 | 50 | ### -Lab 51 | 52 | Contains Lab object that was loaded by the Get-Lab object. 53 | 54 | ```yaml 55 | Type: Object 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 2 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -Name 67 | 68 | An optional array of Module names. 69 | 70 | Only Module Resources matching names in this list will be pulled into the returned in the array. 71 | 72 | ```yaml 73 | Type: String[] 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 3 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -ResourceModules 85 | 86 | The array of Resource Modules pulled from the Lab using Get-LabResourceModule. 87 | 88 | If not provided it will attempt to pull the list from the Lab. 89 | 90 | ```yaml 91 | Type: LabResourceModule[] 92 | Parameter Sets: (All) 93 | Aliases: 94 | 95 | Required: False 96 | Position: 4 97 | Default value: None 98 | Accept pipeline input: False 99 | Accept wildcard characters: False 100 | ``` 101 | 102 | ### CommonParameters 103 | 104 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 105 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 106 | 107 | ## INPUTS 108 | 109 | ## OUTPUTS 110 | 111 | ### None 112 | 113 | ## NOTES 114 | 115 | ## RELATED LINKS 116 | -------------------------------------------------------------------------------- /docs/Initialize-LabSwitch.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabSwitch 9 | 10 | ## SYNOPSIS 11 | 12 | Creates Hyper-V Virtual Switches from a provided array of LabSwitch objects. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabSwitch [-Lab] [[-Name] ] [[-Switches] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes an array of LabSwitch objectsthat were pulled from a Lab object by calling 23 | Get-LabSwitch and ensures that they Hyper-V Virtual Switches on the system 24 | are configured to match. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | 30 | ```powershell 31 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 32 | ``` 33 | 34 | $Switches = Get-LabSwitch -Lab $Lab 35 | Initialize-LabSwitch -Lab $Lab -Switches $Switches 36 | Initializes the Hyper-V switches in the configured in the Lab c:\mylab\config.xml 37 | 38 | ### EXAMPLE 2 39 | 40 | ```powershell 41 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 42 | ``` 43 | 44 | Initialize-LabSwitch -Lab $Lab 45 | Initializes the Hyper-V switches in the configured in the Lab c:\mylab\config.xml 46 | 47 | ## PARAMETERS 48 | 49 | ### -Lab 50 | 51 | Contains Lab object that was loaded by the Get-Lab object. 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Name 66 | 67 | An optional array of Switch names. 68 | 69 | Only Switches matching names in this list will be initialized. 70 | 71 | ```yaml 72 | Type: String[] 73 | Parameter Sets: (All) 74 | Aliases: 75 | 76 | Required: False 77 | Position: 3 78 | Default value: None 79 | Accept pipeline input: False 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### -Switches 84 | 85 | The array of LabSwitch objects pulled from the Lab using Get-LabSwitch. 86 | 87 | If not provided it will attempt to pull the array from the Lab object provided. 88 | 89 | ```yaml 90 | Type: LabSwitch[] 91 | Parameter Sets: (All) 92 | Aliases: 93 | 94 | Required: False 95 | Position: 4 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### CommonParameters 102 | 103 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 104 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 105 | 106 | ## INPUTS 107 | 108 | ## OUTPUTS 109 | 110 | ### None 111 | 112 | ## NOTES 113 | 114 | ## RELATED LINKS 115 | -------------------------------------------------------------------------------- /docs/Initialize-LabVM.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabVM 9 | 10 | ## SYNOPSIS 11 | 12 | Initializes the Virtual Machines used by a Lab from a provided array. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabVM [-Lab] [[-Name] ] [[-VMs] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | Takes an array of LabVM objects that were configured in the Lab. 23 | 24 | ## EXAMPLES 25 | 26 | ### EXAMPLE 1 27 | 28 | ```powershell 29 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 30 | ``` 31 | 32 | $VMs = Get-LabVs -Lab $Lab 33 | Initialize-LabVM \` 34 | -Lab $Lab \` 35 | -VMs $VMs 36 | Initializes the Virtual Machines in the configured in the Lab c:\mylab\config.xml 37 | 38 | ### EXAMPLE 2 39 | 40 | ```powershell 41 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 42 | ``` 43 | 44 | Initialize-LabVMs -Lab $Lab 45 | Initializes the Virtual Machines in the configured in the Lab c:\mylab\config.xml 46 | 47 | ## PARAMETERS 48 | 49 | ### -Lab 50 | 51 | Contains the Lab object that was loaded by the Get-Lab object. 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Name 66 | 67 | An optional array of VM names. 68 | 69 | Only VMs matching names in this list will be initialized. 70 | 71 | ```yaml 72 | Type: String[] 73 | Parameter Sets: (All) 74 | Aliases: 75 | 76 | Required: False 77 | Position: 3 78 | Default value: None 79 | Accept pipeline input: False 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### -VMs 84 | 85 | An array of LabVM objects pulled from a Lab object. 86 | 87 | If not provided it will attempt to pull the list from the Lab object. 88 | 89 | ```yaml 90 | Type: LabVM[] 91 | Parameter Sets: (All) 92 | Aliases: 93 | 94 | Required: False 95 | Position: 4 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### CommonParameters 102 | 103 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 104 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 105 | 106 | ## INPUTS 107 | 108 | ## OUTPUTS 109 | 110 | ### None 111 | 112 | ## NOTES 113 | 114 | ## RELATED LINKS 115 | -------------------------------------------------------------------------------- /docs/Initialize-LabVMTemplate.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabVMTemplate 9 | 10 | ## SYNOPSIS 11 | 12 | {{Fill in the Synopsis}} 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabVMTemplate [-Lab] [[-Name] ] [[-VMTemplates] ] 18 | [[-VMTemplateVHDs] ] [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | {{Fill in the Description}} 24 | 25 | ## EXAMPLES 26 | 27 | ### Example 1 28 | 29 | ```powershell 30 | PS C:\> {{ Add example code here }} 31 | ``` 32 | 33 | {{ Add example description here }} 34 | 35 | ## PARAMETERS 36 | 37 | ### -Lab 38 | 39 | {{Fill Lab Description}} 40 | 41 | ```yaml 42 | Type: Object 43 | Parameter Sets: (All) 44 | Aliases: 45 | 46 | Required: True 47 | Position: 1 48 | Default value: None 49 | Accept pipeline input: False 50 | Accept wildcard characters: False 51 | ``` 52 | 53 | ### -Name 54 | 55 | {{Fill Name Description}} 56 | 57 | ```yaml 58 | Type: String[] 59 | Parameter Sets: (All) 60 | Aliases: 61 | 62 | Required: False 63 | Position: 2 64 | Default value: None 65 | Accept pipeline input: False 66 | Accept wildcard characters: False 67 | ``` 68 | 69 | ### -VMTemplateVHDs 70 | 71 | {{Fill VMTemplateVHDs Description}} 72 | 73 | ```yaml 74 | Type: LabVMTemplateVHD[] 75 | Parameter Sets: (All) 76 | Aliases: 77 | 78 | Required: False 79 | Position: 4 80 | Default value: None 81 | Accept pipeline input: False 82 | Accept wildcard characters: False 83 | ``` 84 | 85 | ### -VMTemplates 86 | 87 | {{Fill VMTemplates Description}} 88 | 89 | ```yaml 90 | Type: LabVMTemplate[] 91 | Parameter Sets: (All) 92 | Aliases: 93 | 94 | Required: False 95 | Position: 3 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### CommonParameters 102 | 103 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 104 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 105 | 106 | ## INPUTS 107 | 108 | ### None 109 | 110 | ## OUTPUTS 111 | 112 | ### System.Object 113 | 114 | ## NOTES 115 | 116 | ## RELATED LINKS 117 | -------------------------------------------------------------------------------- /docs/Initialize-LabVMTemplateVHD.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Initialize-LabVMTemplateVHD 9 | 10 | ## SYNOPSIS 11 | 12 | Scans through an array of LabVMTemplateVHD objects and creates them from the ISO if missing. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Initialize-LabVMTemplateVHD [-Lab] [[-Name] ] [[-VMTemplateVHDs] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | This function will take an array of LabVMTemplateVHD objects from a Lab or it will 24 | extract the arrays itself if it is not provided and ensure that each VHD file is available. 25 | 26 | If the VHD file is not available then it will attempt to create it from the ISO. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | 32 | ```powershell 33 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 34 | ``` 35 | 36 | $VMTemplateVHDs = Get-LabVMTemplateVHD -Lab $Lab 37 | Initialize-LabVMTemplateVHD -Lab $Lab -VMTemplateVHDs $VMTemplateVHDs 38 | Loads a Lab and pulls the array of VM Template VHDs from it and then 39 | ensures all the VHDs are available. 40 | 41 | ### EXAMPLE 2 42 | 43 | ```powershell 44 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 45 | ``` 46 | 47 | Initialize-LabVMTemplateVHD -Lab $Lab 48 | Loads a Lab and then ensures VM Template VHDs all the VHDs are available. 49 | 50 | ## PARAMETERS 51 | 52 | ### -Lab 53 | 54 | Contains the Lab object that was loaded by the Get-Lab object. 55 | 56 | ```yaml 57 | Type: Object 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -Name 69 | 70 | An optional array of VM Template VHD names. 71 | 72 | Only VM Template VHDs matching names in this list will be initialized. 73 | 74 | ```yaml 75 | Type: String[] 76 | Parameter Sets: (All) 77 | Aliases: 78 | 79 | Required: False 80 | Position: 3 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### -VMTemplateVHDs 87 | 88 | The array of LabVMTemplateVHD objects pulled from the Lab using Get-LabVMTemplateVHD 89 | 90 | If not provided it will attempt to pull the list from the Lab. 91 | 92 | ```yaml 93 | Type: LabVMTemplateVHD[] 94 | Parameter Sets: (All) 95 | Aliases: 96 | 97 | Required: False 98 | Position: 4 99 | Default value: None 100 | Accept pipeline input: False 101 | Accept wildcard characters: False 102 | ``` 103 | 104 | ### CommonParameters 105 | 106 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 107 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 108 | 109 | ## INPUTS 110 | 111 | ## OUTPUTS 112 | 113 | ### None 114 | 115 | ## NOTES 116 | 117 | ## RELATED LINKS 118 | -------------------------------------------------------------------------------- /docs/Install-LabVM.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Install-LabVM 9 | 10 | ## SYNOPSIS 11 | 12 | Starts a Lab VM and ensures it has been Initialized. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Install-LabVM [-Lab] [[-VM] ] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | This cmdlet is used to start up a Lab VM for the first time. 23 | 24 | It will start the VM if it is off. 25 | 26 | If the VM is a Server OS or Nano Server then it will also perform an initial setup: 27 | 28 | - It will ensure that initial setup has been completed and a self-signed certificate has 29 | been created by the VM and downloaded to the LabBuilder folder. 30 | 31 | - It will also ensure DSC is configured for the VM. 32 | 33 | ## EXAMPLES 34 | 35 | ### EXAMPLE 1 36 | 37 | ```powershell 38 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 39 | ``` 40 | 41 | $VMs = Get-LabVM -Lab $Lab 42 | $Session = Install-LabVM -VM $VMs\[0\] 43 | Start up the first VM in the Lab c:\mylab\config.xml and initialize it. 44 | 45 | ## PARAMETERS 46 | 47 | ### -Lab 48 | 49 | {{Fill Lab Description}} 50 | 51 | ```yaml 52 | Type: Object 53 | Parameter Sets: (All) 54 | Aliases: 55 | 56 | Required: True 57 | Position: 2 58 | Default value: None 59 | Accept pipeline input: False 60 | Accept wildcard characters: False 61 | ``` 62 | 63 | ### -VM 64 | 65 | The LabVM Object referring to the VM to start to. 66 | 67 | ```yaml 68 | Type: LabVM 69 | Parameter Sets: (All) 70 | Aliases: 71 | 72 | Required: False 73 | Position: 3 74 | Default value: None 75 | Accept pipeline input: False 76 | Accept wildcard characters: False 77 | ``` 78 | 79 | ### CommonParameters 80 | 81 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 82 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 83 | 84 | ## INPUTS 85 | 86 | ## OUTPUTS 87 | 88 | ### None 89 | 90 | ## NOTES 91 | 92 | ## RELATED LINKS 93 | -------------------------------------------------------------------------------- /docs/Remove-LabSwitch.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LabSwitch 9 | 10 | ## SYNOPSIS 11 | 12 | Removes all Hyper-V Virtual Switches provided. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Remove-LabSwitch [-Lab] [[-Name] ] [[-Switches] ] 18 | [-RemoveExternal] [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | This cmdlet is used to remove any Hyper-V Virtual Switches that were created by 24 | the Initialize-LabSwitch cmdlet. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | 30 | ```powershell 31 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 32 | ``` 33 | 34 | $Switches = Get-LabSwitch -Lab $Lab 35 | Remove-LabSwitch -Lab $Lab -Switches $Switches 36 | Removes any Hyper-V switches in the configured in the Lab c:\mylab\config.xml 37 | 38 | ### EXAMPLE 2 39 | 40 | ```powershell 41 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 42 | ``` 43 | 44 | Remove-LabSwitch -Lab $Lab 45 | Removes any Hyper-V switches in the configured in the Lab c:\mylab\config.xml 46 | 47 | ## PARAMETERS 48 | 49 | ### -Lab 50 | 51 | Contains the Lab object that was loaded by the Get-Lab object. 52 | 53 | ```yaml 54 | Type: Object 55 | Parameter Sets: (All) 56 | Aliases: 57 | 58 | Required: True 59 | Position: 2 60 | Default value: None 61 | Accept pipeline input: False 62 | Accept wildcard characters: False 63 | ``` 64 | 65 | ### -Name 66 | 67 | An optional array of Switch names. 68 | 69 | Only Switches matching names in this list will be removed. 70 | 71 | ```yaml 72 | Type: String[] 73 | Parameter Sets: (All) 74 | Aliases: 75 | 76 | Required: False 77 | Position: 3 78 | Default value: None 79 | Accept pipeline input: False 80 | Accept wildcard characters: False 81 | ``` 82 | 83 | ### -Switches 84 | 85 | The array of LabSwitch objects pulled from the Lab using Get-LabSwitch. 86 | 87 | If not provided it will attempt to pull the array from the Lab object. 88 | 89 | ```yaml 90 | Type: LabSwitch[] 91 | Parameter Sets: (All) 92 | Aliases: 93 | 94 | Required: False 95 | Position: 4 96 | Default value: None 97 | Accept pipeline input: False 98 | Accept wildcard characters: False 99 | ``` 100 | 101 | ### -RemoveExternal 102 | 103 | By default, external switches will not be removed. Using this switch 104 | will allow External switches to be deleted by the function. 105 | 106 | ```yaml 107 | Type: Switch 108 | Parameter Sets: (All) 109 | Aliases: 110 | 111 | Required: False 112 | Position: 4 113 | Default value: None 114 | Accept pipeline input: False 115 | Accept wildcard characters: False 116 | ``` 117 | 118 | ### CommonParameters 119 | 120 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 121 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 122 | 123 | ## INPUTS 124 | 125 | ## OUTPUTS 126 | 127 | ### None 128 | 129 | ## NOTES 130 | 131 | ## RELATED LINKS 132 | -------------------------------------------------------------------------------- /docs/Remove-LabVM.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LabVM 9 | 10 | ## SYNOPSIS 11 | 12 | Removes all Lab Virtual Machines. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Remove-LabVM [-Lab] [[-Name] ] [[-VMs] ] [-RemoveVMFolder] [] 18 | ``` 19 | 20 | ## DESCRIPTION 21 | 22 | This cmdlet is used to remove any Virtual Machines that were created as part of this 23 | Lab. 24 | 25 | It can also optionally delete the folder and all files created as part of this Lab 26 | Virutal Machine. 27 | 28 | ## EXAMPLES 29 | 30 | ### EXAMPLE 1 31 | 32 | ```powershell 33 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 34 | ``` 35 | 36 | $VMTemplates = Get-LabVMTemplate -Lab $Lab 37 | $VMs = Get-LabVs -Lab $Lab -VMTemplates $VMTemplates 38 | Remove-LabVM -Lab $Lab -VMs $VMs 39 | Removes any Virtual Machines configured in the Lab c:\mylab\config.xml 40 | 41 | ### EXAMPLE 2 42 | 43 | ```powershell 44 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 45 | ``` 46 | 47 | Remove-LabVM -Lab $Lab 48 | Removes any Virtual Machines configured in the Lab c:\mylab\config.xml 49 | 50 | ## PARAMETERS 51 | 52 | ### -Lab 53 | 54 | Contains the Lab object that was loaded by the Get-Lab object. 55 | 56 | ```yaml 57 | Type: Object 58 | Parameter Sets: (All) 59 | Aliases: 60 | 61 | Required: True 62 | Position: 2 63 | Default value: None 64 | Accept pipeline input: False 65 | Accept wildcard characters: False 66 | ``` 67 | 68 | ### -Name 69 | 70 | An optional array of VM names. 71 | 72 | Only VMs matching names in this list will be removed. 73 | 74 | ```yaml 75 | Type: String[] 76 | Parameter Sets: (All) 77 | Aliases: 78 | 79 | Required: False 80 | Position: 3 81 | Default value: None 82 | Accept pipeline input: False 83 | Accept wildcard characters: False 84 | ``` 85 | 86 | ### -VMs 87 | 88 | The array of LabVM objects pulled from the Lab using Get-LabVM. 89 | 90 | If not provided it will attempt to pull the list from the Lab object. 91 | 92 | ```yaml 93 | Type: LabVM[] 94 | Parameter Sets: (All) 95 | Aliases: 96 | 97 | Required: False 98 | Position: 4 99 | Default value: None 100 | Accept pipeline input: False 101 | Accept wildcard characters: False 102 | ``` 103 | 104 | ### -RemoveVMFolder 105 | 106 | Causes the folder created to contain the Virtual Machine in this lab to be deleted. 107 | 108 | ```yaml 109 | Type: SwitchParameter 110 | Parameter Sets: (All) 111 | Aliases: 112 | 113 | Required: False 114 | Position: 5 115 | Default value: False 116 | Accept pipeline input: False 117 | Accept wildcard characters: False 118 | ``` 119 | 120 | ### CommonParameters 121 | 122 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 123 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 124 | 125 | ## INPUTS 126 | 127 | ## OUTPUTS 128 | 129 | ### None 130 | 131 | ## NOTES 132 | 133 | ## RELATED LINKS 134 | -------------------------------------------------------------------------------- /docs/Remove-LabVMTemplate.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LabVMTemplate 9 | 10 | ## SYNOPSIS 11 | 12 | Removes all Lab Virtual Machine Template VHDs. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Remove-LabVMTemplate [-Lab] [[-Name] ] [[-VMTemplates] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | This cmdlet is used to remove any Virtual Machine Template VHDs that were copied when 24 | creating this Lab. 25 | 26 | This function should never be run unless the Lab has no Differencing Disks using these 27 | Template VHDs or the Lab is being completely removed. 28 | Removing these Template VHDs if 29 | Lab Virtual Machines are using these templates as differencing disk parents will cause 30 | the Lab Virtual Hard Drives to become corrupt. 31 | 32 | ## EXAMPLES 33 | 34 | ### EXAMPLE 1 35 | 36 | ```powershell 37 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 38 | ``` 39 | 40 | $VMTemplates = Get-LabVMTemplate -Lab $Lab 41 | Remove-LabVMTemplate -Lab $Lab -VMTemplates $VMTemplates 42 | Removes any Virtual Machine template VHDs configured in the Lab c:\mylab\config.xml 43 | 44 | ### EXAMPLE 2 45 | 46 | ```powershell 47 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 48 | ``` 49 | 50 | Remove-LabVMTemplate -Lab $Lab 51 | Removes any Virtual Machine template VHDs configured in the Lab c:\mylab\config.xml 52 | 53 | ## PARAMETERS 54 | 55 | ### -Lab 56 | 57 | Contains the Lab object that was loaded by the Get-Lab object. 58 | 59 | ```yaml 60 | Type: Object 61 | Parameter Sets: (All) 62 | Aliases: 63 | 64 | Required: True 65 | Position: 2 66 | Default value: None 67 | Accept pipeline input: False 68 | Accept wildcard characters: False 69 | ``` 70 | 71 | ### -Name 72 | 73 | An optional array of VM Template names. 74 | 75 | Only VM Templates matching names in this list will be removed. 76 | 77 | ```yaml 78 | Type: String[] 79 | Parameter Sets: (All) 80 | Aliases: 81 | 82 | Required: False 83 | Position: 3 84 | Default value: None 85 | Accept pipeline input: False 86 | Accept wildcard characters: False 87 | ``` 88 | 89 | ### -VMTemplates 90 | 91 | The array of LabVMTemplate objects pulled from the Lab using Get-LabVMTemplate. 92 | 93 | If not provided it will attempt to pull the list from the Lab. 94 | 95 | ```yaml 96 | Type: LabVMTemplate[] 97 | Parameter Sets: (All) 98 | Aliases: 99 | 100 | Required: False 101 | Position: 4 102 | Default value: None 103 | Accept pipeline input: False 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### CommonParameters 108 | 109 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 110 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ### None 117 | 118 | ## NOTES 119 | 120 | ## RELATED LINKS 121 | -------------------------------------------------------------------------------- /docs/Remove-LabVMTemplateVHD.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Remove-LabVMTemplateVHD 9 | 10 | ## SYNOPSIS 11 | 12 | Scans through an array of LabVMTemplateVHD objects and removes them if they exist. 13 | 14 | ## SYNTAX 15 | 16 | ```powershell 17 | Remove-LabVMTemplateVHD [-Lab] [[-Name] ] [[-VMTemplateVHDs] ] 18 | [] 19 | ``` 20 | 21 | ## DESCRIPTION 22 | 23 | This function will take an array of LabVMTemplateVHD objects from a Lab or it will 24 | extract the list itself if it is not provided and remove the VHD file if it exists. 25 | 26 | ## EXAMPLES 27 | 28 | ### EXAMPLE 1 29 | 30 | ```powershell 31 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 32 | ``` 33 | 34 | $VMTemplateVHDs = Get-LabVMTemplateVHD -Lab $Lab 35 | Remove-LabVMTemplateVHD -Lab $Lab -VMTemplateVHDs $VMTemplateVHDs 36 | Loads a Lab and pulls the array of VM Template VHDs from it and then 37 | ensures all the VM template VHDs are deleted. 38 | 39 | ### EXAMPLE 2 40 | 41 | ```powershell 42 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 43 | ``` 44 | 45 | Remove-LabVMTemplateVHD -Lab $Lab 46 | Loads a Lab and then ensures the VM template VHDs are deleted. 47 | 48 | ## PARAMETERS 49 | 50 | ### -Lab 51 | 52 | Contains the Lab object that was loaded by the Get-Lab object. 53 | 54 | ```yaml 55 | Type: Object 56 | Parameter Sets: (All) 57 | Aliases: 58 | 59 | Required: True 60 | Position: 2 61 | Default value: None 62 | Accept pipeline input: False 63 | Accept wildcard characters: False 64 | ``` 65 | 66 | ### -Name 67 | 68 | An optional array of VM Template VHD names. 69 | 70 | Only VM Template VHDs matching names in this list will be removed. 71 | 72 | ```yaml 73 | Type: String[] 74 | Parameter Sets: (All) 75 | Aliases: 76 | 77 | Required: False 78 | Position: 3 79 | Default value: None 80 | Accept pipeline input: False 81 | Accept wildcard characters: False 82 | ``` 83 | 84 | ### -VMTemplateVHDs 85 | 86 | The array of LabVMTemplateVHD objects from the Lab using Get-LabVMTemplateVHD. 87 | 88 | If not provided it will attempt to pull the list from the Lab. 89 | 90 | ```yaml 91 | Type: LabVMTemplateVHD[] 92 | Parameter Sets: (All) 93 | Aliases: 94 | 95 | Required: False 96 | Position: 4 97 | Default value: None 98 | Accept pipeline input: False 99 | Accept wildcard characters: False 100 | ``` 101 | 102 | ### CommonParameters 103 | 104 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 105 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 106 | 107 | ## INPUTS 108 | 109 | ## OUTPUTS 110 | 111 | ### None 112 | 113 | ## NOTES 114 | 115 | ## RELATED LINKS 116 | -------------------------------------------------------------------------------- /docs/Update-Lab.md: -------------------------------------------------------------------------------- 1 | --- 2 | external help file: LabBuilder-help.xml 3 | Module Name: LabBuilder 4 | online version: 5 | schema: 2.0.0 6 | --- 7 | 8 | # Update-Lab 9 | 10 | ## SYNOPSIS 11 | 12 | Update a Lab. 13 | 14 | ## SYNTAX 15 | 16 | ### Lab (Default) 17 | 18 | ```powershell 19 | Update-Lab [-Lab] [] 20 | ``` 21 | 22 | ### File 23 | 24 | ```powershell 25 | Update-Lab [-ConfigPath] [[-LabPath] ] [] 26 | ``` 27 | 28 | ## DESCRIPTION 29 | 30 | This cmdlet will update the existing Hyper-V lab environment defined by the 31 | LabBuilder configuration file provided. 32 | 33 | If components of the Lab are missing they will be added. 34 | 35 | If components of the Lab already exist, they will be updated if they differ 36 | from the settings in the Configuration file. 37 | 38 | ## EXAMPLES 39 | 40 | ### EXAMPLE 1 41 | 42 | ```powershell 43 | Update-Lab -ConfigPath c:\mylab\config.xml 44 | ``` 45 | 46 | Update the lab defined in the c:\mylab\config.xml LabBuilder configuration file. 47 | 48 | ### EXAMPLE 2 49 | 50 | ```powershell 51 | Get-Lab -ConfigPath c:\mylab\config.xml | Update-Lab 52 | ``` 53 | 54 | Update the lab defined in the c:\mylab\config.xml LabBuilder configuration file. 55 | 56 | ## PARAMETERS 57 | 58 | ### -ConfigPath 59 | 60 | The path to the LabBuilder configuration XML file. 61 | 62 | ```yaml 63 | Type: String 64 | Parameter Sets: File 65 | Aliases: 66 | 67 | Required: True 68 | Position: 2 69 | Default value: None 70 | Accept pipeline input: False 71 | Accept wildcard characters: False 72 | ``` 73 | 74 | ### -LabPath 75 | 76 | The optional path to update the Lab in - overrides the LabPath setting in the 77 | configuration file. 78 | 79 | ```yaml 80 | Type: String 81 | Parameter Sets: File 82 | Aliases: 83 | 84 | Required: False 85 | Position: 3 86 | Default value: None 87 | Accept pipeline input: False 88 | Accept wildcard characters: False 89 | ``` 90 | 91 | ### -Lab 92 | 93 | The Lab object returned by Get-Lab of the lab to update. 94 | 95 | ```yaml 96 | Type: Object 97 | Parameter Sets: Lab 98 | Aliases: 99 | 100 | Required: True 101 | Position: 4 102 | Default value: None 103 | Accept pipeline input: True (ByValue) 104 | Accept wildcard characters: False 105 | ``` 106 | 107 | ### CommonParameters 108 | 109 | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. 110 | For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 111 | 112 | ## INPUTS 113 | 114 | ## OUTPUTS 115 | 116 | ### None 117 | 118 | ## NOTES 119 | 120 | ## RELATED LINKS 121 | -------------------------------------------------------------------------------- /source/LabBuilder.psm1: -------------------------------------------------------------------------------- 1 | # This file will be generated 2 | -------------------------------------------------------------------------------- /source/Private/Assert-LabValidIpAddress.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Validates the IP Address. 4 | 5 | .PARAMETER IpAddress 6 | Contains the IP Address to validate. 7 | 8 | .EXAMPLE 9 | Assert-LabValidIpAddress -IpAddress '192.168.123.44' 10 | Does not throw an exception and returns '192.168.123.44'. 11 | 12 | .EXAMPLE 13 | Assert-LabValidIpAddress -IpAddress '192.168.123.4432' 14 | Throws an exception. 15 | 16 | .OUTPUTS 17 | The IP address if valid. 18 | #> 19 | function Assert-LabValidIpAddress 20 | { 21 | [CmdLetBinding()] 22 | param 23 | ( 24 | [Parameter(Mandatory = $true)] 25 | [ValidateNotNullOrEmpty()] 26 | [System.String] 27 | $IpAddress 28 | ) 29 | 30 | $ip = [System.Net.IPAddress]::Any 31 | if (-not [System.Net.IPAddress]::TryParse($IpAddress, [ref] $ip)) 32 | { 33 | $exceptionParameters = @{ 34 | errorId = 'IPAddressError' 35 | errorCategory = 'InvalidArgument' 36 | errorMessage = $($LocalizedData.IPAddressError -f $IpAddress) 37 | } 38 | New-LabException @exceptionParameters 39 | } 40 | return $ip 41 | } 42 | -------------------------------------------------------------------------------- /source/Private/ConvertTo-LabAbsolutePath.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Convert a path to be an absolute by adding it to the base path. 4 | If the path is already absolute then it is just returned as is. 5 | 6 | .PARAMETER Path 7 | The path to convert to an absolute path. 8 | 9 | .PARAMETER BasePath 10 | The full path to the lab. 11 | 12 | .OUTPUTS 13 | The path converted to an absolute path. 14 | #> 15 | function ConvertTo-LabAbsolutePath 16 | { 17 | [CmdLetBinding()] 18 | param 19 | ( 20 | [Parameter(Mandatory = $true)] 21 | [System.String] 22 | $Path, 23 | 24 | [Parameter(Mandatory = $true)] 25 | [System.String] 26 | $BasePath 27 | ) 28 | 29 | if (-not [System.IO.Path]::IsPathRooted($Path)) 30 | { 31 | $Path = Join-Path ` 32 | -Path $BasePath ` 33 | -ChildPath $Path 34 | } # if 35 | 36 | return $Path 37 | } 38 | -------------------------------------------------------------------------------- /source/Private/Enable-LabWSMan.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Ensures the WS-Man is configured on this system. 4 | 5 | .DESCRIPTION 6 | If WS-Man is not enabled on this system it will be enabled. 7 | This is required to communicate with the managed Lab Virtual Machines. 8 | 9 | .EXAMPLE 10 | Enable-LabWSMan 11 | Enables WS-Man on this machine. 12 | 13 | .OUTPUTS 14 | None 15 | #> 16 | function Enable-LabWSMan 17 | { 18 | [CmdLetBinding()] 19 | param 20 | ( 21 | [Parameter()] 22 | [Switch] 23 | $Force 24 | ) 25 | 26 | if (-not (Get-PSPRovider -PSProvider WSMan -ErrorAction SilentlyContinue)) 27 | { 28 | Write-LabMessage -Message ($LocalizedData.EnablingWSManMessage) 29 | 30 | try 31 | { 32 | Start-Service -Name WinRm -ErrorAction Stop 33 | } 34 | catch 35 | { 36 | $null = Enable-PSRemoting ` 37 | @PSBoundParameters ` 38 | -SkipNetworkProfileCheck ` 39 | -ErrorAction Stop 40 | } 41 | 42 | # Check WS-Man was enabled 43 | if (-not (Get-PSProvider -PSProvider WSMan -ErrorAction SilentlyContinue)) 44 | { 45 | $exceptionParameters = @{ 46 | errorId = 'WSManNotEnabledError' 47 | errorCategory = 'InvalidArgument' 48 | errorMessage = $($LocalizedData.WSManNotEnabledError) 49 | } 50 | New-LabException @exceptionParameters 51 | } # if 52 | } # if 53 | 54 | # Make sure the WinRM service is running 55 | if ((Get-Service -Name WinRM).Status -ne 'Running') 56 | { 57 | try 58 | { 59 | Start-Service -Name WinRm -ErrorAction Stop 60 | } 61 | catch 62 | { 63 | $exceptionParameters = @{ 64 | errorId = 'WinRMServiceFailedToStartError' 65 | errorCategory = 'InvalidArgument' 66 | errorMessage = $($LocalizedData.WinRMServiceFailedToStartError) 67 | } 68 | New-LabException @exceptionParameters 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /source/Private/Get-LabBuilderModulePath.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Returns the path of the currently loaded LabBuilder module. 4 | 5 | .OUTPUTS 6 | The path to the currently loaded LabBuilder module. 7 | #> 8 | function Get-LabBuilderModulePath 9 | { 10 | [CmdLetBinding()] 11 | [OutputType([System.String])] 12 | param () 13 | 14 | return $script:LabBuidlerModuleRoot 15 | } 16 | -------------------------------------------------------------------------------- /source/Private/Get-LabIntegrationServiceName.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Get list of Integration Service names (localized) 4 | 5 | .DESCRIPTION 6 | This cmdlet will get the list of Integration services available on a Hyper-V host. 7 | The list of Integration Services will contain the localized names. 8 | 9 | .EXAMPLE 10 | Get-LabIntegrationServiceName 11 | 12 | .OUTPUTS 13 | An array of localized Integration Serivce names. 14 | #> 15 | function Get-LabIntegrationServiceName 16 | { 17 | [CmdLetBinding()] 18 | param 19 | ( 20 | ) 21 | 22 | $captions = @() 23 | $classes = @( 24 | 'Msvm_VssComponentSettingData' 25 | 'Msvm_ShutdownComponentSettingData' 26 | 'Msvm_TimeSyncComponentSettingData' 27 | 'Msvm_HeartbeatComponentSettingData' 28 | 'Msvm_GuestServiceInterfaceComponentSettingData' 29 | 'Msvm_KvpExchangeComponentSettingData' 30 | ) 31 | 32 | <# 33 | This Integration Service is registered in CIM but is not exposed in Hyper-V: 34 | 'Msvm_RdvComponentSettingData' 35 | #> 36 | 37 | foreach ($class in $classes) 38 | { 39 | $captions += (Get-CimInstance ` 40 | -Class $class ` 41 | -Namespace Root\Virtualization\V2 ` 42 | -Property Caption | Select-Object -First 1).Caption 43 | } # foreach 44 | 45 | return $captions 46 | } 47 | -------------------------------------------------------------------------------- /source/Private/Get-LabManagementSwitchName.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Returns the name of the Management Switch to use for this lab. 4 | 5 | .DESCRIPTION 6 | Each lab has a unique private management switch created for it. 7 | All Virtual Machines in the Lab are connected to the switch. 8 | This function returns the name of this swtich for the provided 9 | lab configuration. 10 | 11 | .PARAMETER Lab 12 | Contains the Lab object that was produced by the Get-Lab cmdlet. 13 | 14 | .EXAMPLE 15 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 16 | $ManagementSwitch = Get-LabManagementSwitchName -Lab $Lab 17 | Returns the Management Switch for the Lab c:\mylab\config.xml. 18 | 19 | .OUTPUTS 20 | A management switch name. 21 | #> 22 | function Get-LabManagementSwitchName 23 | { 24 | [CmdLetBinding()] 25 | [OutputType([System.String])] 26 | param 27 | ( 28 | [Parameter(Mandatory = $true)] 29 | $Lab 30 | ) 31 | 32 | $LabId = $Lab.labbuilderconfig.settings.labid 33 | 34 | if (-not $LabId) 35 | { 36 | $LabId = $Lab.labbuilderconfig.name 37 | } # if 38 | 39 | $managementSwitchName = ('{0}Lab Management' -f $LabId) 40 | 41 | return $managementSwitchName 42 | } 43 | -------------------------------------------------------------------------------- /source/Private/Get-LabModulesInDSCConfig.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Get a list of all Resources imported in a DSC Config 4 | 5 | .DESCRIPTION 6 | Uses RegEx to pull a list of Resources that are imported in a DSC Configuration using the 7 | Import-DSCResource cmdlet. 8 | 9 | If The -ModuleVersion parameter is included then the ModuleVersion property in the returned 10 | LabDSCModule object will be set, otherwise it will be null. 11 | 12 | .PARAMETER DscConfigFile 13 | Contains the path to the DSC Config file to extract resource module names from. 14 | 15 | .PARAMETER DscConfigContent 16 | Contains the content of the DSC Config to extract resource module names from. 17 | 18 | .EXAMPLE 19 | Get-LabModulesInDSCConfig -DscConfigFile c:\mydsc\Server01.ps1 20 | Return the DSC Resource module list from file c:\mydsc\server01.ps1 21 | 22 | .EXAMPLE 23 | Get-LabModulesInDSCConfig -DscConfigContent $DSCConfig 24 | Return the DSC Resource module list from the DSC Config in $DSCConfig. 25 | 26 | .OUTPUTS 27 | An array of LabDSCModule objects containing the DSC Resource modules required by this DSC 28 | configuration file. 29 | #> 30 | function Get-LabModulesInDSCConfig 31 | { 32 | [CmdLetBinding(DefaultParameterSetName = "Content")] 33 | [OutputType([Object[]])] 34 | param 35 | ( 36 | [parameter( 37 | Position = 1, 38 | ParameterSetName = "Content", 39 | Mandatory = $true)] 40 | [System.String] 41 | $DscConfigContent, 42 | 43 | [parameter( 44 | Position = 2, 45 | ParameterSetName = "File", 46 | Mandatory = $true)] 47 | [ValidateNotNullOrEmpty()] 48 | [System.String] 49 | $DscConfigFile 50 | ) 51 | 52 | [LabDSCModule[]] $modules = $null 53 | 54 | if ($PSCmdlet.ParameterSetName -eq 'File') 55 | { 56 | $DscConfigContent = Get-Content -Path $DscConfigFile -Raw 57 | } # if 58 | 59 | $regex = "[ \t]*?Import\-DscResource[ \t]+(?:\-ModuleName[ \t])?'?`"?([A-Za-z0-9._-]+)`"?'?(([ \t]+-ModuleVersion)?[ \t]+'?`"?([0-9.]+)`"?`?)?[ \t]*?[\r\n]+?" 60 | $moduleMatches = [regex]::matches($DscConfigContent, $regex, 'IgnoreCase') 61 | 62 | foreach ($moduleMatch in $moduleMatches) 63 | { 64 | $moduleName = $moduleMatch.Groups[1].Value 65 | $moduleVersion = $moduleMatch.Groups[4].Value 66 | # Make sure this module isn't already in the list 67 | 68 | if ($moduleName -notin $Modules.ModuleName) 69 | { 70 | $module = [LabDSCModule]::New($moduleName) 71 | 72 | if (-not [System.String]::IsNullOrWhitespace($moduleVersion)) 73 | { 74 | $module.moduleVersion = [Version] $moduleVersion 75 | } # if 76 | 77 | $modules += @( $module ) 78 | } # if 79 | } # foreach 80 | 81 | return $modules 82 | } 83 | -------------------------------------------------------------------------------- /source/Private/Get-LabNextIpAddress.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Increases the IP Address. 4 | 5 | .PARAMETER IpAddress 6 | Contains the IP Address to increase. 7 | 8 | .PARAMETER Step 9 | Contains the number of steps to increase the IP address by. 10 | 11 | .EXAMPLE 12 | Get-LabNextIpAddress -IpAddress '192.168.123.44' -Step 2 13 | Returns the IP Address '192.168.123.44' 14 | 15 | .EXAMPLE 16 | Get-LabNextIpAddress -IpAddress 'fe80::15b4:b934:5d23:1a2f' -Step 2 17 | Returns the IP Address 'fe80::15b4:b934:5d23:1a31' 18 | 19 | .OUTPUTS 20 | The increased IP Address. 21 | #> 22 | function Get-LabNextIpAddress 23 | { 24 | [CmdLetBinding()] 25 | param 26 | ( 27 | [Parameter(Mandatory = $true)] 28 | [ValidateNotNullOrEmpty()] 29 | [System.String] 30 | $IpAddress, 31 | 32 | [Parameter()] 33 | [System.Byte] 34 | $Step = 1 35 | ) 36 | 37 | # Check the IP Address is valid 38 | $ip = Assert-LabValidIpAddress -IpAddress $IpAddress 39 | 40 | # This code will increase the next IP address by the step amount. 41 | # It uses the IP Address byte array to do this. 42 | $bytes = $ip.GetAddressBytes() 43 | $position = $bytes.Length - 1 44 | 45 | while ($Step -gt 0) 46 | { 47 | if ($bytes[$position] + $Step -gt 255) 48 | { 49 | $bytes[$position] = $bytes[$position] + $Step - 256 50 | $Step = $Step - $bytes[$position] 51 | $position-- 52 | } 53 | else 54 | { 55 | $bytes[$position] = $bytes[$position] + $Step 56 | $Step = 0 57 | } # if 58 | } # while 59 | 60 | return [System.Net.IPAddress]::new($bytes).IPAddressToString 61 | } 62 | -------------------------------------------------------------------------------- /source/Private/Get-LabNextMacAddress.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Increases the MAC Address. 4 | 5 | .PARAMETER MACAddress 6 | Contains the MAC Address to increase. 7 | 8 | .PARAMETER Step 9 | Contains the number of steps to increase the MAC address by. 10 | 11 | .EXAMPLE 12 | Get-NextMacAddress -MacAddress '00155D0106ED' -Step 2 13 | Returns the MAC Address '00155D0106EF' 14 | 15 | .OUTPUTS 16 | The increased MAC Address. 17 | #> 18 | function Get-NextMacAddress 19 | { 20 | [CmdLetBinding()] 21 | param 22 | ( 23 | [Parameter(Mandatory = $true)] 24 | [ValidateNotNullOrEmpty()] 25 | [System.String] 26 | $MacAddress, 27 | 28 | [System.Byte] 29 | $Step = 1 30 | ) 31 | 32 | return [System.String]::Format("{0:X}", [Convert]::ToUInt64($MACAddress, 16) + $Step).PadLeft(12, '0') 33 | } 34 | -------------------------------------------------------------------------------- /source/Private/Get-LabVMManagementIPAddress.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Gets the Management IP Address for a running Lab VM. 4 | 5 | .DESCRIPTION 6 | This function will return the IPv4 address assigned to the network adapter that 7 | is connected to the Management switch for the specified VM. The VM must be 8 | running, otherwise an error will be thrown. 9 | 10 | .PARAMETER Lab 11 | Contains the Lab object that was produced by the Get-Lab cmdlet. 12 | 13 | .PARAMETER VM 14 | A LabVM object pulled from the Lab Configuration file using Get-LabVM 15 | 16 | .EXAMPLE 17 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 18 | $VMs = Get-LabVM -Lab $Lab 19 | $IPAddress = Get-LabVMManagementIPAddress -Lab $Lab -VM $VM[0] 20 | 21 | .OUTPUTS 22 | The IP Managment IP Address. 23 | #> 24 | function Get-LabVMManagementIPAddress 25 | { 26 | [CmdLetBinding()] 27 | [OutputType([System.String])] 28 | param 29 | ( 30 | [Parameter(Mandatory = $true)] 31 | $Lab, 32 | 33 | [Parameter(Mandatory = $true)] 34 | [LabVM] 35 | $VM 36 | ) 37 | 38 | $managementSwitchName = Get-LabManagementSwitchName -Lab $Lab 39 | $managementAdapter = Get-VMNetworkAdapter -VMName $VM.Name | 40 | Where-Object -Property SwitchName -EQ -Value $managementSwitchName 41 | $managementAdapterIpAddresses = $managementAdapter.IPAddresses 42 | $managementAdapterIpAddress = $managementAdapterIpAddresses | 43 | Where-Object -FilterScript { 44 | $_.Contains('.') 45 | } 46 | 47 | if (-not $managementAdapterIpAddress) { 48 | $exceptionParameters = @{ 49 | errorId = 'ManagmentIPAddressError' 50 | errorCategory = 'InvalidArgument' 51 | errorMessage = $($LocalizedData.ManagmentIPAddressError ` 52 | -f $managementSwitchName,$VM.Name) 53 | } 54 | New-LabException @exceptionParameters 55 | } # if 56 | 57 | return $managementAdapterIpAddress 58 | } 59 | -------------------------------------------------------------------------------- /source/Private/Initialize-LabDSC.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | This function prepares all files require to configure a VM using Desired State 4 | Configuration (DSC). 5 | 6 | .DESCRIPTION 7 | Calling this function will cause the LabBuilder folder to be populated/updated 8 | with all files required to configure a Virtual Machine with DSC. 9 | This includes: 10 | 1. Required DSC Resouce Modules. 11 | 2. DSC Credential Encryption certificate. 12 | 3. DSC Configuration files. 13 | 4. DSC MOF Files for general config and for LCM config. 14 | 5. Start up scripts. 15 | 16 | .PARAMETER Lab 17 | Contains the Lab object that was produced by the Get-Lab cmdlet. 18 | 19 | .PARAMETER VM 20 | A LabVM object pulled from the Lab Configuration file using Get-LabVM 21 | 22 | .EXAMPLE 23 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 24 | $VMs = Get-LabVM -Lab $Lab 25 | Initialize-LabDSC -Lab $Lab -VM $VMs[0] 26 | Prepares all files required to start up Desired State Configuration for the 27 | first VM in the Lab c:\mylab\config.xml for DSC start up. 28 | 29 | .OUTPUTS 30 | None. 31 | #> 32 | function Initialize-LabDSC 33 | { 34 | [CmdLetBinding()] 35 | param 36 | ( 37 | [Parameter(Mandatory = $true)] 38 | $Lab, 39 | 40 | [Parameter(Mandatory = $true)] 41 | [LabVM] 42 | $VM 43 | ) 44 | 45 | # Are there any DSC Settings to manage? 46 | Update-LabDSC -Lab $Lab -VM $VM 47 | 48 | # Generate the DSC Start up Script file 49 | Set-LabDSC -Lab $Lab -VM $VM 50 | } 51 | -------------------------------------------------------------------------------- /source/Private/Initialize-LabManagementSwitch.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Create the LabBuilder Management Network switch and assign VLAN 4 | 5 | .DESCRIPTION 6 | Each lab needs a unique private management switch created for it. 7 | All Virtual Machines in the Lab are connected to the switch. 8 | This function creates the virtual switch and attaches an adapter 9 | to it and assigns it to a VLAN. 10 | 11 | .PARAMETER Lab 12 | Contains the Lab object that was produced by the Get-Lab cmdlet. 13 | 14 | .EXAMPLE 15 | $Lab = Get-Lab -ConfigPath c:\mylab\config.xml 16 | Initialize-LabManagementSwitch -Lab $Lab 17 | Creates or updates the Management Switch for the Lab c:\mylab\config.xml. 18 | 19 | .OUTPUTS 20 | None. 21 | #> 22 | function Initialize-LabManagementSwitch 23 | { 24 | [CmdLetBinding()] 25 | param 26 | ( 27 | [Parameter(Mandatory = $true)] 28 | $Lab 29 | ) 30 | 31 | # Used by host to communicate with Lab VMs 32 | $managementSwitchName = Get-LabManagementSwitchName -Lab $Lab 33 | 34 | Write-LabMessage -Message $($LocalizedData.InitializingLabManagementVirtualNetworkMesage ` 35 | -f $managementSwitchName) 36 | 37 | if ($Lab.labbuilderconfig.switches.ManagementVlan) 38 | { 39 | $requiredManagementVlan = $Lab.labbuilderconfig.switches.ManagementVlan 40 | } 41 | else 42 | { 43 | $requiredManagementVlan = $script:DefaultManagementVLan 44 | } 45 | 46 | $managementSwitch = Get-VMSwitch | Where-Object -Property Name -eq $managementSwitchName 47 | 48 | if ($managementSwitch.Count -eq 0) 49 | { 50 | $null = New-VMSwitch ` 51 | -SwitchType Internal ` 52 | -Name $managementSwitchName ` 53 | -ErrorAction Stop 54 | 55 | Write-LabMessage -Message $($LocalizedData.CreatingLabManagementSwitchMessage ` 56 | -f $managementSwitchName, $requiredManagementVlan) 57 | } 58 | 59 | # Check the Vlan ID of the adapter on the switch 60 | $existingManagementAdapter = Get-VMNetworkAdapter ` 61 | -ManagementOS ` 62 | -Name $managementSwitchName ` 63 | -SwitchName $managementSwitchName ` 64 | -ErrorAction SilentlyContinue 65 | 66 | if ($null -eq $existingManagementAdapter) 67 | { 68 | $existingManagementAdapter = Add-VMNetworkAdapter ` 69 | -ManagementOS ` 70 | -Name $managementSwitchName ` 71 | -SwitchName $managementSwitchName ` 72 | -ErrorAction Stop 73 | } 74 | 75 | $existingManagementAdapterVlan = Get-VMNetworkAdapterVlan ` 76 | -VMNetworkAdapter $existingManagementAdapter 77 | 78 | $existingManagementVlan = $existingManagementAdapterVlan.AccessVlanId 79 | 80 | if ($existingManagementVlan -ne $requiredManagementVlan) 81 | { 82 | Write-LabMessage -Message $($LocalizedData.UpdatingLabManagementSwitchMessage ` 83 | -f $managementSwitchName, $requiredManagementVlan) 84 | 85 | Set-VMNetworkAdapterVlan ` 86 | -VMNetworkAdapter $existingManagementAdapter ` 87 | -Access ` 88 | -VlanId $requiredManagementVlan ` 89 | -ErrorAction Stop 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /source/Private/Initialize-LabVMPath.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Creates the folder structure that will contain a Lab Virtual Machine. 4 | 5 | .DESCRIPTION 6 | Creates a standard Hyper-V Virtual Machine folder structure as well as additional folders 7 | for containing configuration files for DSC. 8 | 9 | .PARAMETER vmpath 10 | The path to the folder where the Virtual Machine files are stored. 11 | 12 | .EXAMPLE 13 | Initialize-LabVMPath -VMPath 'c:\VMs\Lab\Virtual Machine 1' 14 | The command will create the Virtual Machine structure for a Lab VM in the folder: 15 | 'c:\VMs\Lab\Virtual Machine 1' 16 | 17 | .OUTPUTS 18 | None. 19 | #> 20 | function Initialize-LabVMPath 21 | { 22 | [CmdLetBinding()] 23 | param 24 | ( 25 | [Parameter(Mandatory = $true)] 26 | [ValidateNotNullOrEmpty()] 27 | [System.String] 28 | $VMPath 29 | ) 30 | 31 | if (-not (Test-Path -Path $VMPath)) 32 | { 33 | $null = New-Item ` 34 | -Path $VMPath ` 35 | -ItemType Directory 36 | } # if 37 | 38 | if (-not (Test-Path -Path "$VMPath\Virtual Machines")) 39 | { 40 | $null = New-Item ` 41 | -Path "$VMPath\Virtual Machines" ` 42 | -ItemType Directory 43 | } # if 44 | 45 | if (-not (Test-Path -Path "$VMPath\Virtual Hard Disks")) 46 | { 47 | $null = New-Item ` 48 | -Path "$VMPath\Virtual Hard Disks" ` 49 | -ItemType Directory 50 | } # if 51 | 52 | if (-not (Test-Path -Path "$VMPath\LabBuilder Files")) 53 | { 54 | $null = New-Item ` 55 | -Path "$VMPath\LabBuilder Files" ` 56 | -ItemType Directory 57 | } # if 58 | 59 | if (-not (Test-Path -Path "$VMPath\LabBuilder Files\DSC Modules")) 60 | { 61 | $null = New-Item ` 62 | -Path "$VMPath\LabBuilder Files\DSC Modules" ` 63 | -ItemType Directory 64 | } # if 65 | } 66 | -------------------------------------------------------------------------------- /source/Private/Install-LabHyperV.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Ensures the Hyper-V features are installed onto the system. 4 | 5 | .DESCRIPTION 6 | If the Hyper-V features are not installed onto this system they will be installed. 7 | 8 | .EXAMPLE 9 | Install-LabHyperV 10 | Installs the appropriate Hyper-V features if they are not currently installed. 11 | 12 | .OUTPUTS 13 | None 14 | #> 15 | function Install-LabHyperV 16 | { 17 | [CmdLetBinding()] 18 | param 19 | ( 20 | ) 21 | 22 | # Install Hyper-V Components 23 | if ((Get-CimInstance Win32_OperatingSystem).ProductType -eq 1) 24 | { 25 | # Desktop OS 26 | [Array] $feature = Get-WindowsOptionalFeature -Online -FeatureName '*Hyper-V*' ` 27 | | Where-Object -Property State -Eq 'Disabled' 28 | if ($feature.Count -gt 0 ) 29 | { 30 | Write-LabMessage -Message ($LocalizedData.InstallingHyperVComponentsMesage ` 31 | -f 'Desktop') 32 | $feature.Foreach( { 33 | Enable-WindowsOptionalFeature -Online -FeatureName $_.FeatureName 34 | } ) 35 | } 36 | } 37 | Else 38 | { 39 | # Server OS 40 | [Array] $feature = Get-WindowsFeature -Name Hyper-V ` 41 | | Where-Object -Property Installed -EQ $false 42 | if ($feature.Count -gt 0 ) 43 | { 44 | Write-LabMessage -Message ($LocalizedData.InstallingHyperVComponentsMesage ` 45 | -f 'Desktop') 46 | $feature.Foreach( { 47 | Install-WindowsFeature -IncludeAllSubFeature -IncludeManagementTools -Name $_.Name 48 | } ) 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source/Private/Install-LabPackageProvider.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Ensures the Package Providers required by LabBuilder are installed. 4 | 5 | .DESCRIPTION 6 | This function will check that both the NuGet and the PowerShellGet package 7 | providers are installed. 8 | If either of them are missing the function will attempt to install them. 9 | 10 | .EXAMPLE 11 | Install-LabPackageProvider 12 | Ensures the required Package Providers for LabBuilder are installed. 13 | 14 | .OUTPUTS 15 | None 16 | #> 17 | function Install-LabPackageProvider 18 | { 19 | [CmdLetBinding(SupportsShouldProcess = $true, 20 | ConfirmImpact = 'High')] 21 | param 22 | ( 23 | [Parameter()] 24 | [Switch] 25 | $Force 26 | ) 27 | 28 | $requiredPackageProviders = @('PowerShellGet', 'NuGet') 29 | $currentPackageProviders = Get-PackageProvider ` 30 | -ListAvailable ` 31 | -ErrorAction Stop 32 | 33 | foreach ($requiredPackageProvider in $requiredPackageProviders) 34 | { 35 | $packageProvider = $currentPackageProviders | 36 | Where-Object { $_.Name -eq $requiredPackageProvider } 37 | 38 | if (-not $packageProvider) 39 | { 40 | # The Package provider is not installed so install it 41 | if ($Force -or $PSCmdlet.ShouldProcess( 'LocalHost', ` 42 | ($LocalizedData.ShouldInstallPackageProvider ` 43 | -f $packageProvider ))) 44 | { 45 | Write-LabMessage -Message ($LocalizedData.InstallPackageProviderMessage ` 46 | -f $requiredPackageProvider) 47 | 48 | $null = Install-PackageProvider ` 49 | -Name $requiredPackageProvider ` 50 | -ForceBootstrap ` 51 | -Force ` 52 | -ErrorAction Stop 53 | } 54 | else 55 | { 56 | # Can't continue if the package provider is not installed. 57 | $exceptionParameters = @{ 58 | errorId = 'PackageProviderNotInstalledError' 59 | errorCategory = 'InvalidArgument' 60 | errorMessage = $($LocalizedData.PackageProviderNotInstalledError ` 61 | -f $requiredPackageProvider) 62 | } 63 | New-LabException @exceptionParameters 64 | } # if 65 | } # if 66 | } # foreach 67 | } 68 | -------------------------------------------------------------------------------- /source/Private/New-LabCredential.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Generates a credential object from a username and password. 4 | #> 5 | function New-LabCredential() 6 | { 7 | [CmdletBinding()] 8 | [OutputType([PSCredential])] 9 | param 10 | ( 11 | [Parameter(Mandatory = $true)] 12 | [ValidateNotNullOrEmpty()] 13 | [System.String] 14 | $Username, 15 | 16 | [Parameter(Mandatory = $true)] 17 | [ValidateNotNullOrEmpty()] 18 | [System.String] 19 | $Password 20 | ) 21 | 22 | $credential = New-Object ` 23 | -TypeName System.Management.Automation.PSCredential ` 24 | -ArgumentList ($Username, (ConvertTo-SecureString $Password -AsPlainText -Force)) 25 | 26 | return $credential 27 | } 28 | -------------------------------------------------------------------------------- /source/Private/New-LabException.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Throws a custom exception. 4 | 5 | .DESCRIPTION 6 | This cmdlet throws a terminating or non-terminating exception. 7 | 8 | .PARAMETER errorId 9 | The Id of the exception. 10 | 11 | .PARAMETER errorCategory 12 | The category of the exception. It must be a valid [System.Management.Automation.ErrorCategory] 13 | value. 14 | 15 | .PARAMETER errorMessage 16 | The exception message. 17 | 18 | .PARAMETER terminate 19 | This switch will cause the exception to terminate the cmdlet. 20 | 21 | .EXAMPLE 22 | $exceptionParameters = @{ 23 | errorId = 'ConnectionFailure' 24 | errorCategory = 'ConnectionError' 25 | errorMessage = 'Could not connect' 26 | } 27 | New-LabException @exceptionParameters 28 | Throw a ConnectionError exception with the message 'Could not connect'. 29 | 30 | .OUTPUTS 31 | None 32 | #> 33 | function New-LabException 34 | { 35 | [CmdLetBinding()] 36 | param 37 | ( 38 | [Parameter(Mandatory = $true)] 39 | [System.String] 40 | $ErrorId, 41 | 42 | [Parameter(Mandatory = $true)] 43 | [System.Management.Automation.ErrorCategory] 44 | $ErrorCategory, 45 | 46 | [Parameter(Mandatory = $true)] 47 | [System.String] 48 | $ErrorMessage, 49 | 50 | [Switch] 51 | $Terminate 52 | ) 53 | 54 | $exception = New-Object -TypeName System.Exception ` 55 | -ArgumentList $errorMessage 56 | $errorRecord = New-Object -TypeName System.Management.Automation.ErrorRecord ` 57 | -ArgumentList $exception, $errorId, $errorCategory, $null 58 | 59 | if ($Terminate) 60 | { 61 | # This is a terminating exception. 62 | throw $errorRecord 63 | } 64 | else 65 | { 66 | # Note: Although this method is called ThrowTerminatingError, it doesn't terminate. 67 | $PSCmdlet.ThrowTerminatingError($errorRecord) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /source/Private/Wait-LabVMOff.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Wait for VM to enter the Off state. 4 | 5 | .PARAMETER VM 6 | A LabVM object pulled from the Lab Configuration file using Get-LabVM. 7 | 8 | .OUTPUTS 9 | None. 10 | #> 11 | function Wait-LabVMOff 12 | { 13 | [CmdLetBinding()] 14 | param 15 | ( 16 | [Parameter(Mandatory = $true)] 17 | [LabVM] 18 | $VM 19 | ) 20 | 21 | $runningVM = Get-VM -Name $VM.Name 22 | while ($runningVM.State -ne 'Off') 23 | { 24 | $runningVM = Get-VM -Name $VM.Name 25 | Start-Sleep -Seconds $script:RetryHeartbeatSeconds 26 | } # while 27 | } 28 | -------------------------------------------------------------------------------- /source/Private/Wait-LabVMStarted.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Wait for the VM to enter the running state. 4 | 5 | .PARAMETER VM 6 | A LabVM object pulled from the Lab Configuration file using Get-LabVM 7 | 8 | .OUTPUTS 9 | None. 10 | #> 11 | function Wait-LabVMStarted 12 | { 13 | [CmdLetBinding()] 14 | param 15 | ( 16 | [Parameter(Mandatory = $true)] 17 | [LabVM] 18 | $VM 19 | ) 20 | 21 | # If the VM is not running then throw an exception 22 | if ((Get-VM -VMName $VM.Name).State -ne 'Running') { 23 | $exceptionParameters = @{ 24 | errorId = 'VMNotRunningHeartbeatMessage' 25 | errorCategory = 'InvalidArgument' 26 | errorMessage = $($LocalizedData.VMNotRunningHeartbeatMessage ` 27 | -f $VM.name) 28 | } 29 | New-LabException @exceptionParameters 30 | } # if 31 | 32 | # Names of IntegrationServices are not culture neutral, but have an ID 33 | $heartbeatCultureNeutral = ( Get-VMIntegrationService -VMName $VM.Name | Where-Object { $_.ID -match "84EAAE65-2F2E-45F5-9BB5-0E857DC8EB47" } ).Name 34 | $heartbeat = Get-VMIntegrationService -VMName $VM.Name -Name $heartbeatCultureNeutral 35 | 36 | while (($heartbeat.PrimaryStatusDescription -ne 'OK') -and (-not [System.String]::IsNullOrEmpty($heartbeat.PrimaryStatusDescription))) 37 | { 38 | $heartbeat = Get-VMIntegrationService -VMName $VM.Name -Name $heartbeatCultureNeutral 39 | 40 | Write-LabMessage -Message $($LocalizedData.WaitingForVMHeartbeatMessage ` 41 | -f $VM.Name,$script:RetryHeartbeatSeconds) 42 | 43 | Start-Sleep -Seconds $script:RetryHeartbeatSeconds 44 | } # while 45 | } 46 | -------------------------------------------------------------------------------- /source/Private/Write-LabMessage.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Writes a Message of the specified Type. 4 | 5 | .DESCRIPTION 6 | This cmdlet will write a message along with the time to the specified output stream. 7 | 8 | .PARAMETER Type 9 | This can be one of the following: 10 | Error - Writes to the Error Stream. 11 | Warning - Writes to the Warning Stream. 12 | Verbose - Writes to the Verbose Stream (default) 13 | Debug - Writes to the Debug Stream. 14 | Information - Writes to the Information Stream. 15 | Output - Writes to the Output Stream (so should be used for a terminating message) 16 | 17 | .PARAMETER Message 18 | The Message to output. 19 | 20 | .PARAMETER ForegroundColor 21 | The foreground color of the message if being writen to the output stream. 22 | 23 | .EXAMPLE 24 | Write-LabMessage -Type Verbose -Message 'Downloading file' 25 | New-LabException @exceptionParameters 26 | Outputs the message 'Downloading file' to the Verbose stream. 27 | 28 | .OUTPUTS 29 | None 30 | #> 31 | function Write-LabMessage 32 | { 33 | [CmdLetBinding()] 34 | param 35 | ( 36 | [Parameter()] 37 | [ValidateSet('Error', 'Warning', 'Verbose', 'Debug', 'Info', 'Alert')] 38 | [System.String] 39 | $Type = 'Verbose', 40 | 41 | [Parameter(Mandatory = $true)] 42 | [ValidateNotNullOrEmpty()] 43 | [System.String] 44 | $Message, 45 | 46 | [Parameter()] 47 | [System.String] 48 | $ForegroundColor = 'Yellow' 49 | ) 50 | 51 | $time = Get-Date -UFormat %T 52 | 53 | switch ($Type) 54 | { 55 | 'Error' 56 | { 57 | Write-Error -Message $Message 58 | break 59 | } 60 | 61 | 'Warning' 62 | { 63 | Write-Warning -Message ('[{0}]: {1}' -f $time, $Message) 64 | break 65 | } 66 | 67 | 'Verbose' 68 | { 69 | Write-Verbose -Message ('[{0}]: {1}' -f $time, $Message) 70 | break 71 | } 72 | 73 | 'Debug' 74 | { 75 | Write-Debug -Message ('[{0}]: {1}' -f $time, $Message) 76 | break 77 | } 78 | 79 | 'Info' 80 | { 81 | Write-Information -MessageData ('INFO: [{0}]: {1}' -f $time, $Message) 82 | break 83 | } 84 | 85 | 'Alert' 86 | { 87 | Write-Host ` 88 | -ForegroundColor $ForegroundColor ` 89 | -Object $Message 90 | break 91 | } 92 | } # switch 93 | } 94 | -------------------------------------------------------------------------------- /source/Public/Disconnect-LabVm.ps1: -------------------------------------------------------------------------------- 1 | function Disconnect-LabVM 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position=1, 8 | Mandatory=$true)] 9 | [LabVM] $VM 10 | ) 11 | 12 | $adminCredential = New-LabCredential ` 13 | -Username '.\Administrator' ` 14 | -Password $VM.AdministratorPassword 15 | 16 | # Get the Management IP Address of the VM 17 | $ipAddress = Get-LabVMManagementIPAddress ` 18 | -Lab $Lab ` 19 | -VM $VM 20 | 21 | try 22 | { 23 | # Look for the session 24 | $session = Get-PSSession ` 25 | -Name 'LabBuilder' ` 26 | -ComputerName $ipAddress ` 27 | -Credential $adminCredential ` 28 | -ErrorAction Stop 29 | 30 | if (-not $session) 31 | { 32 | # No session found to this machine so nothing to do. 33 | Write-LabMessage -Message $($LocalizedData.VMSessionDoesNotExistMessage ` 34 | -f $VM.Name) 35 | } 36 | else 37 | { 38 | if ($session.State -eq 'Opened') 39 | { 40 | # Disconnect the session 41 | $null = $session | Disconnect-PSSession 42 | Write-LabMessage -Message $($LocalizedData.DisconnectingVMMessage ` 43 | -f $VM.Name,$IPAddress) 44 | } 45 | # Remove the session 46 | $null = $session | Remove-PSSession -ErrorAction SilentlyContinue 47 | } 48 | } 49 | catch 50 | { 51 | Throw $_ 52 | } 53 | finally 54 | { 55 | # Remove the entry from TrustedHosts 56 | $trustedHosts = (Get-Item -Path WSMAN::localhost\Client\TrustedHosts).Value 57 | 58 | if (($trustedHosts -like "*$ipAddress*") -and ($trustedHosts -ne '*')) 59 | { 60 | $ipAddresses = @($trustedHosts -split ',') 61 | $trustedHosts = ($ipAddresses | Where-Object -FilterScript { 62 | $_ -ne $ipAddress 63 | }) -join ',' 64 | 65 | Set-Item ` 66 | -Path WSMAN::localhost\Client\TrustedHosts ` 67 | -Value $trustedHosts ` 68 | -Force 69 | Write-LabMessage -Message $($LocalizedData.RemovingIPAddressFromTrustedHostsMessage ` 70 | -f $VM.Name,$ipAddress) 71 | } 72 | } # try 73 | } # Disconnect-LabVM 74 | -------------------------------------------------------------------------------- /source/Public/Get-LabResourceIso.ps1: -------------------------------------------------------------------------------- 1 | function Get-LabResourceISO 2 | { 3 | [OutputType([LabResourceISO[]])] 4 | [CmdLetBinding()] 5 | param 6 | ( 7 | [Parameter( 8 | Position = 1, 9 | Mandatory = $true)] 10 | [ValidateNotNullOrEmpty()] 11 | $Lab, 12 | 13 | [Parameter( 14 | Position = 2)] 15 | [ValidateNotNullOrEmpty()] 16 | [System.String[]] 17 | $Name 18 | ) 19 | 20 | <# 21 | Determine the ISORootPath where the ISO files should be found. 22 | If no path is specified then look in the resource path. 23 | If a path is specified but it is relative, make it relative to the resource path. 24 | Otherwise use it as is. 25 | #> 26 | [System.String] $isoRootPath = $Lab.labbuilderconfig.Resources.ISOPath 27 | 28 | if ($isoRootPath) 29 | { 30 | $isoRootPath = ConvertTo-LabAbsolutePath -Path $isoRootPath ` 31 | -BasePath $Lab.labbuilderconfig.settings.resourcepathfull 32 | } 33 | else 34 | { 35 | $isoRootPath = $Lab.labbuilderconfig.settings.resourcepathfull 36 | } # if 37 | 38 | [LabResourceISO[]] $resourceISOs = @() 39 | 40 | if ($Lab.labbuilderconfig.resources) 41 | { 42 | foreach ($iso in $Lab.labbuilderconfig.resources.iso) 43 | { 44 | $isoName = $iso.Name 45 | 46 | if ($Name -and ($isoName -notin $Name)) 47 | { 48 | # A names list was passed but this ISO wasn't included 49 | continue 50 | } # if 51 | 52 | if ($isoName -eq 'iso') 53 | { 54 | $exceptionParameters = @{ 55 | errorId = 'ResourceISONameIsEmptyError' 56 | errorCategory = 'InvalidArgument' 57 | errorMessage = $($LocalizedData.ResourceISONameIsEmptyError) 58 | } 59 | New-LabException @exceptionParameters 60 | } # if 61 | 62 | $resourceISO = [LabResourceISO]::New($isoName) 63 | $path = $iso.Path 64 | 65 | if ($path) 66 | { 67 | $path = ConvertTo-LabAbsolutePath -Path $path -BasePath $isoRootPath 68 | } 69 | else 70 | { 71 | # A Path is not provided 72 | $exceptionParameters = @{ 73 | errorId = 'ResourceISOPathIsEmptyError' 74 | errorCategory = 'InvalidArgument' 75 | errorMessage = $($LocalizedData.ResourceISOPathIsEmptyError ` 76 | -f $isoName) 77 | } 78 | New-LabException @exceptionParameters 79 | } 80 | 81 | if ($iso.URL) 82 | { 83 | $resourceISO.URL = $iso.URL 84 | } # if 85 | 86 | $resourceISO.Path = $path 87 | $resourceISOs += @( $resourceISO ) 88 | } # foreach 89 | } # if 90 | 91 | return $resourceISOs 92 | } # Get-LabResourceISO 93 | -------------------------------------------------------------------------------- /source/Public/Get-LabResourceModule.ps1: -------------------------------------------------------------------------------- 1 | function Get-LabResourceModule 2 | { 3 | [OutputType([LabResourceModule[]])] 4 | [CmdLetBinding()] 5 | param 6 | ( 7 | [Parameter( 8 | Position = 1, 9 | Mandatory = $true)] 10 | [ValidateNotNullOrEmpty()] 11 | $Lab, 12 | 13 | [Parameter( 14 | Position = 2)] 15 | [ValidateNotNullOrEmpty()] 16 | [System.String[]] $Name 17 | ) 18 | 19 | [LabResourceModule[]] $ResourceModules = @() 20 | if ($Lab.labbuilderconfig.resources) 21 | { 22 | foreach ($Module in $Lab.labbuilderconfig.resources.module) 23 | { 24 | $ModuleName = $Module.Name 25 | if ($Name -and ($ModuleName -notin $Name)) 26 | { 27 | # A names list was passed but this Module wasn't included 28 | continue 29 | } # if 30 | 31 | if ($ModuleName -eq 'module') 32 | { 33 | $exceptionParameters = @{ 34 | errorId = 'ResourceModuleNameIsEmptyError' 35 | errorCategory = 'InvalidArgument' 36 | errorMessage = $($LocalizedData.ResourceModuleNameIsEmptyError) 37 | } 38 | New-LabException @exceptionParameters 39 | } # if 40 | $ResourceModule = [LabResourceModule]::New($ModuleName) 41 | $ResourceModule.URL = $Module.URL 42 | $ResourceModule.Folder = $Module.Folder 43 | $ResourceModule.MinimumVersion = $Module.MinimumVersion 44 | $ResourceModule.RequiredVersion = $Module.RequiredVersion 45 | $ResourceModules += @( $ResourceModule ) 46 | } # foreach 47 | } # if 48 | return $ResourceModules 49 | } # Get-LabResourceModule 50 | -------------------------------------------------------------------------------- /source/Public/Get-LabResourceMsu.ps1: -------------------------------------------------------------------------------- 1 | function Get-LabResourceMSU 2 | { 3 | [OutputType([LabResourceMSU[]])] 4 | [CmdLetBinding()] 5 | param 6 | ( 7 | [Parameter( 8 | Position = 1, 9 | Mandatory = $true)] 10 | [ValidateNotNullOrEmpty()] 11 | $Lab, 12 | 13 | [Parameter( 14 | Position = 2)] 15 | [ValidateNotNullOrEmpty()] 16 | [System.String[]] $Name 17 | ) 18 | 19 | [LabResourceMSU[]] $ResourceMSUs = @() 20 | if ($Lab.labbuilderconfig.resources) 21 | { 22 | foreach ($MSU in $Lab.labbuilderconfig.resources.msu) 23 | { 24 | $MSUName = $MSU.Name 25 | if ($Name -and ($MSUName -notin $Name)) 26 | { 27 | # A names list was passed but this MSU wasn't included 28 | continue 29 | } # if 30 | 31 | if ($MSUName -eq 'msu') 32 | { 33 | $exceptionParameters = @{ 34 | errorId = 'ResourceMSUNameIsEmptyError' 35 | errorCategory = 'InvalidArgument' 36 | errorMessage = $($LocalizedData.ResourceMSUNameIsEmptyError) 37 | } 38 | New-LabException @exceptionParameters 39 | } # if 40 | $ResourceMSU = [LabResourceMSU]::New($MSUName, $MSU.URL) 41 | $Path = $MSU.Path 42 | if ($Path) 43 | { 44 | if (-not [System.IO.Path]::IsPathRooted($Path)) 45 | { 46 | $Path = Join-Path ` 47 | -Path $Lab.labbuilderconfig.settings.resourcepathfull ` 48 | -ChildPath $Path 49 | } 50 | } 51 | else 52 | { 53 | $Path = $Lab.labbuilderconfig.settings.resourcepathfull 54 | } 55 | $FileName = Join-Path ` 56 | -Path $Path ` 57 | -ChildPath $MSU.URL.Substring($MSU.URL.LastIndexOf('/') + 1) 58 | $ResourceMSU.Path = $Path 59 | $ResourceMSU.Filename = $Filename 60 | $ResourceMSUs += @( $ResourceMSU ) 61 | } # foreach 62 | } # if 63 | return $ResourceMSUs 64 | } # Get-LabResourceMSU 65 | -------------------------------------------------------------------------------- /source/Public/Initialize-LabResourceIso.ps1: -------------------------------------------------------------------------------- 1 | function Initialize-LabResourceISO 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position = 1, 8 | Mandatory = $true)] 9 | [ValidateNotNullOrEmpty()] 10 | $Lab, 11 | 12 | [Parameter( 13 | Position = 2)] 14 | [ValidateNotNullOrEmpty()] 15 | [System.String[]] $Name, 16 | 17 | [Parameter( 18 | Position = 3)] 19 | [LabResourceISO[]] $ResourceISOs 20 | ) 21 | 22 | # if resource ISOs was not passed, pull it. 23 | if (-not $PSBoundParameters.ContainsKey('resourceisos')) 24 | { 25 | $ResourceMSUs = Get-LabResourceISO ` 26 | @PSBoundParameters 27 | } # if 28 | 29 | if ($ResourceISOs) 30 | { 31 | foreach ($ResourceISO in $ResourceISOs) 32 | { 33 | if (-not (Test-Path -Path $ResourceISO.Path)) 34 | { 35 | # The Resource ISO does not exist 36 | if (-not ($ResourceISO.URL)) 37 | { 38 | $exceptionParameters = @{ 39 | errorId = 'ResourceISOFileNotFoundAndNoURLError' 40 | errorCategory = 'InvalidArgument' 41 | errorMessage = $($LocalizedData.ResourceISOFileNotFoundAndNoURLError ` 42 | -f $ISOName, $Path) 43 | } 44 | New-LabException @exceptionParameters 45 | } # if 46 | 47 | $URLLeaf = [System.IO.Path]::GetFileName($ResourceISO.URL) 48 | $URLExtension = [System.IO.Path]::GetExtension($URLLeaf) 49 | if ($URLExtension -in @('.zip', '.iso')) 50 | { 51 | Write-LabMessage -Message $($LocalizedData.DownloadingResourceISOMessage ` 52 | -f $ResourceISO.Name, $ResourceISO.URL) 53 | 54 | Invoke-LabDownloadAndUnzipFile ` 55 | -URL $ResourceISO.URL ` 56 | -DestinationPath (Split-Path -Path $ResourceISO.Path) 57 | } 58 | elseif ([System.String]::IsNullOrEmpty($URLExtension)) 59 | { 60 | Write-LabMessage ` 61 | -Type Alert ` 62 | -Message $($LocalizedData.ISONotFoundDownloadURLMessage ` 63 | -f $ResourceISO.Name, $ResourceISO.Path, $ResourceISO.URL) 64 | } # if 65 | if (-not (Test-Path -Path $ResourceISO.Path)) 66 | { 67 | $exceptionParameters = @{ 68 | errorId = 'ResourceISOFileNotDownloadedError' 69 | errorCategory = 'InvalidArgument' 70 | errorMessage = $($LocalizedData.ResourceISOFileNotDownloadedError ` 71 | -f $ResourceISO.Name, $ResourceISO.Path, $ResourceISO.URL) 72 | } 73 | New-LabException @exceptionParameters 74 | } # if 75 | } # if 76 | } # foreach 77 | } # if 78 | } # Initialize-LabResourceISO 79 | -------------------------------------------------------------------------------- /source/Public/Initialize-LabResourceModule.ps1: -------------------------------------------------------------------------------- 1 | function Initialize-LabResourceModule 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position = 1, 8 | Mandatory = $true)] 9 | [ValidateNotNullOrEmpty()] 10 | $Lab, 11 | 12 | [Parameter( 13 | Position = 2)] 14 | [ValidateNotNullOrEmpty()] 15 | [System.String[]] $Name, 16 | 17 | [Parameter( 18 | Position = 3)] 19 | [LabResourceModule[]] $ResourceModules 20 | ) 21 | 22 | # if resource modules was not passed, pull it. 23 | if (-not $PSBoundParameters.ContainsKey('resourcemodules')) 24 | { 25 | $ResourceModules = Get-LabResourceModule ` 26 | @PSBoundParameters 27 | } 28 | 29 | if ($ResourceModules) 30 | { 31 | foreach ($Module in $ResourceModules) 32 | { 33 | $Splat = [PSObject] @{ Name = $Module.Name } 34 | if ($Module.URL) 35 | { 36 | $Splat += [PSObject] @{ URL = $Module.URL } 37 | } 38 | if ($Module.Folder) 39 | { 40 | $Splat += [PSObject] @{ Folder = $Module.Folder } 41 | } 42 | if ($Module.RequiredVersion) 43 | { 44 | $Splat += [PSObject] @{ RequiredVersion = $Module.RequiredVersion } 45 | } 46 | if ($Module.MiniumVersion) 47 | { 48 | $Splat += [PSObject] @{ MiniumVersion = $Module.MiniumVersion } 49 | } 50 | 51 | Write-LabMessage -Message $($LocalizedData.DownloadingResourceModuleMessage ` 52 | -f $Name, $URL) 53 | 54 | Invoke-LabDownloadResourceModule @Splat 55 | } # foreach 56 | } # if 57 | } # Initialize-LabResourceModule 58 | -------------------------------------------------------------------------------- /source/Public/Initialize-LabResourceMsu.ps1: -------------------------------------------------------------------------------- 1 | function Initialize-LabResourceMSU 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position = 1, 8 | Mandatory = $true)] 9 | [ValidateNotNullOrEmpty()] 10 | $Lab, 11 | 12 | [Parameter( 13 | Position = 2)] 14 | [ValidateNotNullOrEmpty()] 15 | [System.String[]] $Name, 16 | 17 | [Parameter( 18 | Position = 3)] 19 | [LabResourceMSU[]] $ResourceMSUs 20 | ) 21 | 22 | # if resource MSUs was not passed, pull it. 23 | if (-not $PSBoundParameters.ContainsKey('resourcemsus')) 24 | { 25 | $ResourceMSUs = Get-LabResourceMSU ` 26 | @PSBoundParameters 27 | } 28 | 29 | if ($ResourceMSUs) 30 | { 31 | foreach ($MSU in $ResourceMSUs) 32 | { 33 | if (-not (Test-Path -Path $MSU.Filename)) 34 | { 35 | Write-LabMessage -Message $($LocalizedData.DownloadingResourceMSUMessage ` 36 | -f $MSU.Name, $MSU.URL) 37 | 38 | Invoke-LabDownloadAndUnzipFile ` 39 | -URL $MSU.URL ` 40 | -DestinationPath (Split-Path -Path $MSU.Filename) 41 | } # if 42 | } # foreach 43 | } # if 44 | } # Initialize-LabResourceMSU 45 | -------------------------------------------------------------------------------- /source/Public/Install-LabVm.ps1: -------------------------------------------------------------------------------- 1 | function Install-LabVM 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position=1, 8 | Mandatory=$true)] 9 | [ValidateNotNullOrEmpty()] 10 | $Lab, 11 | 12 | [Parameter( 13 | Position=2)] 14 | [ValidateNotNullOrEmpty()] 15 | [LabVM] $VM 16 | ) 17 | 18 | [System.String] $LabPath = $Lab.labbuilderconfig.settings.labpath 19 | 20 | # The VM is now ready to be started 21 | if ((Get-VM -Name $VM.Name).State -eq 'Off') 22 | { 23 | Write-LabMessage -Message $($LocalizedData.StartingVMMessage ` 24 | -f $VM.Name) 25 | 26 | Start-VM -VMName $VM.Name 27 | } # if 28 | 29 | # We only perform this section of VM Initialization (DSC, Cert, etc) with Server OS 30 | if ($VM.DSC.ConfigFile) 31 | { 32 | # Has this VM been initialized before (do we have a cert for it) 33 | if (-not (Test-Path "$LabPath\$($VM.Name)\LabBuilder Files\$script:DSCEncryptionCert")) 34 | { 35 | # No, so check it is initialized and download the cert if required 36 | if (Wait-LabVMInitializationComplete -VM $VM -ErrorAction Continue) 37 | { 38 | Write-LabMessage -Message $($LocalizedData.CertificateDownloadStartedMessage ` 39 | -f $VM.Name) 40 | 41 | if ($VM.CertificateSource -eq [LabCertificateSource]::Guest) 42 | { 43 | if (Recieve-LabSelfSignedCertificate -Lab $Lab -VM $VM) 44 | { 45 | Write-LabMessage -Message $($LocalizedData.CertificateDownloadCompleteMessage ` 46 | -f $VM.Name) 47 | } 48 | else 49 | { 50 | $exceptionParameters = @{ 51 | errorId = 'CertificateDownloadError' 52 | errorCategory = 'InvalidArgument' 53 | errorMessage = $($LocalizedData.CertificateDownloadError ` 54 | -f $VM.name) 55 | } 56 | New-LabException @exceptionParameters 57 | } # if 58 | } # if 59 | } 60 | else 61 | { 62 | $exceptionParameters = @{ 63 | errorId = 'InitializationDidNotCompleteError' 64 | errorCategory = 'InvalidArgument' 65 | errorMessage = $($LocalizedData.InitializationDidNotCompleteError ` 66 | -f $VM.name) 67 | } 68 | New-LabException @exceptionParameters 69 | } # if 70 | } # if 71 | 72 | if ($VM.OSType -in ([LabOStype]::Nano)) 73 | { 74 | # Copy ODJ Files if it Exists 75 | Copy-LabOdjFile ` 76 | -Lab $Lab ` 77 | -VM $VM 78 | } # if 79 | 80 | # Create any DSC Files for the VM 81 | Initialize-LabDSC ` 82 | -Lab $Lab ` 83 | -VM $VM 84 | 85 | # Attempt to start DSC on the VM 86 | Start-LabDSC ` 87 | -Lab $Lab ` 88 | -VM $VM 89 | } # if 90 | } # Install-LabVM 91 | -------------------------------------------------------------------------------- /source/Public/Remove-LabVMTemplate.ps1: -------------------------------------------------------------------------------- 1 | function Remove-LabVMTemplate 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position = 1, 8 | Mandatory = $true)] 9 | [ValidateNotNullOrEmpty()] 10 | $Lab, 11 | 12 | [Parameter( 13 | Position = 2)] 14 | [ValidateNotNullOrEmpty()] 15 | [System.String[]] $Name, 16 | 17 | [Parameter( 18 | Position = 3)] 19 | [LabVMTemplate[]] $VMTemplates 20 | ) 21 | 22 | # if VMTeplates array not passed, pull it from config. 23 | if (-not $PSBoundParameters.ContainsKey('VMTemplates')) 24 | { 25 | $VMTemplates = Get-LabVMTemplate ` 26 | @PSBoundParameters 27 | } # if 28 | foreach ($VMTemplate in $VMTemplates) 29 | { 30 | if ($Name -and ($VMTemplate.Name -notin $Name)) 31 | { 32 | # A names list was passed but this VM Template wasn't included 33 | continue 34 | } # if 35 | 36 | if (Test-Path $VMTemplate.ParentVhd) 37 | { 38 | Set-ItemProperty ` 39 | -Path $VMTemplate.parentvhd ` 40 | -Name IsReadOnly ` 41 | -Value $false 42 | Write-LabMessage -Message $($LocalizedData.DeletingParentVHDMessage ` 43 | -f $VMTemplate.ParentVhd) 44 | Remove-Item ` 45 | -Path $VMTemplate.ParentVhd ` 46 | -Confirm:$false ` 47 | -Force 48 | } # if 49 | } # foreach 50 | } 51 | -------------------------------------------------------------------------------- /source/Public/Remove-LabVm.ps1: -------------------------------------------------------------------------------- 1 | function Remove-LabVM 2 | { 3 | [CmdLetBinding()] 4 | param 5 | ( 6 | [Parameter( 7 | Position=1, 8 | Mandatory=$true)] 9 | [ValidateNotNullOrEmpty()] 10 | $Lab, 11 | 12 | [Parameter( 13 | Position=2)] 14 | [ValidateNotNullOrEmpty()] 15 | [System.String[]] $Name, 16 | 17 | [Parameter( 18 | Position=3)] 19 | [LabVM[]] $VMs, 20 | 21 | [Parameter( 22 | Position=4)] 23 | [Switch] $RemoveVMFolder 24 | ) 25 | 26 | # if VMs array not passed, pull it from config. 27 | if (-not $PSBoundParameters.ContainsKey('VMs')) 28 | { 29 | $null = $PSBoundParameters.Remove('RemoveVMFolder') 30 | [LabVM[]] $VMs = Get-LabVM ` 31 | @PSBoundParameters 32 | } # if 33 | 34 | $CurrentVMs = Get-VM 35 | 36 | # Get the LabPath 37 | [System.String] $LabPath = $Lab.labbuilderconfig.settings.labpath 38 | 39 | foreach ($VM in $VMs) 40 | { 41 | if ($Name -and ($VM.Name -notin $Name)) 42 | { 43 | # A names list was passed but this VM wasn't included 44 | continue 45 | } # if 46 | 47 | if (($CurrentVMs | Where-Object -Property Name -eq $VM.Name).Count -ne 0) 48 | { 49 | # if the VM is running we need to shut it down. 50 | if ((Get-VM -Name $VM.Name).State -eq 'Running') 51 | { 52 | Write-LabMessage -Message $($LocalizedData.StoppingVMMessage ` 53 | -f $VM.Name) 54 | 55 | Stop-VM ` 56 | -Name $VM.Name 57 | # Wait for it to completely shut down and report that it is off. 58 | Wait-LabVMOff ` 59 | -VM $VM 60 | } 61 | 62 | Write-LabMessage -Message $($LocalizedData.RemovingVMMessage ` 63 | -f $VM.Name) 64 | 65 | # Now delete the actual VM 66 | Get-VM ` 67 | -Name $VM.Name | Remove-VM -Force -Confirm:$false 68 | 69 | Write-LabMessage -Message $($LocalizedData.RemovedVMMessage ` 70 | -f $VM.Name) 71 | } 72 | else 73 | { 74 | Write-LabMessage -Message $($LocalizedData.VMNotFoundMessage ` 75 | -f $VM.Name) 76 | } 77 | } 78 | # Should we remove the VM Folder? 79 | if ($RemoveVMFolder) 80 | { 81 | if (Test-Path -Path $VM.VMRootPath) 82 | { 83 | Write-LabMessage -Message $($LocalizedData.DeletingVMFolderMessage ` 84 | -f $VM.Name) 85 | 86 | Remove-Item ` 87 | -Path $VM.VMRootPath ` 88 | -Recurse ` 89 | -Force 90 | } 91 | } 92 | } # Remove-LabVM 93 | -------------------------------------------------------------------------------- /source/Public/Remove-LabVmTemplateVhd.ps1: -------------------------------------------------------------------------------- 1 | function Remove-LabVMTemplateVHD 2 | { 3 | param 4 | ( 5 | [Parameter( 6 | Position = 1, 7 | Mandatory = $true)] 8 | [ValidateNotNullOrEmpty()] 9 | $Lab, 10 | 11 | [Parameter( 12 | Position = 2)] 13 | [ValidateNotNullOrEmpty()] 14 | [System.String[]] $Name, 15 | 16 | [Parameter( 17 | Position = 3)] 18 | [LabVMTemplateVHD[]] $VMTemplateVHDs 19 | ) 20 | 21 | # if VMTeplateVHDs array not passed, pull it from config. 22 | if (-not $PSBoundParameters.ContainsKey('VMTemplateVHDs')) 23 | { 24 | [LabVMTemplateVHD[]] $VMTemplateVHDs = Get-LabVMTemplateVHD ` 25 | @PSBoundParameters 26 | } # if 27 | 28 | # if there are no VMTemplateVHDs just return 29 | if ($null -eq $VMTemplateVHDs) 30 | { 31 | return 32 | } # if 33 | 34 | [System.String] $LabPath = $Lab.labbuilderconfig.settings.labpath 35 | 36 | foreach ($VMTemplateVHD in $VMTemplateVHDs) 37 | { 38 | [System.String] $TemplateVHDName = $VMTemplateVHD.Name 39 | if ($Name -and ($TemplateVHDName -notin $Name)) 40 | { 41 | # A names list was passed but this VM Template VHD wasn't included 42 | continue 43 | } # if 44 | 45 | [System.String] $VHDPath = $VMTemplateVHD.VHDPath 46 | 47 | if (Test-Path -Path ($VHDPath)) 48 | { 49 | Remove-Item ` 50 | -Path $VHDPath ` 51 | -Force 52 | Write-LabMessage -Message $($LocalizedData.DeletingVMTemplateVHDFileMessage ` 53 | -f $TemplateVHDName, $VHDPath) 54 | } # if 55 | } # endfor 56 | } # Remove-LabVMTemplateVHD 57 | -------------------------------------------------------------------------------- /source/Public/Update-Lab.ps1: -------------------------------------------------------------------------------- 1 | function Update-Lab 2 | { 3 | [CmdLetBinding(DefaultParameterSetName="Lab")] 4 | param 5 | ( 6 | [parameter( 7 | Position=1, 8 | ParameterSetName="File", 9 | Mandatory=$true)] 10 | [ValidateNotNullOrEmpty()] 11 | [System.String] $ConfigPath, 12 | 13 | [parameter( 14 | Position=2, 15 | ParameterSetName="File")] 16 | [ValidateNotNullOrEmpty()] 17 | [System.String] $LabPath, 18 | 19 | [Parameter( 20 | Position=3, 21 | ParameterSetName="Lab", 22 | Mandatory=$true, 23 | ValueFromPipeline=$true)] 24 | [ValidateNotNullOrEmpty()] 25 | $Lab 26 | ) # Param 27 | 28 | begin 29 | { 30 | if ($PSCmdlet.ParameterSetName -eq 'File') 31 | { 32 | # Read the configuration 33 | $Lab = Get-Lab ` 34 | @PSBoundParameters 35 | } # if 36 | } # begin 37 | 38 | process 39 | { 40 | Install-Lab ` 41 | @PSBoundParameters 42 | 43 | Write-LabMessage -Message $($LocalizedData.LabUpdateCompleteMessage ` 44 | -f $Lab.labbuilderconfig.name,$Lab.labbuilderconfig.settings.fullconfigpath) 45 | } # process 46 | 47 | end 48 | { 49 | } # end 50 | } # Update-Lab 51 | -------------------------------------------------------------------------------- /source/build.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | Path = 'LabBuilder.psd1' #or build breaks on Linux 3 | } 4 | # Waiting for ModuleBuilder to do away with this file 5 | # when all parameters are provided to the function 6 | 7 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_AADC.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_AADC 5 | .Desription 6 | Builds a Server that is joined to a domain and installs Azure Active Directory Connect on it. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_AADC 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 9.1.0 19 | 20 | Node $AllNodes.NodeName { 21 | # Assemble the Local Admin Credentials 22 | if ($Node.LocalAdminPassword) 23 | { 24 | $LocalAdminCredential = New-Object ` 25 | -TypeName System.Management.Automation.PSCredential ` 26 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 27 | } 28 | 29 | if ($Node.DomainAdminPassword) 30 | { 31 | $DomainAdminCredential = New-Object ` 32 | -TypeName System.Management.Automation.PSCredential ` 33 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 34 | } 35 | 36 | WaitForAll DC 37 | { 38 | ResourceName = '[ADDomain]PrimaryDC' 39 | NodeName = $Node.DCname 40 | RetryIntervalSec = 15 41 | RetryCount = 60 42 | } 43 | 44 | Computer JoinDomain 45 | { 46 | Name = $Node.NodeName 47 | DomainName = $Node.DomainName 48 | Credential = $DomainAdminCredential 49 | DependsOn = '[WaitForAll]DC' 50 | } 51 | 52 | xMsiPackage InstallAzureADConnect 53 | { 54 | ProductId = '{1454BE23-6C31-46DE-ABCB-A3FD413F98C9}' 55 | Path = 'https://download.microsoft.com/download/B/0/0/B00291D0-5A83-4DE7-86F5-980BC00DE05A/AzureADConnect.msi' 56 | Ensure = 'Present' 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_ADFS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_ADFS 5 | .Desription 6 | Builds a Server that is joined to a domain and then made into an ADFS Server using WID. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_ADFS 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | 19 | Node $AllNodes.NodeName { 20 | # Assemble the Local Admin Credentials 21 | if ($Node.LocalAdminPassword) 22 | { 23 | $LocalAdminCredential = New-Object ` 24 | -TypeName System.Management.Automation.PSCredential ` 25 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 26 | } 27 | 28 | if ($Node.DomainAdminPassword) 29 | { 30 | $DomainAdminCredential = New-Object ` 31 | -TypeName System.Management.Automation.PSCredential ` 32 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 33 | } 34 | 35 | WindowsFeature WIDInstall 36 | { 37 | Ensure = 'Present' 38 | Name = 'Windows-Internal-Database' 39 | } 40 | 41 | WindowsFeature ADFSInstall 42 | { 43 | Ensure = 'Present' 44 | Name = 'ADFS-Federation' 45 | DependsOn = '[WindowsFeature]WIDInstall' 46 | } 47 | 48 | WaitForAll DC 49 | { 50 | ResourceName = '[ADDomain]PrimaryDC' 51 | NodeName = $Node.DCname 52 | RetryIntervalSec = 15 53 | RetryCount = 60 54 | } 55 | 56 | Computer JoinDomain 57 | { 58 | Name = $Node.NodeName 59 | DomainName = $Node.DomainName 60 | Credential = $DomainAdminCredential 61 | DependsOn = '[WaitForAll]DC' 62 | } 63 | 64 | # Enable ADFS FireWall rules 65 | Firewall ADFSFirewall1 66 | { 67 | Name = 'ADFSSrv-HTTP-In-TCP' 68 | Ensure = 'Present' 69 | Enabled = 'True' 70 | } 71 | 72 | Firewall ADFSFirewall2 73 | { 74 | Name = 'ADFSSrv-HTTPS-In-TCP' 75 | Ensure = 'Present' 76 | Enabled = 'True' 77 | } 78 | 79 | Firewall ADFSFirewall3 80 | { 81 | Name = 'ADFSSrv-SmartcardAuthN-HTTPS-In-TCP' 82 | Ensure = 'Present' 83 | Enabled = 'True' 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_ADRMS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_ADRMS 5 | .Desription 6 | Builds a Server that is joined to a domain and then made into an ADRMS Server. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ADFSSupport = $true 13 | ###################################################################################################> 14 | 15 | Configuration MEMBER_ADRMS 16 | { 17 | Import-DscResource -ModuleName PSDesiredStateConfiguration 18 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 19 | 20 | Node $AllNodes.NodeName { 21 | # Assemble the Local Admin Credentials 22 | if ($Node.LocalAdminPassword) 23 | { 24 | $LocalAdminCredential = New-Object ` 25 | -TypeName System.Management.Automation.PSCredential ` 26 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 27 | } 28 | 29 | if ($Node.DomainAdminPassword) 30 | { 31 | $DomainAdminCredential = New-Object ` 32 | -TypeName System.Management.Automation.PSCredential ` 33 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 34 | } 35 | 36 | WindowsFeature WIDInstall 37 | { 38 | Ensure = 'Present' 39 | Name = 'Windows-Internal-Database' 40 | } 41 | 42 | WindowsFeature ADRMSServerInstall 43 | { 44 | Ensure = 'Present' 45 | Name = 'ADRMS-Server' 46 | DependsOn = '[WindowsFeature]WIDInstall' 47 | } 48 | 49 | if ($Node.ADFSSupport) 50 | { 51 | WindowsFeature ADRMSIdentityInstall 52 | { 53 | Ensure = 'Present' 54 | Name = 'ADRMS-Identity' 55 | DependsOn = '[WindowsFeature]ADRMSServerInstall' 56 | } 57 | } 58 | 59 | WaitForAll DC 60 | { 61 | ResourceName = '[ADDomain]PrimaryDC' 62 | NodeName = $Node.DCname 63 | RetryIntervalSec = 15 64 | RetryCount = 60 65 | } 66 | 67 | Computer JoinDomain 68 | { 69 | Name = $Node.NodeName 70 | DomainName = $Node.DomainName 71 | Credential = $DomainAdminCredential 72 | DependsOn = '[WaitForAll]DC' 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_BRANCHCACHE_HOST.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_BRANCHCACHE_HOST 5 | .Desription 6 | Builds a Server that is joined to a domain and then made into a BranchCache Hosted Mode Server. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_BRANCHCACHE_HOST 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | Import-DscResource -ModuleName StorageDsc 19 | Import-DscResource -ModuleName NetworkingDsc 20 | 21 | Node $AllNodes.NodeName { 22 | # Assemble the Local Admin Credentials 23 | if ($Node.LocalAdminPassword) 24 | { 25 | $LocalAdminCredential = New-Object ` 26 | -TypeName System.Management.Automation.PSCredential ` 27 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 28 | } 29 | 30 | if ($Node.DomainAdminPassword) 31 | { 32 | $DomainAdminCredential = New-Object ` 33 | -TypeName System.Management.Automation.PSCredential ` 34 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 35 | } 36 | 37 | WindowsFeature BranchCache 38 | { 39 | Ensure = 'Present' 40 | Name = 'BranchCache' 41 | } 42 | 43 | # Wait for the Domain to be available so we can join it. 44 | WaitForAll DC 45 | { 46 | ResourceName = '[ADDomain]PrimaryDC' 47 | NodeName = $Node.DCname 48 | RetryIntervalSec = 15 49 | RetryCount = 60 50 | } 51 | 52 | # Join this Server to the Domain 53 | Computer JoinDomain 54 | { 55 | Name = $Node.NodeName 56 | DomainName = $Node.DomainName 57 | Credential = $DomainAdminCredential 58 | DependsOn = '[WaitForAll]DC' 59 | } 60 | 61 | # Enable BranchCache Hosted Mode Firewall Fules 62 | Firewall FSRMFirewall1 63 | { 64 | Name = 'Microsoft-Windows-PeerDist-HostedServer-In' 65 | Ensure = 'Present' 66 | Enabled = 'True' 67 | } 68 | 69 | Firewall FSRMFirewall2 70 | { 71 | Name = 'Microsoft-Windows-PeerDist-HostedServer-Out' 72 | Ensure = 'Present' 73 | Enabled = 'True' 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_DEFAULT.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_DEFAULT 5 | .Desription 6 | Builds a Server that is joined to a domain. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_DEFAULT 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | 19 | Node $AllNodes.NodeName { 20 | # Assemble the Local Admin Credentials 21 | if ($Node.LocalAdminPassword) 22 | { 23 | $LocalAdminCredential = New-Object ` 24 | -TypeName System.Management.Automation.PSCredential ` 25 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 26 | } 27 | 28 | if ($Node.DomainAdminPassword) 29 | { 30 | $DomainAdminCredential = New-Object ` 31 | -TypeName System.Management.Automation.PSCredential ` 32 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 33 | } 34 | 35 | WaitForAll DC 36 | { 37 | ResourceName = '[ADDomain]PrimaryDC' 38 | NodeName = $Node.DCname 39 | RetryIntervalSec = 15 40 | RetryCount = 60 41 | } 42 | 43 | Computer JoinDomain 44 | { 45 | Name = $Node.NodeName 46 | DomainName = $Node.DomainName 47 | Credential = $DomainAdminCredential 48 | DependsOn = '[WaitForAll]DC' 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_DFSSPOKE.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_DFSSPOKE 5 | .Desription 6 | Builds a Server that is joined to a domain and then made into a Spoke for a DFS Hub and Spoke 7 | replication group. 8 | .Parameters: 9 | DomainName = 'LABBUILDER.COM' 10 | DomainAdminPassword = 'P@ssword!1' 11 | DCName = 'SA-DC1' 12 | PSDscAllowDomainUser = $true 13 | ###################################################################################################> 14 | 15 | Configuration MEMBER_DFSSPOKE 16 | { 17 | Import-DscResource -ModuleName PSDesiredStateConfiguration 18 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 19 | Import-DscResource -ModuleName DFSDsc 20 | Import-DscResource -ModuleName StorageDsc 21 | Import-DscResource -ModuleName NetworkingDsc 22 | 23 | Node $AllNodes.NodeName { 24 | # Assemble the Admin Credentials 25 | if ($Node.DomainAdminPassword) 26 | { 27 | $DomainAdminCredential = New-Object ` 28 | -TypeName System.Management.Automation.PSCredential ` 29 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 30 | } 31 | 32 | WindowsFeature FileServerInstall 33 | { 34 | Ensure = 'Present' 35 | Name = 'FS-FileServer' 36 | } 37 | 38 | WindowsFeature DFSNameSpaceInstall 39 | { 40 | Ensure = 'Present' 41 | Name = 'FS-DFS-Namespace' 42 | DependsOn = '[WindowsFeature]FileServerInstall' 43 | } 44 | 45 | WindowsFeature DFSReplicationInstall 46 | { 47 | Ensure = 'Present' 48 | Name = 'FS-DFS-Replication' 49 | DependsOn = '[WindowsFeature]DFSNameSpaceInstall' 50 | } 51 | 52 | # Wait for the Domain to be available so we can join it. 53 | WaitForAll DC 54 | { 55 | ResourceName = '[ADDomain]PrimaryDC' 56 | NodeName = $Node.DCname 57 | RetryIntervalSec = 15 58 | RetryCount = 60 59 | } 60 | 61 | # Join this Server to the Domain 62 | Computer JoinDomain 63 | { 64 | Name = $Node.NodeName 65 | DomainName = $Node.DomainName 66 | Credential = $DomainAdminCredential 67 | DependsOn = '[WaitForAll]DC' 68 | } 69 | 70 | WaitforDisk Disk2 71 | { 72 | DiskId = 1 73 | RetryIntervalSec = 60 74 | RetryCount = 60 75 | DependsOn = '[Computer]JoinDomain' 76 | } 77 | 78 | Disk DVolume 79 | { 80 | DiskId = 1 81 | DriveLetter = 'D' 82 | DependsOn = '[WaitforDisk]Disk2' 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_DNS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_DNS 5 | .Desription 6 | Builds a Server that is joined to a domain and then made into a DNS Server. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | InstallRSATTools = $true 13 | Forwarders = @('8.8.8.8','8.8.4.4') 14 | PrimaryZones = @( 15 | @{ Name = 'BRAVO.LOCAL'; 16 | ZoneFile = 'bravo.local.dns'; 17 | DynamicUpdate = 'None'; 18 | } 19 | ) 20 | ###################################################################################################> 21 | 22 | Configuration MEMBER_DNS 23 | { 24 | Import-DscResource -ModuleName PSDesiredStateConfiguration 25 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 26 | Import-DscResource -ModuleName xDNSServer -ModuleVersion 1.16.0.0 27 | 28 | Node $AllNodes.NodeName { 29 | # Assemble the Admin Credentials 30 | if ($Node.DomainAdminPassword) 31 | { 32 | $DomainAdminCredential = New-Object ` 33 | -TypeName System.Management.Automation.PSCredential ` 34 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 35 | } 36 | 37 | WindowsFeature DNSInstall 38 | { 39 | Ensure = 'Present' 40 | Name = 'DNS' 41 | } 42 | 43 | if ($InstallRSATTools) 44 | { 45 | WindowsFeature RSAT-ManagementTools 46 | { 47 | Ensure = 'Present' 48 | Name = 'RSAT-DNS-Server' 49 | DependsOn = '[WindowsFeature]DNSInstall' 50 | } 51 | } 52 | 53 | WaitForAll DC 54 | { 55 | ResourceName = '[ADDomain]PrimaryDC' 56 | NodeName = $Node.DCname 57 | RetryIntervalSec = 15 58 | RetryCount = 60 59 | } 60 | 61 | Computer JoinDomain 62 | { 63 | Name = $Node.NodeName 64 | DomainName = $Node.DomainName 65 | Credential = $DomainAdminCredential 66 | DependsOn = '[WaitForAll]DC' 67 | } 68 | 69 | # DNS Server Settings 70 | if ($Node.Forwarders) 71 | { 72 | xDnsServerForwarder DNSForwarders 73 | { 74 | IsSingleInstance = 'Yes' 75 | IPAddresses = $Node.Forwarders 76 | DependsOn = '[Computer]JoinDomain' 77 | } 78 | } 79 | $count = 0 80 | foreach ($PrimaryZone in $Node.PrimaryZones) 81 | { 82 | $count++ 83 | xDnsServerPrimaryZone "PrimaryZone$count" 84 | { 85 | Ensure = 'Present' 86 | Name = $PrimaryZone.Name 87 | ZoneFile = $PrimaryZone.ZoneFile 88 | DynamicUpdate = $PrimaryZone.DynamicUpdate 89 | DependsOn = '[Computer]JoinDomain' 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_IPAM.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_IPAM 5 | .Desription 6 | Builds a Server that is joined to a domain and then made into an IPAM Server. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_IPAM 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | 19 | Node $AllNodes.NodeName { 20 | # Assemble the Admin Credentials 21 | if ($Node.DomainAdminPassword) 22 | { 23 | $DomainAdminCredential = New-Object ` 24 | -TypeName System.Management.Automation.PSCredential ` 25 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 26 | } 27 | 28 | WindowsFeature WIDInstall 29 | { 30 | Ensure = 'Present' 31 | Name = 'Windows-Internal-Database' 32 | } 33 | 34 | WindowsFeature IPAMInstall 35 | { 36 | Ensure = 'Present' 37 | Name = 'IPAM' 38 | DependsOn = '[WindowsFeature]WIDInstall' 39 | } 40 | 41 | WaitForAll DC 42 | { 43 | ResourceName = '[ADDomain]PrimaryDC' 44 | NodeName = $Node.DCname 45 | RetryIntervalSec = 15 46 | RetryCount = 60 47 | } 48 | 49 | Computer JoinDomain 50 | { 51 | Name = $Node.NodeName 52 | DomainName = $Node.DomainName 53 | Credential = $DomainAdminCredential 54 | DependsOn = '[WaitForAll]DC' 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_NANO.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_NANO 5 | .Desription 6 | Builds a Nano Server and joins it to a Domain using an ODJ Request File. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ODJRequestFile = 'C:\ODJRequest.txt' 13 | ###################################################################################################> 14 | 15 | Configuration MEMBER_NANO 16 | { 17 | Import-DscResource -ModuleName PSDesiredStateConfiguration 18 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 19 | 20 | Node $AllNodes.NodeName { 21 | WaitForAll DC 22 | { 23 | ResourceName = '[ADDomain]PrimaryDC' 24 | NodeName = $Node.DCname 25 | RetryIntervalSec = 15 26 | RetryCount = 60 27 | } 28 | 29 | OfflineDomainJoin JoinDomain 30 | { 31 | IsSingleInstance = 'Yes' 32 | RequestFile = $Node.ODJRequestFile 33 | DependsOn = '[WaitForAll]DC' 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_NLB.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_NLB 5 | .Desription 6 | Builds a Network Load Balancing cluster node. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_NLB 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | Import-DscResource -ModuleName xPSDesiredStateConfiguration 19 | 20 | Node $AllNodes.NodeName { 21 | # Assemble the Admin Credentials 22 | if ($Node.DomainAdminPassword) 23 | { 24 | $DomainAdminCredential = New-Object ` 25 | -TypeName System.Management.Automation.PSCredential ` 26 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 27 | } 28 | 29 | 30 | WindowsFeature InstallWebServer 31 | { 32 | Ensure = 'Present' 33 | Name = 'Web-Server' 34 | } 35 | 36 | WindowsFeature InstallWebMgmtService 37 | { 38 | Ensure = 'Present' 39 | Name = 'Web-Mgmt-Service' 40 | } 41 | 42 | WindowsFeature InstallNLB 43 | { 44 | Ensure = 'Present' 45 | Name = 'NLB' 46 | } 47 | 48 | # Wait for the Domain to be available so we can join it. 49 | WaitForAll DC 50 | { 51 | ResourceName = '[ADDomain]PrimaryDC' 52 | NodeName = $Node.DCname 53 | RetryIntervalSec = 15 54 | RetryCount = 60 55 | } 56 | 57 | # Join this Server to the Domain 58 | Computer JoinDomain 59 | { 60 | Name = $Node.NodeName 61 | DomainName = $Node.DomainName 62 | Credential = $DomainAdminCredential 63 | DependsOn = '[WaitForAll]DC' 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_NPS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_NPS 5 | .Desription 6 | Builds a Server that is joined to a domain and then contains NPS/Radius components. 7 | .Requires 8 | Windows Server 2012 R2 Full (Server core not supported). 9 | .Parameters: 10 | DomainName = 'LABBUILDER.COM' 11 | DomainAdminPassword = 'P@ssword!1' 12 | DCName = 'SA-DC1' 13 | PSDscAllowDomainUser = $true 14 | ###################################################################################################> 15 | 16 | Configuration MEMBER_NPS 17 | { 18 | Import-DscResource -ModuleName PSDesiredStateConfiguration 19 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 20 | 21 | Node $AllNodes.NodeName { 22 | # Assemble the Admin Credentials 23 | if ($Node.DomainAdminPassword) 24 | { 25 | $DomainAdminCredential = New-Object ` 26 | -TypeName System.Management.Automation.PSCredential ` 27 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 28 | } 29 | 30 | WindowsFeature NPASPolicyServerInstall 31 | { 32 | Ensure = 'Present' 33 | Name = 'NPAS-Policy-Server' 34 | } 35 | 36 | WindowsFeature NPASHealthInstall 37 | { 38 | Ensure = 'Present' 39 | Name = 'NPAS-Health' 40 | DependsOn = '[WindowsFeature]NPASPolicyServerInstall' 41 | } 42 | 43 | WindowsFeature RSATNPAS 44 | { 45 | Ensure = 'Present' 46 | Name = 'RSAT-NPAS' 47 | DependsOn = '[WindowsFeature]NPASPolicyServerInstall' 48 | } 49 | 50 | # Wait for the Domain to be available so we can join it. 51 | WaitForAll DC 52 | { 53 | ResourceName = '[ADDomain]PrimaryDC' 54 | NodeName = $Node.DCname 55 | RetryIntervalSec = 15 56 | RetryCount = 60 57 | } 58 | 59 | # Join this Server to the Domain 60 | Computer JoinDomain 61 | { 62 | Name = $Node.NodeName 63 | DomainName = $Node.DomainName 64 | Credential = $DomainAdminCredential 65 | DependsOn = '[WaitForAll]DC' 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_REMOTEACCESS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_REMOTEACCESS 5 | .Desription 6 | Builds a Server that is joined to a domain and then contains Remote Access components. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_REMOTEACCESS 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | 19 | Node $AllNodes.NodeName { 20 | # Assemble the Admin Credentials 21 | if ($Node.DomainAdminPassword) 22 | { 23 | $DomainAdminCredential = New-Object ` 24 | -TypeName System.Management.Automation.PSCredential ` 25 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 26 | } 27 | 28 | WindowsFeature DirectAccessVPNInstall 29 | { 30 | Ensure = 'Present' 31 | Name = 'DirectAccess-VPN' 32 | } 33 | 34 | WindowsFeature RoutingInstall 35 | { 36 | Ensure = 'Present' 37 | Name = 'Routing' 38 | DependsOn = '[WindowsFeature]DirectAccessVPNInstall' 39 | } 40 | 41 | # Wait for the Domain to be available so we can join it. 42 | WaitForAll DC 43 | { 44 | ResourceName = '[ADDomain]PrimaryDC' 45 | NodeName = $Node.DCname 46 | RetryIntervalSec = 15 47 | RetryCount = 60 48 | } 49 | 50 | # Join this Server to the Domain 51 | Computer JoinDomain 52 | { 53 | Name = $Node.NodeName 54 | DomainName = $Node.DomainName 55 | Credential = $DomainAdminCredential 56 | DependsOn = '[WaitForAll]DC' 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_REMOTEACCESS_WAP.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_REMOTEACCESS_WAP 5 | .Desription 6 | Builds a Server that is joined to a domain and then contains Remote Access and 7 | Web Application Proxy components. 8 | .Parameters: 9 | DomainName = 'LABBUILDER.COM' 10 | DomainAdminPassword = 'P@ssword!1' 11 | DCName = 'SA-DC1' 12 | PSDscAllowDomainUser = $true 13 | ###################################################################################################> 14 | 15 | Configuration MEMBER_REMOTEACCESS_WAP 16 | { 17 | Import-DscResource -ModuleName PSDesiredStateConfiguration 18 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 19 | 20 | Node $AllNodes.NodeName { 21 | # Assemble the Admin Credentials 22 | if ($Node.DomainAdminPassword) 23 | { 24 | $DomainAdminCredential = New-Object ` 25 | -TypeName System.Management.Automation.PSCredential ` 26 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 27 | } 28 | 29 | WindowsFeature DirectAccessVPNInstall 30 | { 31 | Ensure = 'Present' 32 | Name = 'DirectAccess-VPN' 33 | } 34 | 35 | WindowsFeature RoutingInstall 36 | { 37 | Ensure = 'Present' 38 | Name = 'Routing' 39 | DependsOn = '[WindowsFeature]DirectAccessVPNInstall' 40 | } 41 | 42 | WindowsFeature WebApplicationProxyInstall 43 | { 44 | Ensure = 'Present' 45 | Name = 'Web-Application-Proxy' 46 | DependsOn = '[WindowsFeature]RoutingInstall' 47 | } 48 | 49 | # Wait for the Domain to be available so we can join it. 50 | WaitForAll DC 51 | { 52 | ResourceName = '[ADDomain]PrimaryDC' 53 | NodeName = $Node.DCname 54 | RetryIntervalSec = 15 55 | RetryCount = 60 56 | } 57 | 58 | # Join this Server to the Domain 59 | Computer JoinDomain 60 | { 61 | Name = $Node.NodeName 62 | DomainName = $Node.DomainName 63 | Credential = $DomainAdminCredential 64 | DependsOn = '[WaitForAll]DC' 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_WAC.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_WAC 5 | .Desription 6 | Builds a Server that is joined to a domain and then installs Windows Admin Center. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | WacSslCertThumbprint = '' # Thumbprint of the SSL Certificate to use the WAC site. If not specified will generate one. 13 | Port = 6516 # The port number to install the WAC site on. If not specified will default to 6516 14 | ###################################################################################################> 15 | 16 | Configuration MEMBER_WAC 17 | { 18 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 19 | Import-DscResource -ModuleName xPSDesiredStateConfiguration -ModuleVersion 9.1.0 20 | 21 | Node $AllNodes.NodeName { 22 | # Assemble the Domain Admin Credential 23 | if ($Node.DomainAdminPassword) 24 | { 25 | $domainAdminCredential = New-Object ` 26 | -TypeName System.Management.Automation.PSCredential ` 27 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 28 | } 29 | 30 | $wacInstallArguments = '/qn /l*v c:\windows\temp\windowsadmincenter.msiinstall.log' 31 | 32 | if ($null -ne $Node.Port) { 33 | $wacInstallArguments = '{0} SME_PORT={1}' -f $wacInstallArguments, $Node.Port 34 | } 35 | 36 | if ([System.String]::IsNullOrEmpty($Node.WacSslCertThumbprint)) 37 | { 38 | $wacInstallArguments = '{0} SSL_CERTIFICATE_OPTION=generate' -f $wacInstallArguments 39 | } 40 | else 41 | { 42 | $wacInstallArguments = '{0} SME_THUMBPRINT={1}' -f $wacInstallArguments, $Node.WacSslCertThumbprint 43 | } 44 | 45 | # Wait for the Domain to be available so we can join it. 46 | WaitForAll DC 47 | { 48 | ResourceName = '[ADDomain]PrimaryDC' 49 | NodeName = $Node.DCname 50 | RetryIntervalSec = 15 51 | RetryCount = 60 52 | } 53 | 54 | # Join this Server to the Domain 55 | Computer JoinDomain 56 | { 57 | Name = $Node.NodeName 58 | DomainName = $Node.DomainName 59 | Credential = $domainAdminCredential 60 | DependsOn = '[WaitForAll]DC' 61 | } 62 | 63 | xMsiPackage InstallWindowsAdminCenter 64 | { 65 | ProductId = '{4FAE3A2E-4369-490E-97F3-0B3BFF183AB9}' 66 | Path = 'https://download.microsoft.com/download/1/0/5/1059800B-F375-451C-B37E-758FFC7C8C8B/WindowsAdminCenter1809.5.msi' 67 | Arguments = $wacInstallArguments 68 | Ensure = 'Present' 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_WDS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_WDS 5 | .Desription 6 | Builds a Server that is joined to a domain and then installs WSUS components. 7 | .Parameters: 8 | DomainName = 'LABBUILDER.COM' 9 | DomainAdminPassword = 'P@ssword!1' 10 | DCName = 'SA-DC1' 11 | PSDscAllowDomainUser = $true 12 | ###################################################################################################> 13 | 14 | Configuration MEMBER_WDS 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 18 | Import-DscResource -ModuleName StorageDsc 19 | 20 | Node $AllNodes.NodeName { 21 | # Assemble the Local Admin Credentials 22 | if ($Node.LocalAdminPassword) 23 | { 24 | $LocalAdminCredential = New-Object ` 25 | -TypeName System.Management.Automation.PSCredential ` 26 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 27 | } 28 | 29 | if ($Node.DomainAdminPassword) 30 | { 31 | $DomainAdminCredential = New-Object ` 32 | -TypeName System.Management.Automation.PSCredential ` 33 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 34 | } 35 | 36 | WindowsFeature WDSDeploymentInstall 37 | { 38 | Ensure = 'Present' 39 | Name = 'WDS-Deployment' 40 | } 41 | 42 | WindowsFeature WDSTransportInstall 43 | { 44 | Ensure = 'Present' 45 | Name = 'WDS-Transport' 46 | DependsOn = '[WindowsFeature]WDSDeploymentInstall' 47 | } 48 | 49 | WindowsFeature BitLockerNetworkUnlockInstall 50 | { 51 | Ensure = 'Present' 52 | Name = 'BitLocker-NetworkUnlock' 53 | DependsOn = '[WindowsFeature]WDSTransportInstall' 54 | } 55 | 56 | # Wait for the Domain to be available so we can join it. 57 | WaitForAll DC 58 | { 59 | ResourceName = '[ADDomain]PrimaryDC' 60 | NodeName = $Node.DCname 61 | RetryIntervalSec = 15 62 | RetryCount = 60 63 | } 64 | 65 | # Join this Server to the Domain 66 | Computer JoinDomain 67 | { 68 | Name = $Node.NodeName 69 | DomainName = $Node.DomainName 70 | Credential = $DomainAdminCredential 71 | DependsOn = '[WaitForAll]DC' 72 | } 73 | 74 | WaitforDisk Disk2 75 | { 76 | DiskId = 1 77 | RetryIntervalSec = 60 78 | RetryCount = 60 79 | DependsOn = '[Computer]JoinDomain' 80 | } 81 | 82 | Disk DVolume 83 | { 84 | DiskId = 1 85 | DriveLetter = 'D' 86 | DependsOn = '[WaitforDisk]Disk2' 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /source/dsclibrary/MEMBER_WSUS.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_WSUS 5 | .Desription 6 | Builds a Server that is joined to a domain and then installs WSUS components. 7 | Requires cMicrosoftUpdate resource from https://github.com/fabiendibot/cMicrosoftUpdate 8 | .Parameters: 9 | DomainName = 'LABBUILDER.COM' 10 | DomainAdminPassword = 'P@ssword!1' 11 | DCName = 'SA-DC1' 12 | PSDscAllowDomainUser = $true 13 | ###################################################################################################> 14 | 15 | Configuration MEMBER_WSUS 16 | { 17 | Import-DscResource -ModuleName PSDesiredStateConfiguration 18 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 19 | Import-DscResource -ModuleName xWindowsUpdate 20 | Import-DscResource -ModuleName StorageDsc 21 | 22 | Node $AllNodes.NodeName { 23 | # Assemble the Local Admin Credentials 24 | if ($Node.LocalAdminPassword) 25 | { 26 | $LocalAdminCredential = New-Object ` 27 | -TypeName System.Management.Automation.PSCredential ` 28 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 29 | } 30 | 31 | if ($Node.DomainAdminPassword) 32 | { 33 | $DomainAdminCredential = New-Object ` 34 | -TypeName System.Management.Automation.PSCredential ` 35 | -ArgumentList ("$($Node.DomainName)\Administrator", (ConvertTo-SecureString $Node.DomainAdminPassword -AsPlainText -Force)) 36 | } 37 | 38 | WindowsFeature UpdateServicesWIDDBInstall 39 | { 40 | Ensure = 'Present' 41 | Name = 'UpdateServices-WidDB' 42 | } 43 | 44 | WindowsFeature UpdateServicesServicesInstall 45 | { 46 | Ensure = 'Present' 47 | Name = 'UpdateServices-Services' 48 | DependsOn = '[WindowsFeature]UpdateServicesWIDDBInstall' 49 | } 50 | 51 | # Wait for the Domain to be available so we can join it. 52 | WaitForAll DC 53 | { 54 | ResourceName = '[ADDomain]PrimaryDC' 55 | NodeName = $Node.DCname 56 | RetryIntervalSec = 15 57 | RetryCount = 60 58 | } 59 | 60 | # Join this Server to the Domain 61 | Computer JoinDomain 62 | { 63 | Name = $Node.NodeName 64 | DomainName = $Node.DomainName 65 | Credential = $DomainAdminCredential 66 | DependsOn = '[WaitForAll]DC' 67 | } 68 | 69 | WaitforDisk Disk2 70 | { 71 | DiskId = 1 72 | RetryIntervalSec = 60 73 | RetryCount = 60 74 | DependsOn = '[Computer]JoinDomain' 75 | } 76 | 77 | Disk DVolume 78 | { 79 | DiskId = 1 80 | DriveLetter = 'D' 81 | DependsOn = '[WaitforDisk]Disk2' 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /source/dsclibrary/STANDALONE_DEFAULT.DSC.ps1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | STANDALONE_DEFAULT 5 | .Desription 6 | Builds a Standalone computer with no additional DSC resources. 7 | .Parameters: 8 | ###################################################################################################> 9 | 10 | Configuration STANDALONE_DEFAULT 11 | { 12 | Import-DscResource -ModuleName PSDesiredStateConfiguration 13 | 14 | Node $AllNodes.NodeName { 15 | # Assemble the Local Admin Credentials 16 | if ($Node.LocalAdminPassword) 17 | { 18 | $LocalAdminCredential = New-Object ` 19 | -TypeName System.Management.Automation.PSCredential ` 20 | -ArgumentList ('Administrator', (ConvertTo-SecureString $Node.LocalAdminPassword -AsPlainText -Force)) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/LabDSCResources.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xCertAuthorityServer.DSC.Schema.psm1 2 | RootModule=xDC.DSC.Schema.psm1 3 | RootModule=xDHCPServer.DSC.Schema.psm1 4 | RootModule=xFileServer.DSC.Schema.psm1 5 | RootModule=xJoinDomain.DSC.Schema.psm1 6 | RootModule=xNPSServer.DSC.Schema.psm1 7 | RootModule=xRemoteAccessServer.DSC.Schema.psm1 8 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xCertAuthorityServer/xCertAuthorityServer.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xCertAuthorityServer.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xDC/xDC.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xDC.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xDHCPServer/xDHCPServer.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xDHCPServer.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xFileServer/xFileServer.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xFileServer.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xJoinDomain/xJoinDomain.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xJoindomain.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xJoinDomain/xJoinDomain.DSC.Schema.psm1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | Join Domain DSC Module 5 | .Desription 6 | Joins Server to Domain 7 | .Parameters: 8 | DomainName = "LABBUILDER.COM" 9 | DomainAdminPassword = "P@ssword!1" 10 | ComputerName = "Server01" 11 | DomainControllerName = "DC01" 12 | ###################################################################################################> 13 | 14 | Configuration JOINDOMAIN 15 | { 16 | Param 17 | ( 18 | # Set the Domain Name 19 | [Parameter(Mandatory=$true,Position=1)] 20 | [System.String] 21 | $DomainName, 22 | 23 | 24 | # Set the Domain Controller Name 25 | [Parameter(Mandatory=$true)] 26 | [System.String] 27 | $DCName, 28 | 29 | # Domain Administrator Credentials 30 | [Parameter(Mandatory=$true)] 31 | [System.String] 32 | $DomainAdminPassword, 33 | 34 | # Set the Computer Name 35 | [Parameter(Mandatory=$true)] 36 | [System.String] 37 | $ComputerName 38 | 39 | 40 | 41 | ) 42 | 43 | Import-DscResource -ModuleName PSDesiredStateConfiguration 44 | Import-DscResource -ModuleName ComputerManagementDsc -ModuleVersion 7.1.0.0 45 | Import-DscResource -ModuleName NetworkingDsc 46 | 47 | # Assemble the Local Admin Credentials 48 | if ($LocalAdminPassword) { 49 | [PSCredential]$LocalAdminCredential = New-Object System.Management.Automation.PSCredential ("Administrator", (ConvertTo-SecureString $LocalAdminPassword -AsPlainText -Force)) 50 | } 51 | if ($Node.DomainAdminPassword) { 52 | [PSCredential]$DomainAdminCredential = New-Object System.Management.Automation.PSCredential ("$DomainName\Administrator", (ConvertTo-SecureString $DomainAdminPassword -AsPlainText -Force)) 53 | } 54 | 55 | WaitForAll DC 56 | { 57 | ResourceName = '[ADDomain]CreateDC' 58 | NodeName = $DCname 59 | RetryIntervalSec = 15 60 | RetryCount = 60 61 | } 62 | 63 | 64 | Computer JoinDomain 65 | { 66 | Name = $ComputerName 67 | DomainName = $DomainName 68 | Credential = $DomainAdminCredential 69 | DependsOn = "[WaitForAll]DC" 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xNPSServer/xNPSServer.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xNPSServer.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xNPSServer/xNPSServer.DSC.Schema.psm1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_NPS 5 | .Desription 6 | Builds a Server that is joined to a domain and then contains NPS/Radius components. 7 | .Requires 8 | Windows Server 2012 R2 Full (Server core not supported). 9 | .Parameters: 10 | DomainName = "LABBUILDER.COM" 11 | DomainAdminPassword = "P@ssword!1" 12 | ###################################################################################################> 13 | 14 | Configuration NPS 15 | { 16 | Import-DscResource -ModuleName PSDesiredStateConfiguration 17 | 18 | 19 | WindowsFeature NPASPolicyServerInstall 20 | { 21 | Ensure = "Present" 22 | Name = "NPAS-Policy-Server" 23 | } 24 | 25 | WindowsFeature NPASHealthInstall 26 | { 27 | Ensure = "Present" 28 | Name = "NPAS-Health" 29 | DependsOn = "[WindowsFeature]NPASPolicyServerInstall" 30 | } 31 | 32 | WindowsFeature RSATNPAS 33 | { 34 | Ensure = "Present" 35 | Name = "RSAT-NPAS" 36 | DependsOn = "[WindowsFeature]NPASPolicyServerInstall" 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xRemoteAccessServer/xRemoteAccessServer.DSC.Schema.psd1: -------------------------------------------------------------------------------- 1 | RootModule=xRemoteAccessServer.DSC.Schema.psm1 2 | -------------------------------------------------------------------------------- /source/dsclibrary/modules/MyDSCResources/xRemoteAccessServer/xRemoteAccessServer.DSC.Schema.psm1: -------------------------------------------------------------------------------- 1 | <################################################################################################### 2 | DSC Template Configuration File For use by LabBuilder 3 | .Title 4 | MEMBER_EDGE 5 | .Desription 6 | Builds a Server that is joined to a domain and then contains Remote Access components. 7 | .Parameters: 8 | DomainName = "LABBUILDER.COM" 9 | DomainAdminPassword = "P@ssword!1" 10 | ###################################################################################################> 11 | 12 | Configuration REMOTEACCESS 13 | { 14 | Import-DscResource -ModuleName PSDesiredStateConfiguration 15 | 16 | 17 | WindowsFeature DirectAccessVPNInstall 18 | { 19 | Ensure = "Present" 20 | Name = "DirectAccess-VPN" 21 | } 22 | 23 | WindowsFeature RoutingInstall 24 | { 25 | Ensure = "Present" 26 | Name = "Routing" 27 | DependsOn = "[WindowsFeature]DirectAccessVPNInstall" 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /source/en-US/about_LabBuilder.help.txt: -------------------------------------------------------------------------------- 1 | TOPIC 2 | about_LabBuilder 3 | 4 | SHORT DESCRIPTION 5 | Builds Hyper-V Windows multi-machine/Active Directory labs using XML 6 | configuration files and DSC Resources. 7 | 8 | LONG DESCRIPTION 9 | This module provides cmdlets for building Hyper-V Windows multi-machine/Active 10 | Directory labs using XML configuration files and DSC Resources. 11 | 12 | EXAMPLES 13 | PS C:\> Get-Command -Module LabBuilder 14 | 15 | TROUBLESHOOTING NOTE: 16 | Go to the Github repository for read about issues, submit a new issue, and read 17 | about new releases. https://github.com/PlagueHO/LabBuilder 18 | 19 | SEE ALSO 20 | - https://github.com/PlagueHO/LabBuilder 21 | 22 | KEYWORDS 23 | Hyper-V, Lab, DesiredStateConfiguration, DSC 24 | 25 | -------------------------------------------------------------------------------- /source/samples/Sample_WS2016_Simple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | Sample Windows Server 2016 Lab Configuration Simple 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 41 | 42 | 43 | 44 |