PowerShell Remoting template

Go to Templates->Add New Template->External Application and enter the following:

Display Name: PowerShell Remoting ($URI$)

Command: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments: -NoProfile -NoExit -Command "$username = '$EffectiveUsername$';$password = ConvertTo-SecureString $EffectivePassword$ -AsPlainText -Force;$Credential = New-Object System.Management.Automation.PSCredential($username,$password);Enter-PSSession -ComputerName $URI$ -Credential $Credential"

Working Directory: C:\Windows\System32\WindowsPowerShell\v1.0

This makes it possible to right click a connection object, choose Connect using Template->PowerShell Remoting in order to open a PowerShell Remoting session against that machine and be automatically authenticated using the credentials from the connection object.

This should work from TSX at some point, but I can not get it working at this time.


/usr/local/microsoft/powershell/6.0.0-alpha.16/powershell -NoProfile -NoExit -Command "Enter-PSSession -ComputerName '$URI$' -Credential (New-Object System.Management.Automation.PSCredential('$EffectiveUsername$',(ConvertTo-SecureString $EffectivePassword$ -AsPlainText -Force)));"

Can’t get this to work at all. Getting a “Cannot Embed External Window” error. What am I missing?

Hi,

can you please open a support ticket here Open Ticket | My Royal Apps and provide some details (version, screenshots, etc.)

Thank you,

Stefan

We’re having trouble getting this to work as well; currently we’re getting an “invalid computername”.

It looks like the tokens aren’t being passed properly to PowerShell.

Here’s what we have for the “arguments” box:

-NoProfile -NoExit -Command "$username = '$EffectiveUsername$';$password = ConvertTo-SecureString '$EffectivePassword$' -AsPlainText -Force;$Credential = New-Object System.Management.Automation.PSCredential($username,$password);Enter-PSSession -ComputerName '$URI$' -Credential $Credential"

Hi Damien,

as mentioned above, it would be better to open a support ticket and send us a sample document with the configuration of your powershell task.

Regards,
Stefan