Created
November 24, 2017 12:24
-
-
Save nyanhp/57f6657374bc5abfb3d7368fb70404d4 to your computer and use it in GitHub Desktop.
Interacting with lab machines
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 | |
# Old sessions will be recycled automatically - you always connect to the same session until it is broken | |
# Lab Sessions are standard PSSessions and can be used in ALL cmdlets that accept a PSSession as parameter! | |
Enter-LabPSSession (Get-LabMachine | Select -First 1) | |
# Invoke a command on your lab machines - again, all pesky details are automatically set for you | |
Invoke-LabCommand (Get-LabMachine) -ScriptBlock { | |
Get-Process | |
} -PassThru # PassThru needs to be set if you want to return output | |
# Invoke a script with dependencies on your lab machines - no need to copy your stuff there! | |
Invoke-LabCommand -ActivityName 'Doing stuff' -ComputerName (Get-LabMachine) -PassThru -FileName script.ps1 -DependencyFolderPath D:\ScriptWithDependencies |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment