Posted On October 1, 2019

PowerShell: How To Bypass Double Hop Problems

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: How To Bypass Double Hop Problems
# This is a working example of hoping without delegation. Fresh creds can be passed in a nested -ScriptBlock
$hop1="SERVER01"
$hop2="SERVER02"
$domainAdmin="someAdmin"
$cred = Get-Credential "$env:USERDOMAIN`\$domainAdmin"

Invoke-Command -ComputerName $hop1 -Credential $cred -ScriptBlock{
param($hop2,$cred)
"Currently at hop: $ENV:computername.";

Invoke-Command -ComputerName $hop2 -Credential $Using:cred -ScriptBlock {
"Reached hop: $ENV:computername.";
}

} -Args $hop2,$cred

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

PowerShell: Remove IP Address Assignment Using Bluecat API

$bluecatUri='http://bluecat.kimconnect.com/Services/API' $bluecatUsername='svc-bluecat-api' $bluecatPassword='PASSWORD' $configId=17 $ipv4Address='10.10.162.54' $marker='toBeDeleted-' function confirmation($content,$testValue="I confirm",$maxAttempts=3){ $confirmed=$false; $attempts=0; $content|write-host write-host "Please review…

Create Desktop Application with Electron using JavaScript

Electron packager > get release build folder cd testappnpm initdescription: calculator.jsauthor: kimconnect.com npm install --save…

PowerShell: Converting Time Stamp from Int64 to DateTime and Vice Versa

Here are some quick conversion methods between time values represented by Integer and DateTime data…