diff --git a/Configurations/PowerShellLab/Instructions.md b/Configurations/PowerShellLab/Instructions.md index 77c6c53..186d334 100644 --- a/Configurations/PowerShellLab/Instructions.md +++ b/Configurations/PowerShellLab/Instructions.md @@ -38,7 +38,7 @@ You could use this configuration that calls for a simple domain environment. To run the full lab setup, which includes Setup-Lab, Run-Lab, Enable-Internet, and Validate-Lab. You should run all commands from the directory with the MOF and psd1 files. -```powershell +```shell PS> Unattend-Lab ``` @@ -46,31 +46,31 @@ To run the commands individually to setup the lab environment: Run the following for initial setup: -```powershell +```shell PS> Setup-Lab ``` To start the Lab, and apply configurations the first time: -```powershell +```shell PS> Run-Lab ``` To enable Internet access for the VMs, run: -```powershell +```shell PS> Enable-Internet ``` To validate when configurations have converged: -```powershell +```shell PS> Validate-Lab ``` Or you can run the Pester test directly -```powershell +```shell PS> Invoke-Pester vmvalidate.test.ps1 ``` @@ -78,19 +78,19 @@ PS> Invoke-Pester vmvalidate.test.ps1 To stop the lab VMs: -```powershell +```shell PS> Shutdown-lab ``` To checkpoint the VMs: -```powershell +```shell PS> Snapshot-Lab ``` To quickly rebuild the labs from the checkpoint, run: -```powershell +```shell PS> Refresh-Lab ``` @@ -98,13 +98,13 @@ PS> Refresh-Lab If you want to make sure the virtual machines have the latest updates from Microsoft, you can run this command: -```powershell +```shell PS> Update-Lab ``` Because this may take some time to run, you can also run it as a background job. -```powershell +```shell PS> Update-Lab -AsJob ``` @@ -112,13 +112,13 @@ PS> Update-Lab -AsJob To destroy the lab to build again run: -```powershell +```shell PS> Wipe-Lab ``` You will be prompted for each virtual machine. Or you can force the removal and suppress the prompts: -```powershell +```shell PS> Wipe-Lab -force ``` diff --git a/Configurations/PowerShellLab/PostSetup/README.md b/Configurations/PowerShellLab/PostSetup/README.md index f4d3970..0f31408 100644 --- a/Configurations/PowerShellLab/PostSetup/README.md +++ b/Configurations/PowerShellLab/PostSetup/README.md @@ -4,7 +4,7 @@ The PowerShell scripts in this directory can be run after the lab setup is compl Usage of these scripts is completely optional and are provided for your convenience. You may elect to manually accomplish these tasks from the PostSetup folder. For any installations to the Windows 10 client, you should launch an interactive session first to the virtual machine with the credential you intend to use to force a profile creation. -```powershell +```shell vmconnect localhost Win10 ``` @@ -12,13 +12,13 @@ vmconnect localhost Win10 Use this script to download the SysInternals suite from Microsoft. All of the files will be stored in a new folder, `C:\Sysinternals`. It is assumed you will only need to run this for the client virtual machine. -```powerShell +```shell .\Install-SysInternals -VMName win10 -credential company\administrator ``` If you already have an existing PSSession to the virtual machine you can use that instead: -```powershell +```shell .\Install-SysInternals -session $sess ``` @@ -26,7 +26,7 @@ If you already have an existing PSSession to the virtual machine you can use tha This script will download the current Windows version of the git setup file. The file will be saved to the root of C:\. You will need to manually setup and configure git in the virtual machine. -```powershell +```shell .\Download-Git -VMName win10 -Credential company\artd ``` @@ -36,7 +36,7 @@ If you already have an existing PSSession to the virtual machine you can use tha This script will download and install the current version of Visual Studio Code. The file will be saved to the root of C:\. It is assumed you will run this for the client virtual machine. -```powershell +```shell .\Install-VSCode -VMName win10 -credential company\aprils ``` @@ -47,7 +47,7 @@ Once installed, you can logon as and finish configuration such as installing the If you want to restart all of the virtual machines, use a command like this: -```powershell +```shell Get-VM Dom1,Srv*,Win10 | Stop-VM -force -passthru | Start-VM -passthru ``` diff --git a/Configurations/SingleServer-2022/Instructions.md b/Configurations/SingleServer-2022/Instructions.md index e223fa6..abbe2ff 100644 --- a/Configurations/SingleServer-2022/Instructions.md +++ b/Configurations/SingleServer-2022/Instructions.md @@ -14,7 +14,7 @@ Administrator password is P@ssw0rd. To run the full lab setup, which includes Setup-Lab, Run-Lab, Enable-Internet, and Validate-Lab. You should run all commands from the directory with the MOF and psd1 files. -```powershell +```shell PS> Unattend-Lab ``` @@ -22,31 +22,31 @@ To run the commands individually to setup the lab environment: Run the following for initial setup: -```powershell +```shell PS> Setup-Lab ``` To start the Lab, and apply configurations the first time: -```powershell +```shell PS> Run-Lab ``` To enable Internet access for the VMs, run: -```powershell +```shell PS> Enable-Internet ``` To validate when configurations have converged: -```powershell +```shell PS> Validate-Lab ``` Or you can run the Pester test directly -```powershell +```shell PS> Invoke-Pester vmvalidate.test.ps1 ``` @@ -54,19 +54,19 @@ PS> Invoke-Pester vmvalidate.test.ps1 To stop the lab VMs: -```powershell +```shell PS> Shutdown-lab ``` To checkpoint the VMs: -```powershell +```shell PS> Snapshot-Lab ``` To quickly rebuild the labs from the checkpoint, run: -```powershell +```shell PS> Refresh-Lab ``` @@ -74,13 +74,13 @@ PS> Refresh-Lab If you want to make sure the virtual machines have the latest updates from Microsoft, you can run this command: -```powershell +```shell PS> Update-Lab ``` Because this may take some time to run, you can also run it as a background job. -```powershell +```shell PS> Update-Lab -AsJob ``` @@ -88,12 +88,12 @@ PS> Update-Lab -AsJob To destroy the lab to build again run: -```powershell +```shell PS> Wipe-Lab ``` You will be prompted for each virtual machine. Or you can force the removal and suppress the prompts: -```powershell +```shell PS> Wipe-Lab -force ``` diff --git a/Configurations/SingleServer/Instructions.md b/Configurations/SingleServer/Instructions.md index 5434962..429db64 100644 --- a/Configurations/SingleServer/Instructions.md +++ b/Configurations/SingleServer/Instructions.md @@ -14,7 +14,7 @@ Administrator password is P@ssw0rd. To run the full lab setup, which includes Setup-Lab, Run-Lab, Enable-Internet, and Validate-Lab. You should run all commands from the directory with the MOF and psd1 files. -```powershell +```shell PS> Unattend-Lab ``` @@ -22,31 +22,31 @@ To run the commands individually to setup the lab environment: Run the following for initial setup: -```powershell +```shell PS> Setup-Lab ``` To start the Lab, and apply configurations the first time: -```powershell +```shell PS> Run-Lab ``` To enable Internet access for the VMs, run: -```powershell +```shell PS> Enable-Internet ``` To validate when configurations have converged: -```powershell +```shell PS> Validate-Lab ``` Or you can run the Pester test directly -```powershell +```shell PS> Invoke-Pester vmvalidate.test.ps1 ``` @@ -54,19 +54,19 @@ PS> Invoke-Pester vmvalidate.test.ps1 To stop the lab VMs: -```powershell +```shell PS> Shutdown-lab ``` To checkpoint the VMs: -```powershell +```shell PS> Snapshot-Lab ``` To quickly rebuild the labs from the checkpoint, run: -```powershell +```shell PS> Refresh-Lab ``` @@ -74,13 +74,13 @@ PS> Refresh-Lab If you want to make sure the virtual machines have the latest updates from Microsoft, you can run this command: -```powershell +```shell PS> Update-Lab ``` Because this may take some time to run, you can also run it as a background job. -```powershell +```shell PS> Update-Lab -AsJob ``` @@ -88,12 +88,12 @@ PS> Update-Lab -AsJob To destroy the lab to build again run: -```powershell +```shell PS> Wipe-Lab ``` You will be prompted for each virtual machine. Or you can force the removal and suppress the prompts: -```powershell +```shell PS> Wipe-Lab -force ``` diff --git a/Detailed-Setup-Instructions.md b/Detailed-Setup-Instructions.md index 20c0fad..cc1dedf 100644 --- a/Detailed-Setup-Instructions.md +++ b/Detailed-Setup-Instructions.md @@ -12,7 +12,7 @@ You can run these commands to verify your computer meets the minimum requirement ### Operating System and Memory -```text +```shell PS C:\> Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -property Caption, @{Name="MemoryGB";Expression={$_.TotalVisibleMemorySize/1mb -as [int]}} @@ -26,7 +26,7 @@ If the Caption shows anything other than Pro or Enterprise this module may not w The memory size should be at least 12GB. 16GB or greater is recommended. If the number is less than 12, **STOP**. It is unlikely you have enough installed memory. Depending on the configuration you want to run, it *might* be possible to proceed with less memory. Open an Issue and ask for guidance indicating your memory settings from this command: -```text +```shell PS C:\> Get-CimInstance Win32_OperatingSystem | Select-Object -property FreePhysicalMemory,TotalVisibleMemorySize @@ -41,7 +41,7 @@ Also indicate what lab configuration you are hoping to run. You need to ensure you can run PowerShell scripts on your computer. Run `Get-ExecutionPolicy` to view your current settings. If it shows `Restricted`, then run this command in an elevated PowerShell session. -```powershell +```shell Set-ExecutionPolicy RemoteSigned -force ``` @@ -51,7 +51,7 @@ Note, that some organizations may have implemented a Group Policy to restrict th The module relies on Windows PowerShell remoting which should be enabled **before** installing and using this module. -```text +```shell PS C:\> test-wsman wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd @@ -62,7 +62,7 @@ ProductVersion : OS: 0.0.0 SP: 0.0 Stack: 3.0 This is what you should see as a result. Any errors mean that PowerShell remoting is disabled. Enable it from your **elevated** PowerShell session. This will fail if your only network connection is over a public network. -```powershell +```shell Enable-PSRemoting -force ``` @@ -72,7 +72,7 @@ If this fails, **STOP**. Do not proceed with this module until this is working a The module requires a lot of disk space for the virtual machines, snapshots and ISO files. Run this command to see how much free space you have. -```text +```shell PS C:\> Get-Volume Drive SizeGB FreeGB PercentFree HealthStatus @@ -91,13 +91,13 @@ The module requires the Hyper-V feature on Windows 10. Please refer to the docum The module uses a standard PowerShell tool called Pester to validate lab configurations. Without getting into technical details, if you are running the out-of-the-box version of Pester on Windows 10, **you need to manually update Pester** before attempting to install this module. In an elevated Windows PowerShell session run this command: -```powershell +```shell Get-Module Pester -ListAvailable ``` If the _only_ result you get is for version `3.4.0`, then you must run: -```powershell +```shell Install-Module Pester -Force -SkipPublisherCheck ``` @@ -105,7 +105,7 @@ Re-run the `Get-Module` to verify version `5.5.0` or greater is installed. If yo If you are running a version of Pester greater than `3.4.0` but less than `5.5.0`, you must update the Pester module. -```powershell +```shell Update-Module Pester ``` @@ -115,13 +115,13 @@ Update-Module Pester If you meet the requirements, you are ready to download and install this module. **Do not download anything from this GitHub repository.** In your PowerShell session run this command: -```powershell +```shell Install-Module PSAutolab -force -SkipPublisherCheck ``` You may be prompted to update to a newer version of `nuget`. Answer "yes". You might also be prompted about installing from an untrusted source. Again, you will need to say "yes". After installation you can verify using `Get-Module`. -```text +```shell PS C:\> Get-Module PSAutoLab -list Directory: C:\Program Files\WindowsPowerShell\Modules @@ -138,13 +138,13 @@ You may see a newer version number than what is indicated here. The `README` fil There is a one-time step to setup your computer for the AutoLab environment. In your elevated PowerShell session run this command: -```powershell +```shell Setup-Host ``` This command will create a directory structure for the module and all of its files. The default is `C:\Autolab` which you should be able to accept. If you are low on space or want to use an alternate drive, then you can specify an alternative top-level path. -```powershell +```shell Setup-Host -DestinationPath D:\Autolab ``` @@ -152,7 +152,7 @@ If you select a drive other than C:\ it is recommended you still use the `Autola To verify your configuration, run `Get-PSAutolabSetting`. -```text +```shell PS C:\> Get-PSAutoLabSetting AutoLab : C:\Autolab @@ -180,14 +180,14 @@ If Hyper-V is not installed you will see errors. Any errors indicate a problem w In an elevated PowerShell session, **change directory** to the configuration folder that you want to use. -```text +```shell PS C:\> cd C:\Autolab\Configurations\SingleServer-GUI-2016 PS C:\Autolab\Configurations\SingleServer-GUI-2016\> ``` You can look at the `instructions.md` file in the folder to get more information about the configuration. -```text +```shell PS C:\Autolab\Configurations\SingleServer-GUI-2016\> get-content .\Instructions.md ``` @@ -199,7 +199,7 @@ Another option is to use the `Get-LabSummary` command. This will show you what c You can run `Unattend-Lab` for a completely hands-free experience. -```text +```shell PS C:\Autolab\Configurations\SingleServer-GUI-2016\> unattend-lab ``` @@ -207,7 +207,7 @@ The very first time you setup a lab, the command will download ISO images of eva Note that during the validation phase you may see errors. This is to be expected until all of the configurations merge. You can press `Ctrl+C` to break out of the testing. The virtual machines will continue to prepare themselves. Later, you can manually validate the lab: -```text +```shell PS C:\Autolab\Configurations\SingleServer-GUI-2016\> Invoke-Pester .\vmvalidate.test.ps1 ``` @@ -223,7 +223,7 @@ Errors that affect setup should happen in one of these steps. If so, open an iss After about 10 minutes, you can run the validation command: -```powershell +```shell Validate-Lab ``` @@ -233,7 +233,7 @@ The `Write-Progress` display will provide feedback on the process. Beginning with v4.21.0, the validation command will restart virtual machines that have stopped and restart-virtual machines that appear to be failing. You will see this as warning messages. Validation will abort after 65 minutes if it hasn't completed. At which point you can manually test to see if the configuration has converged. -```powershell +```shell Run-Pester ``` @@ -243,7 +243,7 @@ Depending on the error, you might simply ignore it or manually attempt to resolv All of the commands in this module have help and examples. You are also encouraged to read the about help topic. -```powershell +```shell help about_PSAutoLab ``` @@ -253,7 +253,7 @@ In the `VMConfigurationData.psd1` file for each lab, you will see a commented ou If you must use this feature, open the `VMConfigurationData.psd1` file in a text or code editor. Scroll down to the `NonNodeData` section. -```powershell +```shell NonNodeData = @{ Lability = @{ @@ -273,13 +273,13 @@ This setting should only be used in special situations as it can be confusing. W Occasionally, things can go wrong for no apparent reason. If you ran through the manual steps to setup a lab but the validation tests are still failing, you may need to stop and restart the virtual machine that is causing problems. For example, *sometimes* the SRV2 member in the `PowerShellLab` configuration simply won't pass validation, often because it can't be connected to. The best solution is to shut down the virtual machine in either the Hyper-V Manager or from PowerShell. -```powershell +```shell Stop-VM srv2 -force ``` Then start it back up. -```powershell +```shell Start-VM srv2 ``` @@ -293,7 +293,7 @@ As a last resort, you can try to manually re-apply a configuration to a virtual First, you need the lab password to create a credential object. -```powershell +```shell $data = Import-PowerShellDataFile .\VMConfigurationData.psd1 $pass = ConvertTo-SecureString -AsPlainText -String $data.AllNodes.LabPassword -force $cred = New-Object PSCredential -ArgumentList administrator, $pass @@ -303,19 +303,19 @@ Note that if the lab has a mix of domain and workgroup machines, you will need t Next, create a CIMSession to the virtual machine. -```powershell +```shell $cim = New-CimSession -ComputerName win10 -Credential $cred ``` Now, you can apply the DSC configuration. You need run this from the lab configuration folder. -```powershell +```shell Start-DscConfiguration -CimSession $cim -Path . -wait -Force -verbose ``` You will be able to watch the process. Wait a minute or two for any background processing to finish and then test: -```powershell +```shell Test-DscConfiguration -CimSession $cim -Detailed ``` diff --git a/ModuleCommands.md b/ModuleCommands.md index 356cd59..7e56526 100644 --- a/ModuleCommands.md +++ b/ModuleCommands.md @@ -2,7 +2,7 @@ Most of the commands in the module use a domain-specific language (DSL), or a set of aliases, such as `Run-Lab,` to reference the actual commands (e.g. `Invoke-Runlab`). This DSL is intended to make it easier for beginner PowerShell users to use this module. -```powershell +```shell Get-Command -module PSAutolab ``` diff --git a/PSAutoLab.psd1 b/PSAutoLab.psd1 index 67296f0..8b84fe9 100644 Binary files a/PSAutoLab.psd1 and b/PSAutoLab.psd1 differ diff --git a/PSAutoLabManual.pdf b/PSAutoLabManual.pdf index 4c97acf..13bcee0 100644 Binary files a/PSAutoLabManual.pdf and b/PSAutoLabManual.pdf differ diff --git a/README.md b/README.md index 5158efe..bf65a35 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This project serves as a set of "wrapper" commands that utilize the [Lability](h Beginning with module version 4.17.0, you can run [Open-PSAutoLabHelp](docs/Open-PSAutoLabHelp.md) to view a local PDF version of the module's documentation. -```powershell +```shell PS C:\> Open-PSAutoLabHelp ``` @@ -48,13 +48,13 @@ This module has been published in the PowerShell Gallery. It is recommended that Open an elevated PowerShell prompt and run: -```powershell +```shell Install-Module PSAutoLab -Force -SkipPublisherCheck ``` If you are using the `Microsoft.PowerShell.PSResourceGet`module run: -```powershell +```shell Install-PSResource PSAutoLab -Force ``` @@ -72,7 +72,7 @@ If you encounter issues with a basic installation and setup, you should read and You can verify the module with these commands: -```powershell +```shell PS C:\> Import-Module PSAutoLab -force PS C:\> Get-Module PSAutoLab @@ -87,7 +87,7 @@ Your version number may differ. This module and its configurations should not conflict with any existing Hyper-V virtual machines or networking. But you should be aware that the module will create a new., internal Hyper-V switch called `LabNet`. This switch will use a NAT configuration called `LabNat`. -```powershell +```shell PS C:\> Get-NetNat LabNat @@ -107,7 +107,7 @@ Active : True The `Instructions` file in each configuration folder documents VMs will be created. You can also check the `VMConfigurationData.psd1` file. -```powershell +```shell PS C:\Autolab\Configurations\MultiRole\> (Import-PowerShellDataFile .\VMConfigurationData.psd1).AllNodes.NodeName * DC1 @@ -138,7 +138,7 @@ _Nano Server images have been removed from configurations. These configurations If you installed previous versions of this module (v3.x) and struggled, hopefully, this version will be an improvement. To avoid any other complications, it is STRONGLY recommended that you manually remove the old version which is most likely under `C:\Program Files\WindowsPowerShell\Modules\PSAutoLab`. You can run a command like: -```powershell +```shell Get-Module PSAutoLab -ListAvailable | Select-Object Path ``` @@ -162,19 +162,19 @@ While this module follows proper naming conventions, the commands you will typic The first time you use this module, you will need to configure the local machine or host. Open an elevated PowerShell session and run: -```powershell +```shell Setup-Host ``` This will install and configure the Lability module and install the Hyper-V feature if it is missing. By default, all AutoLab files will be stored under `C:\AutoLab`, which the setup process will create. If you prefer to use a different drive, you can specify it during setup. -```powershell +```shell Setup-Host -DestinationPath D:\AutoLab ``` You will be prompted to reboot, which you should do especially if the setup had to add the Hyper-V feature. To verify your configuration open an elevated PowerShell session and run this command: -```powershell +```shell PS C:\> Get-PSAutoLabSetting @@ -203,7 +203,7 @@ Some of your values may be different. Please include this information when repor Once the host setup is complete, you can use the module's [Get-LabSummary](docs/Get-LabSummary.md) command to better understand what the lab configuration will set up. Run the command in the configuration folder. -```powershell +```shell PS C:\Autolab\Configurations\SingleServer-GUI-2016\> Get-LabSummary @@ -219,7 +219,7 @@ SingleServer-GUI-2016 192.168.3.75 4 1 RDP Windows Server The module includes a custom format file. You might also run the command like this: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer-GUI-2016> Get-LabSummary | Select-Object * @@ -243,12 +243,11 @@ Lab information is stored under the AutoLab Configurations folder, which is `C:\ You can also run `Get-LabSummary` in the lab configuration folder to see what the configuration will create. -```powershell Where possible, information about what course goes with a particular Pluralsight course will be indicated. ### A Note on Pluralsight Labs -_This module started several years ago and there are several Pluralsight courses that rely on configurations that may no longer exist. Configurations that were named with `Test` or `POC` were not assumed to be used in any courses. But that is turning out to not be the case. If you are trying to set up a lab for a specific course, and can't find the configuration the instructor calls for, please post an issue indicating the configuration you are looking for and the title of the Pluralsight course. Hopefully, there is an existing configuration you can use. Or the module can be updated with an appropriate lab configuration. In some cases, the course may assume a different password. All configurations use `P@ssw0rd` for all passwords._ +_This module started several years _ago and _several Pluralsight courses rely_ on configurations_ that may no longer exist. Configurations that were named with `Test` or `POC` were not assumed to be used in any courses. But that is turning out to not be the case. If you are trying to set up a lab for a specific course, and can't find the configuration the instructor calls for, please post an issue indicating the configuration you are looking for and the title of the Pluralsight course. Hopefully, there is an existing configuration you can use. Or the module can be updated with an appropriate lab configuration. In some cases, the course may assume a different password. All configurations use `P@ssw0rd` for all passwords._ The first time you set up a lab, Lability will download evaluation versions of required operating systems in ISO format. This may take some time depending on your Internet connection. These downloads only happen when the required ISO is not found locally. When you wipe and rebuild a lab it won't download files a second time. @@ -268,7 +267,7 @@ Most, if not all, configurations should follow the same manual process. Run each To verify that all virtual machines are properly configured you can run [Validate-Lab](docs/Invoke-ValidateLab.md). This will invoke a set of tests and keep looping until everything passes. Due to the nature of DSC and the complexity of some configurations, this could take up to 60 minutes. You can use `Ctrl+C` to break out of the testing loop at any time. You can manually run the test one time to see the current state of the configuration. -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Invoke-Pester VMValidate.test.ps1 ``` @@ -278,13 +277,13 @@ This can be useful for troubleshooting. As an alternative, you can set up a lab environment with minimal prompting. -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Unattend-Lab ``` Assuming you don't need to install a newer version of `Nuget`, you can leave the setup alone. It will run all of the manual steps for you. Beginning in version `4.3.0` you also have the option to run the unattended setup in a PowerShell background job. -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Unattend-Lab -AsJob ``` @@ -294,7 +293,7 @@ Use the PowerShell job cmdlets to manage. To stop the lab VMs, change to the configuration folder in an elevated Windows PowerShell session and run: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Shutdown-Lab ``` @@ -304,7 +303,7 @@ You can also use the Hyper-V manager or cmdlets to manually shut down virtual ma The setup process will leave the virtual machines running. If you have stopped the lab and need to start it, change to the configuration folder in an elevated Windows PowerShell session and run: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Run-Lab ``` @@ -314,13 +313,13 @@ You can also use the Hyper-V manager or cmdlets to manually start virtual machin You can snapshot the entire lab very easily. Change to the configuration folder in an elevated Windows PowerShell session and run: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Snapshot-Lab ``` To quickly rebuild the labs from the checkpoint, run: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Refresh-Lab ``` @@ -330,13 +329,13 @@ Or you can use the Hyper-V cmdlets to create and manage VM snapshots. To destroy the lab completely, change to the configuration folder in an elevated Windows PowerShell session and run: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Wipe-Lab ``` This will remove the virtual machines and DSC configuration files. If you intend to rebuild the lab or another configuration, you can keep the `LabNat` virtual switch. This is the default behavior. If you want to remove everything you would need to run a command like this: -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Wipe-Lab -force -RemoveSwitch ``` @@ -344,7 +343,7 @@ PS C:\Autolab\Configurations\SingleServer\> Wipe-Lab -force -RemoveSwitch It is possible to customize a lab configuration by editing the `VMConfigurationData.psd1` file that is in each configuration folder. You must modify the file before creating the lab. For example, the configuration might use Server Core and you want the Desktop Experience on the server. Open the file in your scripting editor and scroll down to find the Node definitions. -```powershell +```shell @{ NodeName = 'DOM1' IPAddress = '192.168.3.10' @@ -373,7 +372,7 @@ It is possible to customize a lab configuration by editing the `VMConfigurationD You can edit the `Lability_Media` setting. Change the setting using one of these ID values from running `Get-LabMedia`. -```powershell +```shell PS C:\> Get-LabMedia Id Arch Media Description @@ -417,7 +416,7 @@ This change has improved setup performance and module stability. When you build a lab, you are creating Windows virtual machines based on evaluation software. You might still want to make sure the virtual machines are up to date with security patches and updates. You can use [Update-Lab](docs/Update-Lab.md) to start the Windows update process on all lab members. This can be a time-consuming process. You have an option to run the updates as a background job. Do not close your PowerShell session before the jobs are complete or the build process will be interrupted. -```powershell +```shell PS C:\Autolab\Configurations\PowerShellLab\> update-lab -AsJob Id Name PSJobTypeName State HasMoreData Location Command @@ -440,19 +439,19 @@ Run the update process as a background job. Use the PowerShell job cmdlets to ma As this module is updated over time, new configurations may be added, or bugs fixed in existing configurations. There may also be new Lability updates. Use PowerShell to check for new versions: -```powershell +```shell Find-Module PSAutoLab ``` And update: -```powershell +```shell Update-Module PSAutoLab -Force ``` If you update, it is recommended that you update the AutoLab configuration. -```powershell +```shell Refresh-Host ``` @@ -462,19 +461,19 @@ This will update the Lability and Pester modules if required and copy all new co If you want to completely remove the PSAutoLab module, first use `Wipe-Lab` to remove any existing lab configurations including the Hyper-V switch. Run this command to uninstall the module and its dependencies -```powershell +```shell Uninstall-Module PSAutoLab,Lability ``` You may need to manually delete the `C:\Autolab` folder. If you want to remove the NAT configuration" -```powershell +```shell Remove-NetNat LabNat ``` If you want to remove Hyper-V you can use the Control Panel to manually remove the optional feature. Or you can try using PowerShell. -```powershell +```shell Get-WindowsOptionalFeature -FeatureName *Hyper* -online | Disable-WindowsOptionalFeature -Online ``` @@ -485,9 +484,9 @@ You will almost certainly need to reboot to complete the removal process. ### Package Provider or Module Installation -If you try to install a module or update the Nuget provider, you might see warnings like these: +If you try to install a module or update the NuGet provider, you might see warnings like these: -```powershell +```shell WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''. WARNING: Unable to download the list of available providers. Check your internet connection. PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and @@ -496,7 +495,7 @@ PackageManagement\Install-PackageProvider : No match was found for the specified The first thing to check is to make sure you are using valid TLS settings. You can try running this command in PowerShell: -```powershell +```shell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ``` @@ -504,7 +503,7 @@ Beginning with v4.17.0 of this module, this change is made when the module is im You could also modify the registry in an elevated PowerShell session for a more permanent solution. -```powershell +```shell Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value 1 ``` @@ -512,13 +511,13 @@ Modifying the registry will require a reboot for the changes to take effect. If the problem is the Nuget provider, after making the TLS changes try: -```powershell +```shell Install-PackageProvider Nuget -force -ForceBootStrap ``` You might also need to update the `PackageManagement` and/or `PowerShellGet` modules. -```powershell +```shell Update-Module PowershellGet,PackageManagement -force ``` @@ -526,13 +525,13 @@ Update-Module PowershellGet,PackageManagement -force The commands and configurations in this module are not foolproof. During testing a lab configuration will run quickly and without error on one Windows 10 desktop but fail or take much longer on a different Windows 10 desktop. Most setups should be completed in under an hour. If validation is failing, manually run the validation test in the configuration folder. -```powershell +```shell PS C:\Autolab\Configurations\SingleServer\> Invoke-Pester VMValidate.test.ps1 -Show All -WarningAction SilentlyContinue ``` Take note of which virtual machines are generating errors. Verify the virtual machine is running in Hyper-V. On occasion, for reasons still undetermined, sometimes a virtual machine will shut down and not reboot. This often happens with the client nodes of the lab configuration. Verify that all virtual machines are running and manually start those that have stopped using the Hyper-V manager or cmdlets. -```powershell +```shell Start-VM Win10 ``` @@ -550,23 +549,23 @@ At this point, you can open an issue in this repository. Open an elevated PowerS Starting with version 4.12.0 of this module, you might see this error when you import the module. -```powershell +```shell Import-Module : Assertion operator name 'Be' has been added multiple times. ``` -This is most likely due to a conflict in Pester versions. The solution is to remove the Pester module from your current session. +This is most likely due to a conflict in Pester module versions. The solution is to remove the Pester module from your current session. -```powershell +```shell Get-Module Pester | Remove-Module ``` Then import this module again. -### _I get an error attempting to update the Lability module_ +### _I get an error when attempting to update the Lability module_ If you try to run `Refresh-Host` you might see an error about a certificate mismatch. Between v0.18.0 and v0.19.0 the Lability module changed code signing certificates. If you encounter this problem, run -```powershell +```shell Refresh-Host -SkipPublisherCheck ``` @@ -574,13 +573,13 @@ Refresh-Host -SkipPublisherCheck Due to what is probably a bug in the current implementation of Desired State Configuration in Windows, if you have multiple versions of the same resource, a previous version might be used instead of the required one. You might especially see this with the `xNetworking` module and the `xIPAddress` resource. If you have any version older than 5.7.0.0 you might encounter problems. Run this command to see what you have installed: -```powershell +```shell Get-DSCResource xIPAddress ``` If you have older versions of the module, uninstall them if you can. -```powershell +```shell Uninstall-Module xNetworking -RequiredVersion 3.0.0.0 ``` @@ -589,7 +588,7 @@ property IsSingleInstance` you might have an older version of a DSCResource modu Run `Get-Module xdhcpserver -list` and remove anything older than version 3.0.0. -```powershell +```shell Uninstall-Module xdhcpserver -RequiredVersion 2.0.0.0 ``` diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 92106ee..54e4681 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,35 +1,11 @@ # Release Notes -## PSAutoLab 5.0.0 - -This is a **major** update to the module. It is recommended that you finish and remove all lab configurations before installing this update. Read the [update documentation](update-v5.md) for more information. +## PSAutoLab 5.1.0 ### Changed -- Module re-organization and code cleanup. -- Pester tests revised to support Pester v5.x. [Issue #240](https://github.com/jdhitsolutions/PSAutoLab/issues/240) __This is a breaking change__. -- Updated module to use version 0.25.0 of the Lability module. -- Updated DSC resources to use the latest versions of the `x` resources. -- Updated `PowerShellLab` configuration to use Windows Server 2019 for domain-joined servers and Windows Server 2022 for the workgroup server. -- Updated Windows 10 configurations to use `WIN10_x64_Enterprise_22H2_EN_Eval`. -- Revised `Invoke-ValidateLab` to reflect changes in Pester 5.x. __This is a breaking change__. -- Updated the private Pester check helper function to install or update Pester as needed. -- Inserted a five minute delay in the `Invoke-ValidateLab` function to allow time for the lab to fully boot. This should cut down on Pester test failures -- Documentation updates. - -### Added - -- Added configuration for Windows Server 2022 (`SingleServer-2022`) running Windows Server Core edition. -- Added configuration for standalone Windows 11 (`Windows11`) running Windows 11 64-bit Enterprise 23H2 English Evaluation. -- Added firewall tests to the validation test for each configuration. -- Added a Pester version check in `PSAutoLab.psm1` to ensure that the module is running with Pester 5.x. -- Added function `Invoke-PesterTest` with alias `Run-Pester` to manually invoke the Pester tests for a lab configuration. -- Added a warning message when importing the module if not using Windows PowerShell 5.1. -- Added parameter alias `Quiet` for `NoMessages`. - -### Removed +- Changed unattended sleep window to 20 minutes. +- Updated documentation formatting and internal links. -- Removed Pester 4.10 requirement. The module now supports Pester v5. __This is a breaking change__. -- Archived lab configurations for Windows Server 2012R2. __This is a breaking change__. +[5.1.0]: https://github.com/pluralsight//PS-AutoLab-Env/compare/v5.0.0..v5.1.0 -[5.0.0]: https://github.com/pluralsight/PS-AutoLab-Env/compare/v4.22.1..v5.0.0 diff --git a/Updating.md b/Updating.md index 6fd48f3..10783bd 100644 --- a/Updating.md +++ b/Updating.md @@ -8,7 +8,7 @@ __Note:__ The terms `AutoLab` and `PSAutolab` are used interchangeably. PSAutola You should be able to run -```powershell +```shell Update-Module PSAutolab ``` @@ -16,34 +16,34 @@ Update-Module PSAutolab However, there is the potential for issues with required Lability module. You can always try this: -```powershell +```shell Update-Module Lability Update-Module PSAutolab ``` In certain situations, the Lability module may encounter a security validation bug between versions. You can try this sequence of commands. -```powershell +```shell Install-Module Lability -SkipPublisherCheck -force Update-Module PSAutolab ``` If you *still* have issues, the best course of action is to uninstall the modules and re-install. -```powershell +```shell Get-Module PSAutolab -ListAvailable | Uninstall-Module Get-Module lability -ListAvailable | Uninstall-Module ``` You might need to repeat this process until this command shows no modules. -```powershell +```shell Get-Module lability,PSAutolab -ListAvailable ``` With a clean slate run: -```powershell +```shell Install-Module PSAutolab -SkipPublisherCheck -Force ``` @@ -55,13 +55,13 @@ If you have been using PSAutolab for awhile, are updating it and plan to continu You should only refresh disk images if __you have no configured virtual machines__. -```powershell +```shell Get-ChildItem C:\autolab\VMVirtualHardDisks ``` If this directory is empty, then you can proceed. -```powershell +```shell Get-ChildItem D:\Autolab\MasterVirtualHardDisks\ | Remove-Item ``` diff --git a/Usage-FAQ.md b/Usage-FAQ.md index c9fb6d4..4141b5a 100644 --- a/Usage-FAQ.md +++ b/Usage-FAQ.md @@ -10,13 +10,13 @@ If you try to run `Refresh-Host` you might see an error about a certificate mism The module commands must be able to use PowerShell remoting to configure and test the virtual machines within a configuration. Because there is no Kerberos authentication between the local host and the virtual machines, you need to configure TrustedHosts. If TrustedHosts can't be configured, you will likely encounter errors. You should make sure remoting is enabled on the localhost. Run this command. -```powershell +```shell Test-WSMan ``` If you get errors, you may need to enable PowerShell remoting. -```powershell +```shell Enable-PSRemoting ``` @@ -37,7 +37,7 @@ At line:116 char:17 To solve this you can try to modify the connection profile. -```powershell +```shell # Find connections with a NetworkCategory set to Public Get-NetConnectionProfile @@ -71,19 +71,19 @@ Refer to this article for help on creating NAT networks: [https://msdn.microsoft Run this command to list NAT networks, take note of the IP range and subnet -```powershell +```shell Get-NetNat ``` If you have an existing that is conflicting, _and that no longer need_, remove it . Here's an example removing an existing NAT network called DockerNAT -```powershell +```shell Remove-NetNat DockerNAT ``` You can then create a NAT network using the corresponding subnet. -```powershell +```shell New-NetNat -Name DockerAndLabilityNAT -InternalIPInterfaceAddressPrefix "192.168.3.0/24" ``` @@ -93,7 +93,7 @@ Docker for Windows network settings can be updated from the windows tray icon. L First, find your desired timezone using one of these techniques: -```powershell +```shell # Filter all timezones, take the Id property from the desired timezone: [System.TimeZoneInfo]::GetSystemTimeZones() [System.TimeZoneInfo]::GetSystemTimeZones().Where({$_.Id -like '*Eastern*'}) @@ -104,18 +104,18 @@ First, find your desired timezone using one of these techniques: Next, open the lab's `VMConfigurationData.psd1` in your script editor and change `Lability_timeZone` per Node. -```powershell +```shell @{ - NodeName = 'Win10Ent' - IPAddress = '192.168.3.101' - Role = @('RSAT','RDP') - Lability_ProcessorCount = 2 - Lability_MinimumMemory = 2GB - Lability_Media = 'WIN10_x64_Enterprise_EN_Eval' - Lability_BootOrder = 20 - Lability_timeZone = 'Central Standard Time' #[System.TimeZoneInfo]::GetSystemTimeZones() - Lability_Resource = @() - } + NodeName = 'Win10Ent' + IPAddress = '192.168.3.101' + Role = @('RSAT','RDP') + Lability_ProcessorCount = 2 + Lability_MinimumMemory = 2GB + Lability_Media = 'WIN10_x64_Enterprise_EN_Eval' + Lability_BootOrder = 20 + Lability_timeZone = 'Central Standard Time' #[System.TimeZoneInfo]::GetSystemTimeZones() + Lability_Resource = @() +} ``` Or, when you run `Setup-Lab` or `Unattend-Lab` you can use the `UseLocalTimeZone` parameter to set the time zone for all lab members to use the same time zone as the local host. @@ -148,7 +148,7 @@ You should keep the same file names. First, find the node information in the VMConfigurationData.psd1 file. -```powershell +```shell @{ NodeName = 'S1' IPAddress = '192.168.3.50' diff --git a/archive/Authoring-FAQ.md b/archive/Authoring-FAQ.md index 7ee3310..bdb4b12 100644 --- a/archive/Authoring-FAQ.md +++ b/archive/Authoring-FAQ.md @@ -8,7 +8,7 @@ This guide is intended for people who are creating their own lab configurations. First, find the node information in the VMConfigurationData.psd1 file. -```powershell +```shell @{ NodeName = 'S1' IPAddress = '192.168.3.50' @@ -51,7 +51,7 @@ Normally, when you run `Wipe-Lab` that should handle everything for you. But if 1. First, find your desired timezone using one of these PowerShell commands: -```powershell +```shell # Filter all timezones, take the Id property from the desired timezone: [System.TimeZoneInfo]::GetSystemTimeZones().Where({$_.Id -like '*Eastern*'}) diff --git a/archive/ConfigArchive/SingleServer2012R2-GUI/Instructions.md b/archive/ConfigArchive/SingleServer2012R2-GUI/Instructions.md index 78e3625..9042ae0 100644 --- a/archive/ConfigArchive/SingleServer2012R2-GUI/Instructions.md +++ b/archive/ConfigArchive/SingleServer2012R2-GUI/Instructions.md @@ -14,7 +14,7 @@ Administrator password is P@ssw0rd. To run the full lab setup, which includes Setup-Lab, Run-Lab, Enable-Internet, and Validate-Lab. You should run all commands from the directory with the MOF and psd1 files. -```powershell +```shell PS> Unattend-Lab ``` @@ -22,31 +22,31 @@ To run the commands individually to setup the lab environment: Run the following for initial setup: -```powershell +```shell PS> Setup-Lab ``` To start the Lab, and apply configurations the first time: -```powershell +```shell PS> Run-Lab ``` To enable Internet access for the VMs, run: -```powershell +```shell PS> Enable-Internet ``` To validate when configurations have converged: -```powershell +```shell PS> Validate-Lab ``` Or you can run the Pester test directly -```powershell +```shell PS> Invoke-Pester vmvalidate.test.ps1 ``` @@ -54,19 +54,19 @@ PS> Invoke-Pester vmvalidate.test.ps1 To stop the lab VMs: -```powershell +```shell PS> Shutdown-lab ``` To checkpoint the VMs: -```powershell +```shell PS> Snapshot-Lab ``` To quickly rebuild the labs from the checkpoint, run: -```powershell +```shell PS> Refresh-Lab ``` @@ -74,13 +74,13 @@ PS> Refresh-Lab If you want to make sure the virtual machines have the latest updates from Microsoft, you can run this command: -```powershell +```shell PS> Update-Lab ``` Because this may take some time to run, you can also run it as a background job. -```powershell +```shell PS> Update-Lab -AsJob ``` @@ -88,12 +88,12 @@ PS> Update-Lab -AsJob To destroy the lab to build again run: -```powershell +```shell PS> Wipe-Lab ``` You will be prompted for each virtual machine. Or you can force the removal and suppress the prompts: -```powershell +```shell PS> Wipe-Lab -force ``` diff --git a/archive/ConfigArchive/SingleServer2012R2/Instructions.md b/archive/ConfigArchive/SingleServer2012R2/Instructions.md index a73bfba..e051876 100644 --- a/archive/ConfigArchive/SingleServer2012R2/Instructions.md +++ b/archive/ConfigArchive/SingleServer2012R2/Instructions.md @@ -14,7 +14,7 @@ Administrator password is P@ssw0rd. To run the full lab setup, which includes Setup-Lab, Run-Lab, Enable-Internet, and Validate-Lab. You should run all commands from the directory with the MOF and psd1 files. -```powershell +```shell PS> Unattend-Lab ``` @@ -22,31 +22,31 @@ To run the commands individually to setup the lab environment: Run the following for initial setup: -```powershell +```shell PS> Setup-Lab ``` To start the Lab, and apply configurations the first time: -```powershell +```shell PS> Run-Lab ``` To enable Internet access for the VMs, run: -```powershell +```shell PS> Enable-Internet ``` To validate when configurations have converged: -```powershell +```shell PS> Validate-Lab ``` Or you can run the Pester test directly -```powershell +```shell PS> Invoke-Pester vmvalidate.test.ps1 ``` @@ -54,19 +54,19 @@ PS> Invoke-Pester vmvalidate.test.ps1 To stop the lab VMs: -```powershell +```shell PS> Shutdown-lab ``` To checkpoint the VMs: -```powershell +```shell PS> Snapshot-Lab ``` To quickly rebuild the labs from the checkpoint, run: -```powershell +```shell PS> Refresh-Lab ``` @@ -74,13 +74,13 @@ PS> Refresh-Lab If you want to make sure the virtual machines have the latest updates from Microsoft, you can run this command: -```powershell +```shell PS> Update-Lab ``` Because this may take some time to run, you can also run it as a background job. -```powershell +```shell PS> Update-Lab -AsJob ``` @@ -88,12 +88,12 @@ PS> Update-Lab -AsJob To destroy the lab to build again run: -```powershell +```shell PS> Wipe-Lab ``` You will be prompted for each virtual machine. Or you can force the removal and suppress the prompts: -```powershell +```shell PS> Wipe-Lab -force ``` diff --git a/changelog.md b/changelog.md index 52f8569..4f7a5c4 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,13 @@ ## [Unreleased] +## [5.1.0] - 2024-02-18 + +### Changed + +- Changed unattended sleep window to 20 minutes. +- Updated documentation formatting and internal links. + ## [5.0.0] - 2024-02-15 This is a **major** update to the module. It is recommended that you finish and remove all lab configurations before installing this update. Read the [update documentation](update-v5.md) for more information. @@ -99,7 +106,8 @@ This release contains changes to lab configuration files. If you are updating th - Updated configurations to use version 3.0.0 of the xDHCPServer module for DSC configurations. This deprecated the `xDCHPServerOption` resource. - Updated `README.md`. -[Unreleased]: https://github.com/pluralsight/PS-AutoLab-Env/compare/v5.0.0..HEAD +[Unreleased]: https://github.com/pluralsight//PS-AutoLab-Env/compare/v5.1.0..HEAD +[5.1.0]: https://github.com/pluralsight//PS-AutoLab-Env/compare/v5.0.0..v5.1.0 [5.0.0]: https://github.com/pluralsight/PS-AutoLab-Env/compare/v4.22.1..v5.0.0 [4.22.1]: https://github.com/pluralsight/PS-AutoLab-Env/compare/v4.22.0..v4.22.1 [4.22.0]: https://github.com/pluralsight/PS-AutoLab-Env/compare/v4.21.0..v4.22.0 diff --git a/docs/Enable-Internet.md b/docs/Enable-Internet.md index d135e53..5619b4a 100644 --- a/docs/Enable-Internet.md +++ b/docs/Enable-Internet.md @@ -26,7 +26,7 @@ This command should be run from the configuration directory after the virtual ma ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\Windows10> Enable-Internet ``` diff --git a/docs/Get-LabSnapshot.md b/docs/Get-LabSnapshot.md index 6ce1de7..d0fd20e 100644 --- a/docs/Get-LabSnapshot.md +++ b/docs/Get-LabSnapshot.md @@ -27,7 +27,7 @@ Note that if you want to remove a snapshot, use the Hyper-V Manager or PowerShel ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\SingleServer> Get-LabSnapshot All VMs in the configuration should belong to the same snapshot. diff --git a/docs/Get-LabSummary.md b/docs/Get-LabSummary.md index 515ebfb..2639f7a 100644 --- a/docs/Get-LabSummary.md +++ b/docs/Get-LabSummary.md @@ -29,7 +29,7 @@ Run Test-LabDSCResource from the configuration directory to see what DSC resourc ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\Windows10> Get-LabSummary Computername: Win10Ent VMName: Win10Ent @@ -45,8 +45,8 @@ Get the configuration for the Windows 10 lab. The command has an associated form ### Example 2 -```powershell -PS C:\Autolab\Configurations\> Get-Childitem -Directory | Get-LabSummary | +```shell +PS C:\Autolab\Configurations\> Get-ChildItem -Directory | Get-LabSummary | Select-Object * | Out-GridView ``` diff --git a/docs/Get-PSAutoLabSetting.md b/docs/Get-PSAutoLabSetting.md index 26c7985..d11da9f 100644 --- a/docs/Get-PSAutoLabSetting.md +++ b/docs/Get-PSAutoLabSetting.md @@ -25,7 +25,7 @@ If you need to report a problem with AutoLab, use this command to get relevant c ### Example 1 -```powershell +```shell PS C:\> Get-PSAutoLabSetting AutoLab : C:\Autolab diff --git a/docs/Invoke-PesterTest.md b/docs/Invoke-PesterTest.md index cb15dc6..c6c59ef 100644 --- a/docs/Invoke-PesterTest.md +++ b/docs/Invoke-PesterTest.md @@ -27,7 +27,7 @@ Invoke-Pester .\vmValidate.test.ps1 -Show All -WarningAction SilentlyContinue ### Example 1 -```powershell +```shell PS C:\> Run-Pester ``` diff --git a/docs/Invoke-RefreshHost.md b/docs/Invoke-RefreshHost.md index 6c3766d..ae16137 100644 --- a/docs/Invoke-RefreshHost.md +++ b/docs/Invoke-RefreshHost.md @@ -28,7 +28,7 @@ You will typically use the Refresh-Host alias. ### Example 1 -```powershell +```shell PS C:\> Refresh-Host Version 0.19.1 of Lability is already installed Updating configuration files from C:\Program Files\WindowsPowerShell\Modules\PSAutoLab\4.19.0\Configurations diff --git a/docs/Invoke-RefreshLab.md b/docs/Invoke-RefreshLab.md index 309ae50..9e08492 100644 --- a/docs/Invoke-RefreshLab.md +++ b/docs/Invoke-RefreshLab.md @@ -25,7 +25,7 @@ Use this command to restore your Autolab configuration from the last checkpoint. ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\Windows10> Refresh-Lab ``` diff --git a/docs/Invoke-RunLab.md b/docs/Invoke-RunLab.md index f8e6380..b982807 100644 --- a/docs/Invoke-RunLab.md +++ b/docs/Invoke-RunLab.md @@ -27,7 +27,7 @@ You will typically use the Run-Lab alias. ### Example 1 -```powershell +```shell PS C:\AutoLab\Configurations\Windows10> Run-Lab ``` diff --git a/docs/Invoke-SetupHost.md b/docs/Invoke-SetupHost.md index 579def7..d5f64a1 100644 --- a/docs/Invoke-SetupHost.md +++ b/docs/Invoke-SetupHost.md @@ -28,7 +28,7 @@ You will typically use the Setup-Host alias. ### Example 1 -```powershell +```shell PS C:\> Setup-Host ``` @@ -36,7 +36,7 @@ Follow the on-screen prompts. If you have to install the Hyper-V feature you def ### Example 2 -```powershell +```shell PS C:\> Setup-Host -destination D:\Autolab ``` diff --git a/docs/Invoke-SetupLab.md b/docs/Invoke-SetupLab.md index 0ecb2f7..6cbec21 100644 --- a/docs/Invoke-SetupLab.md +++ b/docs/Invoke-SetupLab.md @@ -27,7 +27,7 @@ You will typically use the `Setup-Lab` alias. ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\Windows10\> Setup-Lab ``` diff --git a/docs/Invoke-ShutdownLab.md b/docs/Invoke-ShutdownLab.md index c476b0f..d18ccf5 100644 --- a/docs/Invoke-ShutdownLab.md +++ b/docs/Invoke-ShutdownLab.md @@ -27,7 +27,7 @@ You will typically use the Shutdown-Lab alias. ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\PowerShellLab> Shutdown-Lab ``` diff --git a/docs/Invoke-SnapshotLab.md b/docs/Invoke-SnapshotLab.md index 868a0d5..a9a47b3 100644 --- a/docs/Invoke-SnapshotLab.md +++ b/docs/Invoke-SnapshotLab.md @@ -27,7 +27,7 @@ You will typically use the Snapshot-Lab alias. ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\Windows10> Snapshot-Lab ``` diff --git a/docs/Invoke-UnattendLab.md b/docs/Invoke-UnattendLab.md index a9f74d1..e155400 100644 --- a/docs/Invoke-UnattendLab.md +++ b/docs/Invoke-UnattendLab.md @@ -39,7 +39,7 @@ You will typically use the Unattend-Lab alias. ### Example 1 -```powershell +```shell PS C:\Autolab\Configurations\PowerShellLab> Unattend-Lab ``` @@ -47,7 +47,7 @@ Follow any on-screen instructions or prompts. ### Example 2 -```powershell +```shell PS C:\Autolab\Configurations\MultiRole> Unattend-Lab -AsJob ``` diff --git a/docs/Invoke-ValidateLab.md b/docs/Invoke-ValidateLab.md index bc50569..491d13b 100644 --- a/docs/Invoke-ValidateLab.md +++ b/docs/Invoke-ValidateLab.md @@ -34,7 +34,7 @@ Run Validate-Lab -Verbose to see details about the number of testing loops and w ### Example 1 -```powershell +```shell PS C:\AutoLab\Configurations\Windows10> Validate-Lab -verbose ``` diff --git a/docs/Invoke-WipeLab.md b/docs/Invoke-WipeLab.md index a0bce45..68444f2 100644 --- a/docs/Invoke-WipeLab.md +++ b/docs/Invoke-WipeLab.md @@ -31,7 +31,7 @@ You will typically use the Wipe-Lab alias. ### Example 1 -```powershell +```shell PS C:\AutoLab\Configurations\Windows10> Wipe-Lab ``` @@ -39,7 +39,7 @@ Follow any on-screen prompts or instructions. ### Example 2 -```powershell +```shell PS C:\AutoLab\Configurations\SingleServer> Wipe-Lab -force -RemoveSwitch ``` diff --git a/docs/Open-PSAutoLabHelp.md b/docs/Open-PSAutoLabHelp.md index 2f3c4ed..994579a 100644 --- a/docs/Open-PSAutoLabHelp.md +++ b/docs/Open-PSAutoLabHelp.md @@ -27,7 +27,7 @@ This command was introduced in version 4.17.0 of the PSAutoLab module. ### Example 1 -```powershell +```shell PS C:\> Open-PSAutoLabHelp ``` diff --git a/docs/Test-ISOImage.md b/docs/Test-ISOImage.md index d976f4c..99ba31e 100644 --- a/docs/Test-ISOImage.md +++ b/docs/Test-ISOImage.md @@ -27,7 +27,7 @@ ISO image files are only downloaded once during setup. If any of the ISO images ### Example 1 -```powershell +```shell PS C:\> Test-ISOImage Path Valid Size diff --git a/docs/Test-LabDSCResource.md b/docs/Test-LabDSCResource.md index 51724e7..9e5cd6e 100644 --- a/docs/Test-LabDSCResource.md +++ b/docs/Test-LabDSCResource.md @@ -25,7 +25,7 @@ This is a troubleshooting command for the PSAutoLab module. It is designed to be ### Example 1 -```powershell +```shell PS C:\autolab\Configurations\MultiRole> Test-LabDSCResource diff --git a/docs/Update-Lab.md b/docs/Update-Lab.md index 3d8ea06..88f073c 100644 --- a/docs/Update-Lab.md +++ b/docs/Update-Lab.md @@ -29,8 +29,8 @@ It is recommended that you reboot all the lab virtual machines after updating. ### Example 1 -```powershell -PS C:\Autolab\Configurations\PowerShellLab> update-lab -AsJob +```shell +PS C:\Autolab\Configurations\PowerShellLab> Update-Lab -AsJob Id Name PSJobTypeName State HasMoreData Location Command -- ---- ------------- ----- ----------- -------- ------- diff --git a/docs/about_PSAutoLab.md b/docs/about_PSAutoLab.md index feedd0e..d7f8e9e 100644 --- a/docs/about_PSAutoLab.md +++ b/docs/about_PSAutoLab.md @@ -114,7 +114,7 @@ When you build a lab, you are creating Windows virtual machines based on evaluat This can be a time-consuming process, so you have an option to run the updates as a background job. Be sure not to close your PowerShell session before the jobs have completed. -```powershell +```shell PS C:\AutoLab\Configurations\PowerShellLab\> update-lab -AsJob Id Name PSJobTypeName State HasMoreData Location Command @@ -185,13 +185,13 @@ Once the files have been copied, use your script editor to modify the files. Don Due to what is probably a bug in the current implementation of Desired State Configuration in Windows, if you have multiple versions of the same resource, a previous version might be used instead of the required on. You might especially see this with the `xNetworking` module and the `xIPAddress` resource. If you have any version older than 5.7.0.0 you might encounter problems. Run this command to see what you have installed: -```powershell +```shell PS C:\> Get-DSCResource xIPAddress ``` If you have older versions of the module, uninstall them if you can. -```powershell +```shell PS C:\> Uninstall-Module xNetworking -RequiredVersion 3.0.0.0 ``` diff --git a/functions/Invoke-UnattendLab.ps1 b/functions/Invoke-UnattendLab.ps1 index 660483e..1e30a79 100644 --- a/functions/Invoke-UnattendLab.ps1 +++ b/functions/Invoke-UnattendLab.ps1 @@ -44,9 +44,10 @@ Function Invoke-UnattendLab { Write-Progress -Activity $Activity -Completed } - Import-Module PSAutoLab + #uncomment for testing and development #Import-Module C:\scripts\PSAutoLab\PSAutoLab.psd1 -force + Import-Module PSAutoLab $VerbosePreference = $VerboseAction if ($VerboseAction -eq "Continue") { @@ -91,13 +92,13 @@ Function Invoke-UnattendLab { #12 Feb 2024 Adding a sleep interval to allow the lab to finish merging $msg = @" - Sleeping for five minutes to allow time for the lab configurations to merge. + Sleeping for 20 minutes to allow time for the lab configurations to merge. You can abort waiting with Ctrl+C. The lab will continue to run. Later, - you can run Run-Pester to validate the lab. + you can use Run-Pester to validate the lab. "@ Microsoft.PowerShell.Utility\Write-Host $msg -ForegroundColor Yellow #calling a private function to display a progress bar - _SleepProgress -Minutes 5 + _SleepProgress -Minutes 20 Write-Verbose "Invoking Validate-Lab" PSAutolab\Invoke-ValidateLab @PSBoundParameters } diff --git a/update-v5.md b/update-v5.md index c8f2c4a..3a76cca 100644 --- a/update-v5.md +++ b/update-v5.md @@ -22,19 +22,19 @@ Lab configurations for Windows Server 2012R2 have been archived and are no longe The module is available from the PowerShell Gallery. You can update the module from the PowerShell console. This module still only works in Windows PowerShell. -```powershell +```shell Update-Module -Name PSAutoLab -Force ``` Restart your Windows PowerShell session and import the module. -```powershell +```shell Import-Module PSAutoLab ``` You should have at least version `5.0.0`. -```powershell +```shell PS C:\> Get-Module PSAutoLab ModuleType Version Name ExportedCommands @@ -46,19 +46,19 @@ Script 5.0.0 PSAutoLab {Enable-Internet, Get-LabSnaps... Version 5.0 uses updated ISO images and lab configurations. You should take the following steps to update your host **after importing the updated module**. -```powershell +```shell Import-Module PSAutoLab -Force ``` First, in your Windows PowerShell 5.1 session run `Refresh-Host` to update the lab configurations and install updates to Lability or Pester as needed. -```powershell +```shell Refresh-Host ``` Next, change location to your AutoLab folder, and delete all ISO images. -```PowerShell +```shell PS C:\ cd c:\AutoLab PS C:\AutoLab> Get-ChildItem .\ISOs | Remove-Item ``` @@ -66,7 +66,7 @@ You will download new ISO images as needed when you build a lab. Do the same thing with the master virtual disks. Make sure you have no running VMs that might be using them. -```PowerShell +```shell PS C:\AutoLab> Get-ChildItem .\MasterVirtualHardDisks | Remove-Item ``` @@ -76,7 +76,7 @@ Finally, if you don't have any running lab configurations, the VMVirtualHardDisk Since Windows Server 2012 R2 labs have been removed, you might want to delete the lab configurations. -```PowerShell +```shell PS C:\AutoLab> Get-ChildItem .\Configurations\*2012* | Remove-Item -Recurse -Force ```