Hi @Jonathan Yang ,
to pass the $target_computer
in the Invoke-Command
you can try this (not tested):
$target_computer = Get-Content -Path "C:\Scripts\targets.txt" #hosted in my local machine
Invoke-Command -Session $psremote -ScriptBlock {
foreach ($target in $using:target_computer) { Resolve-DnsName -Name $target -ErrorAction Ignore } }
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten