This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-LabDefinition -Name FailoverLab -DefaultVirtualizationEngine HyperV | |
Add-LabDomainDefinition -Name contoso.com -AdminUser Install -AdminPassword Somepass1 | |
Set-LabInstallationCredential -Username Install -Password Somepass1 | |
Add-LabIsoImageDefinition -Name SQLServer2016 -Path $labsources\ISOS\en_sql_server_2016_enterprise_x64_dvd_8701793.iso | |
$PSDefaultParameterValues = @{ | |
'Add-LabMachineDefinition:DomainName' = 'contoso.com' | |
'Add-LabMachineDefinition:Memory' = 1GB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To create a lab with a PKI, check out our sample scripts, e.g. "PKI Simple.ps1" in your $labsources | |
Import-Lab MyPkiLab | |
# One-liner to enable auto-enrollment for code signing certificates for all lab users and computers | |
Enable-LabCertificateAutoenrollment -Computer -User -CodeSigning | |
# Prepare for a new template | |
$splat = @{ | |
TemplateName = "MyTemplate" | |
DisplayName = "My awesome template" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configuration myConfig | |
{ | |
node localhost | |
{ | |
File f | |
{ | |
DestinationPath = "C:\HelloIAmYour.File" | |
Contents = "It works so well, you gotta love AutomatedLab!" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$labName = 'Test5' | |
#create an empty lab template and define where the lab XML files and the VMs will be stored | |
New-LabDefinition -Name $labName -DefaultVirtualizationEngine Azure | |
Add-LabAzureSubscription -Path D:\myazuresettings.json -DefaultLocationName 'west europe' | |
#make the network definition | |
Add-LabVirtualNetworkDefinition -Name $labName -AddressSpace 192.168.71.0/24 | |
#and the domain definition with the domain admin account |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Lab 'Your lab name here' | |
# Whether your are on Azure, Hyper-V or VMWare - one Cmdlet to rule them all! | |
# Enters an RDP connection to the machine of your choice | |
# Connection details for Azure will automatically be used: Load balancer Public IP and RDP Port | |
Connect-LabVm (Get-LabMachine | Select -First 1) | |
# Enters an interactive PSSession to your machine | |
# Connection details for Azure will automatically be used: Load balancer Public IP and WinRM Ports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-SongOfTime() | |
{ | |
[Console]::Beep("440","500") #Kammerton a, 0,5s | |
[Console]::Beep("293.228","1000") | |
[Console]::Beep("349.228","500") | |
[Console]::Beep("440","500") | |
[Console]::Beep("293.228","1000") | |
[Console]::Beep("349.228","500") | |
[Console]::Beep("440","250") | |
[Console]::Beep("523.251","250") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use AutomatedLabs little helpers in your own code aka steal our stuff | |
$parameterTable = @{ | |
Name = 'PowerShell' | |
WeirdParameter = 'Does not compute :(' | |
} | |
$nicerParameters = Sync-Parameter -Command (Get-Command Get-Process) -Parameters $parameterTable | |
Get-Process @nicerParameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$labname = 'Inception' | |
New-LabDefinition -Name $labname -DefaultVirtualizationEngine HyperV | |
Add-LabMachineDefinition -Name DreamLayer1 -Memory 8GB -OperatingSystem 'Windows Server 2016 SERVERSTANDARDCORE' | |
Install-Lab | |
Get-Vm DreamLayer1 | stop-Vm -Passthru | Set-VMProcessor -ExposeVirtualizationExtensions $true | |
Start-LabVm DreamLayer1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$site = Get-ADReplicationSite -Identity Toronto | |
$site.ReplicationSchedule.RawSchedule # Our boolean values | |
foreach ( $day in 0..6) # Iterate over each day of the week, starting with Sunday | |
{ | |
foreach ( $hour in 0..23) # Iterate over each hour | |
{ | |
foreach ( $interval in 0..3) # Iterate over each 15-min interval | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-ADReplicationSchedule | |
{ | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true)] | |
[System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule]$ReplicationSchedule, | |
[Parameter(ValueFromPipelineByPropertyName = $true, Mandatory = $true)] | |
[string]$DistinguishedName |
OlderNewer