February 2019
Intermediate to advanced
626 pages
15h 51m
English
Passing credentials into a remote session means the second hop can authenticate without being dependent on authentication tokens from the original system.
In this example, the using variable scope is used to access a credential variable. The credential is used to run a query against Active Directory from a remote system:
$Credential = Get-Credential
Invoke-Command -ComputerName PSTest -ScriptBlock {
Get-ADUser -Filter * -Credential $using:Credential
}
Read now
Unlock full access