I have a GUI form and from there want to open a PSSession to a computer in a new CLI window.
So something like:
$mycred = Get-Credential Start-Process powershell.exe -ArgumentList "-noexit -command Enter-PSSession -ComputerName computer1 -Credential $mycred"
As soon as I run the Start-Process, it again prompts me for credentials. Is it not somehow to pass the $mycred variable to the new session?