Skip to content
This repository was archived by the owner on Nov 15, 2024. It is now read-only.

Commit 59ac59f

Browse files
v4.13.0
1 parent 43d25d9 commit 59ac59f

File tree

7 files changed

+53
-22
lines changed

7 files changed

+53
-22
lines changed

Authoring-FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ Normally, when you run `Wipe-Lab` that should handle everything for you. But if
5959

6060
Another option is to use the `-UseLocalTimeZone` parameter when running `Setup-Lab` or `Unattend-Lab`. This will configure all virtual machines in the lab configuration to use the same time zone as the local host.
6161

62-
### last updated 2020-04-23 18:21:49Z UTC
62+
### last updated 2020-04-23 18:21:49Z UTC

Configurations/PowerShellLab/VMValidate.test.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $prefix = $Labdata.NonNodeData.Lability.EnvironmentPrefix
1515
#turn off progress bars
1616
$prep = {
1717
$ProgressPreference = "SilentlyContinue"
18-
$errorActionPreference = 'silentlyContinue'
18+
$errorActionPreference = 'SilentlyContinue'
1919
}
2020
#define an array to hold all of the PSSessions
2121
$all = @()
@@ -113,11 +113,11 @@ Describe DOM1 {
113113

114114
$admins = Invoke-Command { Get-ADGroupMember "Domain Admins"-ErrorAction SilentlyContinue } -session $dc
115115
It "[DOM1] ArtD is a member of Domain Admins" {
116-
$admins.name -contains 'artd'
116+
$admins.name -contains 'artd' | Should Be True
117117
}
118118

119119
It "[DOM1] AprilS is a member of Domain Admins" {
120-
$admins.name -contains 'aprils'
120+
$admins.name -contains 'aprils' | Should Be True
121121
}
122122
} #if users
123123

@@ -292,7 +292,7 @@ Describe SRV3 {
292292
Catch {
293293
It "[SRV3] Should allow a PSSession but got error: $($_.exception.message)" {
294294
$false | Should Be $True
295-
}
295+
}
296296
}
297297
}
298298

Detailed-Setup-Instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,4 @@ Wait about 5 minutes and then test again.
223223

224224
If encounter problems getting any of this to work, you are welcome to post an Issue. If you get the module installed, please include the results of `Get-PSAutolabSetting`. If your problem is meeting one of the requirements, we will do our best to help. Although if your computer is locked down or otherwise controlled by corporate policies there may not be much that we can do.
225225

226-
last updated 2020-06-10 13:54:56Z UTC
226+
last updated 2020-06-10 13:54:56Z UTC

PSAutoLab.psd1

0 Bytes
Binary file not shown.

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55
> **If you are running Pester v5.x you need to be running at least version 4.11.0 of this module.**
66
7-
This project serves as a set of "wrapper" commands that utilize the [Lability](https://github.com/VirtualEngine/Lability) module which is a terrific tool for creating a lab environment of Windows based systems. The downside is that it is a difficult module for less experienced PowerShell users. The configurations and control commands for the Hyper-V virtual machines are written in PowerShell using Desired State Configuration (DSC) and deployed via Lability. If you feel sufficiently skilled, you can skip using this project and use the Lability module on your own. Note that the Lability module is not owned or managed by Pluralsight.
8-
This project and all files are released under an MIT License - meaning you can copy and use as your own, modify, borrow, steal - whatever you want.
7+
This project serves as a set of "wrapper" commands that utilize the [Lability](https://github.com/VirtualEngine/Lability) module which is a terrific tool for creating a lab environment of Windows based systems. The downside is that it is a difficult module for less experienced PowerShell users. The configurations and control commands for the Hyper-V virtual machines are written in PowerShell using Desired State Configuration (DSC) and deployed via Lability. If you feel sufficiently skilled, you can skip using this project and use the Lability module on your own. Note that the Lability module is not owned or managed by Pluralsight. This project and all files are released under an MIT License - meaning you can copy and use as your own, modify, borrow, steal - whatever you want.
98

109
**While this project is under the Pluralsight banner, it is offered AS-IS as a free tool with no official support from Pluralsight.
1110
Pluralsight makes no guarantees or warranties. This project is intended to be used for educational purposes only.**
@@ -21,7 +20,7 @@ The host computer must have the following:
2120
* Windows PowerShell 5.1
2221
* A high-speed internet connection
2322
* Minimum 16GB of RAM (32GB is recommended)
24-
* Minimum 100GB free disk space preferably on a fast SSD device
23+
* Minimum 100GB free disk space preferably on a fast SSD device or equivalent
2524
* An Intel i5 processor or equivalent. An i7 is recommended for best performance
2625
* Windows PowerShell Remoting enabled
2726
* You should be logged in with a local or domain user account. The setup process may not work properly if using an O365 or Microsoft account to logon to Windows.
@@ -60,7 +59,7 @@ PS C:\> Get-Module PSAutolab
6059
6160
ModuleType Version Name ExportedCommands
6261
---------- ------- ---- ----------------
63-
Script 4.11.0 psautolab {Enable-Internet, Get-LabSnapshot,...}
62+
Script 4.12.0 PSAutolab {Enable-Internet, Get-LabSnapshot,...}
6463
```
6564

6665
Your version number may differ.
@@ -114,7 +113,7 @@ Current configurations will use these names for the virtual machine and computer
114113
* S12R2
115114
* S12R2GUI
116115

117-
> Nano Server images have been removed from configurations. These configurations were using the now deprecated version of Nano. Microsoft has changed direction and none of the existing configurations use this new version.
116+
> Nano Server images have been removed from configurations. These configurations were using the now deprecated version of Nano. Microsoft has changed direction with regards to Nano Server and none of the existing configurations use this new version.
118117
119118
### Previous Versions
120119

@@ -276,7 +275,7 @@ To quickly rebuild the labs from the checkpoint, run:
276275
PS C:\Autolab\Configurations\SingleServer\> Refresh-Lab
277276
```
278277

279-
Or you can use the Hyper-V cmdlets to create and manage VM snaphots.
278+
Or you can use the Hyper-V cmdlets to create and manage VM snapshots.
280279

281280
### To Remove a Lab
282281

@@ -501,4 +500,4 @@ These are some of the items that are being considered for future updates:
501500

502501
A complete list of enhancements can be found in [Issues](https://github.com/pluralsight/PS-AutoLab-Env/issues).
503502

504-
Last Updated 2020-06-11 15:35:17Z UTC
503+
Last Updated 2020-06-16 13:30:03Z UTC

changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Change Log for PSAutoLab
22

3+
## 4.13.0
4+
5+
## Add
6+
7+
+ none
8+
9+
## Change
10+
11+
+ Added more Verbose messaging to `Invoke-SetupLab`.
12+
+ Modified `Invoke-ValidateLab` to import and use the approved version of the Pester module.
13+
+ Updated validation test for `PowerShellLab` configuration to fix error validating domain admin membership. (Issue # 226)
14+
+ Modified `Invoke-ValidateLab` to remove all versions of Pester and then load the version compatible with this module.
15+
+ Updated `Invoke-SetupLab` to use `(Get-TimeZone).id` when using local time zone. (Issue #227)
16+
17+
## Delete
18+
19+
+ None
20+
321
## 4.12.0
422

523
## Add

functions/public.ps1

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,11 @@ Function Invoke-SetupLab {
375375
}
376376

377377
if ($UseLocalTimeZone) {
378-
$localtz = [System.TimeZone]::CurrentTimeZone.StandardName
378+
#modifying this old code since it doesn't translate properly from some
379+
#non-US locations. (Issue #227)
380+
# $localtz = [System.TimeZone]::CurrentTimeZone.StandardName
381+
$localtz = (Get-TimeZone).ID
382+
Write-Verbose "Using local time zone $localtz"
379383
if ($LabData.allnodes.count -gt 1) {
380384
if (-Not $NoMessages) {
381385
Microsoft.PowerShell.Utility\Write-Host "Overriding configured time zones to use $localtz" -ForegroundColor yellow
@@ -396,7 +400,7 @@ Function Invoke-SetupLab {
396400

397401
$LabData.allnodes | Out-String | Write-Verbose
398402

399-
# Install DSC Resource modules specified in the .PSD1
403+
Write-Verbose "Install DSC Resource modules specified in the .PSD1"
400404

401405
If (-Not $NoMessages) {
402406
Microsoft.PowerShell.Utility\Write-Host -ForegroundColor Cyan -Object 'Installing required DSCResource modules from PSGallery'
@@ -432,7 +436,7 @@ Function Invoke-SetupLab {
432436
}
433437
}
434438

435-
# Run the config to generate the .mof files
439+
Write-Verbose "Run the config to generate the .mof files"
436440
If (-Not $NoMessages) {
437441
Microsoft.PowerShell.Utility\Write-Host -ForegroundColor Cyan -Object 'Build the .Mof files from the configs'
438442
}
@@ -445,8 +449,8 @@ Function Invoke-SetupLab {
445449
if (-Not $NoMessages) {
446450
Microsoft.PowerShell.Utility\Write-Host -ForegroundColor Cyan -Object "Building the lab environment for $labname"
447451
}
448-
# Creates the lab environment without making a Hyper-V Snapshot
449452

453+
# Creates the lab environment without making a Hyper-V Snapshot
450454
$Password = ConvertTo-SecureString -String "$($labdata.allnodes.labpassword)" -AsPlainText -Force
451455
$startParams = @{
452456
ConfigurationData = $LabData
@@ -463,13 +467,14 @@ Function Invoke-SetupLab {
463467
Write-Verbose ($startParams | Out-String)
464468
if ($PSCmdlet.ShouldProcess($labname, "Start-LabConfiguration")) {
465469
Try {
470+
Write-Verbose "Invoking Start-LabConfiguration"
466471
Start-LabConfiguration @startParams
467472
}
468473
Catch {
469474
Microsoft.PowerShell.Utility\Write-Host "Failed to start lab configuration." -foreground red
470475
throw $_
471476
}
472-
# Disable secure boot for VM's
477+
Write-Verbose "Disable secure boot for VM's"
473478
$VM = Get-VM ( Get-LabVM -ConfigurationData "$path\*.psd1" ).Name
474479
Set-VMFirmware -VM $vm -EnableSecureBoot Off -SecureBootTemplate MicrosoftUEFICertificateAuthority
475480

@@ -665,15 +670,18 @@ Function Invoke-ValidateLab {
665670
)
666671

667672
Write-Verbose "Starting $($myinvocation.mycommand)"
668-
Write-Verbose "Importing Pester module version $PesterVersion"
669673

674+
#remove pester v5
675+
Get-Module Pester | Remove-Module -force
676+
Write-Verbose "Importing Pester module version $PesterVersion"
677+
#use the module specific version of Pester
670678
Import-Module -name Pester -RequiredVersion $PesterVersion -force -Global
671679
$Path = Convert-Path $path
672680
Write-Verbose "Using path $path"
673681

674682
If (-Not $NoMessages) {
675683

676-
$msg = @"
684+
$msg = @"
677685
[$(Get-Date)]
678686
Starting the VM testing process. This could take some time to
679687
complete depending on the complexity of the configuration. You can press
@@ -684,11 +692,17 @@ Function Invoke-ValidateLab {
684692
685693
Invoke-Pester .\vmvalidate.test.ps1
686694
695+
Make sure you are using version $PesterVsion of the Pester module.
696+
Remove any other versions first and then re-import
697+
698+
Get-Module Pester | Remove-Module -force
699+
Import-Module -name Pester -RequiredVersion $PesterVersion -force
700+
687701
If only one of the VMs appears to be failing, you might try stopping
688702
and restarting it with the Hyper-V Manager or the cmdlets:
689703
690-
Stop-VM <vmname>
691-
Start-VM <vmname>
704+
Stop-VM <vmname>
705+
Start-VM <vmname>
692706
693707
Errors are expected until all tests complete successfully.
694708

0 commit comments

Comments
 (0)