Blogging about Royal TS/X, Royal Server and Royal Passwords

Integrate PowerShell in Royal TS

We get a lot of feature request to better implement and support PowerShell capabilities in Royal TS. While we are thinking about some cool scenarios for one of our next major Royal TS for Windows versions, I want to share some guidance on how to integrate PowerShell into your Royal TS workflow with the current version of Royal TS (V2.2 and later).

Since Royal TS V2.2 supports embedding external applications using the External Application connection type, you can integrate almost any other Windows application into your Royal TS workflow – including Powershell or the PowerShell ISE.

Preparing PowerShell

Before we can truly integrate PowerShell in Royal TS, we need to make sure that the PowerShell window can be resized to the appropriate window size. To do that, make sure you start the powershell.exe from an elevated command prompt (in %windir%/system32/windowspowershell/v1.0). Then click the System Menu and click on Properties:
Windows-Live-Writer-1c1a68eb914b_C425-image_2[1]

Make sure the Screen Buffer Size is big enough to enable Royal TS to completely embed the PowerShell window. This depends on your screen resolution, your font size, etc. Try a couple of values, such as 500 or 1000.

Embedding PowerShell

For the next step, leave the PowerShell window open and switch to Royal TS. The best way to integrate external applications into Royal TS is by using the dashboard. For this purpose, I always have an “empty” External Application connection just for the Dashboard functionality. I call it “All Programs” and usually make only use of it when I want to integrate a new tool into Royal TS:
Windows-Live-Writer-1c1a68eb914b_C425-image_6[1]

As you can see in the screenshot above, the PowerShell process I previously started is still running and is shown in the Dashboard. Just select the Windows PowerShell process and click Connect (Ad Hoc) on the dashboard toolbar. A new ad hoc connection will be created with your selection and the PowerShell window will be “swallowed” by Royal TS.

Adding the PowerShell Connection to your Document

Windows-Live-Writer-1c1a68eb914b_C425-image_8[1]

As you can see, the ad hoc connection can be found in the ad hoc folder in the Application document and the PowerShell window is embedded in Royal TS. Having the connection in the Ad hoc folder will not keep the connection once we disconnect. But we want to keep the connection and we also want to have easy access to PowerShell whenever we want.

To make our “PowerShell connection” available in our document, just drag the connection to one of your folders in your document (as shown above). Finally, we open the connection properties and rename the connection or tweak other settings if we like. Now, if we need a PowerShell session, we just connect to it, as we would with any other connection:
Windows-Live-Writer-1c1a68eb914b_C425-image_10[1]

What are the Benefits?

You may wonder, what do I gain by doing this. There are a couple of advantages:

  • Your PowerShell “Connection” works as any other connection. You can rearrange the tabs, use split-views, make it external and embedded while connected, etc.
  • You can create many copies (Ad hoc or not) and use multiple PowerShell sessions consolidated in one place.
  • Using the default connection properties you can establish VPN connections or any other command task before the process is started or after it is closed.
  • Using the credentials configuration you can run the PowerShell session under a different user account (as long as the user account is allowed to log on on your workstation).
  • You can make use of key sequence tasks in one or more sessions to automate your workflow and gain access to often used commands.

What about the PowerShell ISE?

The procedure above can be used for almost every application (which allows embedding). I’ve used the same steps to integrate the ISE and as you can see, it runs fine when integrated in Royal TS:
Windows-Live-Writer-1c1a68eb914b_C425-image_14[1]

Conclusion

I hope this little blog post is helpful and demonstrates the power of the External Application connection type. I’ve seen a lot of cool use cases and the PowerShell example here is one of my favorites. If you have any feedback, questions or suggestions, let me know.

cheers,
Stefan



You must be logged in to post a comment.