Skip to content

Commit

Permalink
Merge pull request #7 from theJasonHelmick/master
Browse files Browse the repository at this point in the history
Synch latest
  • Loading branch information
jdhitsolutions committed Nov 4, 2016
2 parents 82c5469 + ee8daa3 commit b76d7c1
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 83 deletions.
11 changes: 11 additions & 0 deletions Configurations/POC-MultiRole/Enable-Internet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,15 @@ Function Set-Internet {

Set-Internet

Write-Host -ForegroundColor Green -Object @"
Next Steps:
When complete, run:
.\Run-Lab.ps1
And run:
.\Validate-Lab.ps1
"@

8 changes: 6 additions & 2 deletions Configurations/POC-MultiRole/Readme.MD
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Lab definition

This lab builds the folowing:
This lab builds the following:

* 1 DC with users, groups and OU's - GUI
* 1 DHCP server on the DC
* 2 Domain joined servers (s1 and s2)
* 1 Nano server
* 1 Domain joined Windows 10 Client with RSAT tools
* 1 Domain joined Windows 10 Client with RSAT tools

## To get started:
* Run the .\Setup-Lab.ps1
* and follow on screen instructions
11 changes: 11 additions & 0 deletions Configurations/POC-MultiRole/Setup-Lab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ Write-Host -ForegroundColor Green -Object @"
"@

Pause
# Install DSC Resource modules specified in the .PSD1
Write-Host -ForegroundColor Cyan -Object 'Installing required DSCResource modules from PSGallery'
Write-Host -ForegroundColor Yellow -Object 'You may need to say "yes" to a Nuget Provider'
$LabData = Import-PowerShellDataFile -Path .\*.psd1
$DSCResources = $LabData.NonNodeData.Lability.DSCResource

Foreach ($DSCResource in $DSCResources) {

Install-Module -Name $($DSCResource).Name -RequiredVersion $($DSCResource).RequiredVersion

}

# Run the config to generate the .mof files
Write-Host -ForegroundColor Cyan -Object 'Build the .Mof files from the configs'
Expand Down
10 changes: 3 additions & 7 deletions Configurations/POC-MultiRole/VMConfiguration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
Authors: Jason Helmick and Melissa (Missy) Janusko
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko.
Currently on her public DSC hub located here:
https://github.com/majst32/DSC_public.git
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko and Jason Helmick.
Currently on her public DSC hub located here: https://github.com/majst32/DSC_public.git
Goal - Create a Domain Controller, Populute with OU's Groups and Users.
One Server joined to the new domain
One Windows 10 CLient joined to the new domain
Additional contributors of note: Jeff Hicks
Disclaimer
This example code is provided without copyright and AS IS. It is free for you to use and modify.
Expand Down
23 changes: 10 additions & 13 deletions Configurations/POC-MultiRole/VMConfigurationData.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
Authors: Jason Helmick and Melissa (Missy) Janusko
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko.
Currently on her public DSC hub located here:
https://github.com/majst32/DSC_public.git
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko and Jason Helmick.
Currently on her public DSC hub located here: https://github.com/majst32/DSC_public.git
Goal - Create a Domain Controller, Populute with OU's Groups and Users.
One Server joined to the new domain
One Windows 10 CLient joined to the new domain
Additional contributors of note: Jeff Hicks
Disclaimer
This example code is provided without copyright and AS IS. It is free for you to use and modify.
Expand Down Expand Up @@ -72,10 +68,11 @@ demonstrations and would need to be modified for your environment.
# 2012R2_x64_Datacenter_EN_V5_Eval
# WIN10_x64_Enterprise_EN_Eval
}

@{
NodeName = 'DC'
NodeName = 'DC1'
IPAddress = '192.168.3.10'
Role = 'DC' # multiple roles @('DC', 'DHCP')
Role = @('DC', 'DHCP')
Lability_BootOrder = 10
Lability_BootDelay = 60 # Number of seconds to delay before others
Lability_timeZone = 'US Mountain Standard Time' #[System.TimeZoneInfo]::GetSystemTimeZones()
Expand All @@ -90,7 +87,7 @@ demonstrations and would need to be modified for your environment.
}

@{
NodeName = 'NANO1'
NodeName = 'N1'
IPAddress = '192.168.3.60'
#Role = 'Nano'
Lability_BootOrder = 20
Expand All @@ -100,7 +97,7 @@ demonstrations and would need to be modified for your environment.
}

@{
NodeName = 'Client'
NodeName = 'Cli1'
IPAddress = '192.168.3.100'
Role = @('domainJoin', 'RSAT')
Lability_ProcessorCount = 1
Expand Down Expand Up @@ -151,8 +148,8 @@ demonstrations and would need to be modified for your environment.
@{ Name = 'xNetworking'; RequiredVersion = '2.12.0.0'; Provider = 'PSGallery'; },
@{ Name = 'xDhcpServer'; RequiredVersion = '1.5.0.0'; Provider = 'PSGallery'; },
@{ Name = 'xWindowsUpdate' ; RequiredVersion = '2.5.0.0'; Provider = 'PSGallery';},
@{ Name = 'xPSDesiredStateConfiguration'; MinimumVersion = '4.0.0.0'; },
@{ Name = 'xPendingReboot'; MinimumVersion = '0.3.0.0'; }
@{ Name = 'xPSDesiredStateConfiguration'; RequiredVersion = '4.0.0.0'; },
@{ Name = 'xPendingReboot'; RequiredVersion = '0.3.0.0'; }


);
Expand Down
62 changes: 34 additions & 28 deletions Configurations/POC-MultiRole/ValidateVM.test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ $Domain = "company"
$Secure = ConvertTo-SecureString -String $Password -AsPlainText -force
$cred = New-Object PSCredential "Company\Administrator",$Secure

Describe DC {
Describe DC1 {

$dc = New-PSSession -VMName DC -Credential $cred -ErrorAction SilentlyContinue
$dc = New-PSSession -VMName DC1 -Credential $cred -ErrorAction SilentlyContinue

It "Should accept domain admin credential" {
It "[DC1] Should accept domain admin credential" {
$dc.Count | Should Be 1
}

Expand All @@ -25,115 +25,121 @@ $feat = Invoke-Command { Get-WindowsFeature | Where installed} -session $dc
$needed = 'AD-Domain-Services','DNS','RSAT-AD-Tools',
'RSAT-AD-PowerShell'
foreach ($item in $needed) {
It "Should have feature $item installed" {
It "[DC1] Should have feature $item installed" {
$feat.Name -contains $item | Should Be "True"
}
}

It "Should have an IP address of 192.168.3.10" {
It "[DC1] Should have an IP address of 192.168.3.10" {
$i = Invoke-command -ScriptBlock { Get-NetIPAddress -interfacealias 'Ethernet' -AddressFamily IPv4} -Session $dc
$i.ipv4Address | should be '192.168.3.10'
}

It "Should have a domain name of $domain" {
It "[DC1] Should have a domain name of $domain" {
$r = Invoke-command { Get-ADDomain -ErrorAction SilentlyContinue } -session $dc
$r.name | should Be $domain
}

$OUs = Invoke-command { Get-ADorganizationalUnit -filter * -ErrorAction SilentlyContinue} -session $dc
$needed = 'IT','Dev','Marketing','Sales','Accounting','JEA_Operators'
foreach ($item in $needed) {
It "Should have organizational unit $item" {
It "[DC1] Should have organizational unit $item" {
$OUs.name -contains $item | Should Be "True"
}
}
$groups = Invoke-Command { Get-ADGroup -filter * -ErrorAction SilentlyContinue} -session $DC
$target = "IT","Sales","Marketing","Accounting","JEA Operators"
foreach ($item in $target) {

It "Should have a group called $item" {
It "[DC1] Should have a group called $item" {
$groups.Name -contains $item | Should Be "True"
}

}

$users= Invoke-Command { Get-AdUser -filter * -ErrorAction SilentlyContinue} -session $dc
It "Should have at least 15 user accounts" {
It "[DC1] Should have at least 15 user accounts" {
$users.count | should BeGreaterThan 15
}

$computer = Invoke-Command { Get-ADComputer -filter * -ErrorAction SilentlyContinue} -session $dc
It "Should have a computer account for Client" {
$computer.name -contains "client" | Should Be "True"
It "[DC1] Should have a computer account for Client" {
$computer.name -contains "cli1" | Should Be "True"
}

It "Should have a computer account for S1" {
It "[DC1] Should have a computer account for S1" {
$computer.name -contains "S1" | Should Be "True"
}

It "[DC1] Should have a computer account for S2" {
$computer.name -contains "S2" | Should Be "True"
}


} #DC

Describe S1 {
$s1 = New-PSSession -VMName S1 -Credential $cred -ErrorAction SilentlyContinue
It "Should accept domain admin credential" {
It "[S1] Should accept domain admin credential" {
$s1.Count | Should Be 1
}

It "Should have an IP address of 192.168.3.50" {
It "[S1] Should have an IP address of 192.168.3.50" {
$i = Invoke-command -ScriptBlock { Get-NetIPAddress -interfacealias 'Ethernet' -AddressFamily IPv4} -Session $S1
$i.ipv4Address | should be '192.168.3.50'
}
$dns = icm {Get-DnsClientServerAddress -InterfaceAlias ethernet -AddressFamily IPv4} -session $s1
It "Should have a DNS server configuration of 192.168.3.10" {
It "[S1] Should have a DNS server configuration of 192.168.3.10" {
$dns.ServerAddresses -contains '192.168.3.10' | Should Be "True"
}


} #S1


Describe NanoServer {

It "Should respond to WSMan requests" {
$script:sess = New-PSSession -VMName Nano1 -Credential $Cred -ErrorAction Stop
$script:sess.Computername | Should Be 'Nano1'
It "[Nano] Should respond to WSMan requests" {
$script:sess = New-PSSession -VMName N1 -Credential $Cred -ErrorAction Stop
$script:sess.Computername | Should Be 'N1'
}

It "Should have an IP address of 192.168.3.60" {
It "[Nano] Should have an IP address of 192.168.3.60" {
$r = Invoke-Command { Get-NetIPAddress -InterfaceAlias Ethernet -AddressFamily IPv4} -session $script:sess
$r.IPv4Address | Should Be '192.168.3.60'
}

It "Should belong to the Workgroup domain" {
It "[Nano] Should belong to the Workgroup domain" {
$sys = Invoke-Command { Get-CimInstance Win32_computersystem} -session $script:sess
$sys.Domain | Should Be "Workgroup"
}

It "Should have the DSC package installed" {
It "[Nano] Should have the DSC package installed" {
$pkg = Invoke-command { (Get-WindowsPackage -PackageName *DSC* -Online).Where({$_.packageState -eq 'Installed'})} -session $script:sess
$pkg.count | Should BeGreaterThan 0

}
}


Describe Client {
Describe Cli1 {

$cl = New-PSSession -VMName client -Credential $cred -ErrorAction SilentlyContinue
It "Should accept domain admin credential" {
$cl = New-PSSession -VMName cli1 -Credential $cred -ErrorAction SilentlyContinue
It "[CLI] Should accept domain admin credential" {
$cl = New-PSSession -VMName cli1 -Credential $cred -ErrorAction SilentlyContinue
$cl.Count | Should Be 1
}

It "Should have an IP address of 192.168.3.100" {
It "[CLI] Should have an IP address of 192.168.3.100" {
$i = Invoke-command -ScriptBlock { Get-NetIPAddress -interfacealias 'Ethernet' -AddressFamily IPv4} -session $cl
$i.ipv4Address | should be '192.168.3.100'
}

$dns = icm {Get-DnsClientServerAddress -InterfaceAlias ethernet -AddressFamily IPv4} -session $cl
It "Should have a DNS server configuration of 192.168.3.10" {
$dns = Invoke-Command {Get-DnsClientServerAddress -InterfaceAlias ethernet -AddressFamily IPv4} -session $cl
It "[CLI] Should have a DNS server configuration of 192.168.3.10" {
$dns.ServerAddresses -contains '192.168.3.10' | Should Be "True"
}

} #client

Get-PSSession | Remove-PSSession
Get-PSSession | Remove-PSSession
11 changes: 11 additions & 0 deletions Configurations/devops-powershell-fundamentals/Enable-Internet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,15 @@ Function Set-Internet {

Set-Internet

Write-Host -ForegroundColor Green -Object @"
Next Steps:
When complete, run:
.\Run-Lab.ps1
And run:
.\Validate-Lab.ps1
"@

8 changes: 6 additions & 2 deletions Configurations/devops-powershell-fundamentals/Readme.MD
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Lab definition

This lab builds the folowing:
This lab builds the following:

* 1 DC with users, groups and OU's - GUI
* 1 DHCP server on the DC
* 2 Domain joined servers (s1 and s2)
* 1 Nano server
* 1 Domain joined Windows 10 Client with RSAT tools
* 1 Domain joined Windows 10 Client with RSAT tools

## To get started:
* Run the .\Setup-Lab.ps1
* and follow on screen instructions
11 changes: 11 additions & 0 deletions Configurations/devops-powershell-fundamentals/Setup-Lab.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ Write-Host -ForegroundColor Green -Object @"
"@

Pause
# Install DSC Resource modules specified in the .PSD1
Write-Host -ForegroundColor Cyan -Object 'Installing required DSCResource modules from PSGallery'
Write-Host -ForegroundColor Yellow -Object 'You may need to say "yes" to a Nuget Provider'
$LabData = Import-PowerShellDataFile -Path .\*.psd1
$DSCResources = $LabData.NonNodeData.Lability.DSCResource

Foreach ($DSCResource in $DSCResources) {

Install-Module -Name $($DSCResource).Name -RequiredVersion $($DSCResource).RequiredVersion

}

# Run the config to generate the .mof files
Write-Host -ForegroundColor Cyan -Object 'Build the .Mof files from the configs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
Authors: Jason Helmick and Melissa (Missy) Janusko
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko.
Currently on her public DSC hub located here:
https://github.com/majst32/DSC_public.git
The bulk of this DC, DHCP, ADCS config is authored by Melissa (Missy) Januszko and Jason Helmick.
Currently on her public DSC hub located here: https://github.com/majst32/DSC_public.git
Goal - Create a Domain Controller, Populute with OU's Groups and Users.
One Server joined to the new domain
One Windows 10 CLient joined to the new domain
Additional contributors of note: Jeff Hicks
Disclaimer
This example code is provided without copyright and AS IS. It is free for you to use and modify.
Expand Down
Loading

0 comments on commit b76d7c1

Please sign in to comment.