I checked here and there are some topics are talking about double clikc ps1 file to run. but my situation is that I have a ps1 file opening a remote session like this:
$pw = convertto-securestring -AsPlainText -Force -String xxxxxx
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "xxxx\admin",$pw
$pc = Read-Host -Prompt "Please Enter PC name"
$session = new-pssession -computername $pc -credential $cred
Enter-PSSession $session
and i tried this way to make it double click run,
powershell.exe -command "& 'C:\A path with spaces\MyScript.ps1' -MyArguments blah"
after I entered the pc name, the console disappears....
any idea why?