Git Product home page Git Product logo

labmodule's Introduction

LabModule

A Powershell module for easy deployment of test environments in Hyper-V.
The purpose of the module is to limit time spent building test environments.
With this module you can create virtual switches, VMs, domains and join said VMs to it, among other things with just one button.


Requirements


Instructions

  1. Download a VHD copy of Windows Server and ideally place it in this folder.

  2. Create a VM and run through the installation process manually for the VHD.

    Import-Module ".\LabModule.psm1"
    Build-LabVM -Name "Template" -TemplateVHD ".\lab_img.vhd"

    This will create a VM called Template with a VHD called Template.VHD

  3. When you're finished you can either turn the machine off or sysprep it.
    (If you intend to create a domain for example, you need to sysprep to avoid SID conflicts)

    • Create a folder under C:\ called sysprep and then a sysprep.xml file inside that folder
    • Copy the contents from sysprep.xml onto the newly created sysprep.xml
    • Open an elevated command prompt and run the following to initiate Sysprep

      %WINDIR%\system32\sysprep\sysprep.exe /generalize /shutdown /oobe /mode:vm /unattend:C:\sysprep\sysprep.xml

    • Once done, the machine will have turned off. See next step to proceed.
  4. Once the machine is completely off, it's important to merge the VHD with its most recent checkpoint, if you have any.

    • Open Hyper-V and click on Edit Disk. Search for the latest avhd or avhdx file associated with our newly created Template.VHD
    • Click next and click on Merge and then choose to merge it to Template.VHD
  5. You can now import the module and use as is, or edit the config.psd1 file and make a more comprehensive test environment

    • Read through config.psd1 and make any changes you would like.
    • See LabModule.psm1 or use Get-Help on any command for more documentation if unsure.
  6. When you are satisfied with your config.psd1 file, run init.ps1 to create your lab environment.


LabModule.psm1

This file is the module itself and holds most of the functionality, but also documentation.
Read through this file if you require any help.


config.psd1

This file is used to configure a more comprehensive test environment and to be paired with init.ps1


init.ps1

This file reads config.psd1 and creates the test environment


labmodule's People

Contributors

daky60 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.