Citrix Remote PC Access allows you to connect to your office PC from anywhere / any device by leveraging Citrix’s virtual desktop agent on the physical desktop. In order for this technology to work, as expected, your PC needs to have enough resources (CPU / RAM, Bandwidth, etc) and Citrix services running. It is rare but at times you might need to reboot your PC to reset resources and services in order to connect remotely via Citrix. In this article you will see how you can restart your own PC remotely without waiting for someone to do IT for you!



Note: The script will only reboot your PC if it can connect to Windows services. Otherwise you will see a message that the script cannot reach your computer and to contact IT.

Step by Step (How to use it?

After you login to Citrix’s web portal, launch the application called Restart PC

Once the application launches you will be welcomed with instructions and a prompt asking if you know the name of the PC you will like to reboot.

If you do not know the computer name you will like to reboot type N to answer No to the prompt. This will trigger a search on Citrix’s studio to see which PCs are associated with your account. If you have computers associated with your account then a list will show your computer names.

If you know the computer’s name to reboot type Y to answer yes and you will then see a prompt to enter the computer name.

Successful reboot

If the PC you typed in the prompt is associated to your account expect the following:

A reboot command will be sent to your PC

This script will monitor and alert you once the PC is offline

This script will then monitor and alert once the PC is online.

Denied Reboot

If the PC you typed is not assigned to your account the script will show you the warning in red and exit.

Technical Information (Backend)

Requirements:

  • You must have a service account allowed to restart PCs remotely in your domain.
  • You must use a vault to hide the password and decrypt on execution.
  • You must be a Citrix Cloud user with API access, if not please contact your administrator
  • You must create a default credential profile to access Citrix’s API programmatically. See the following link for instructions from Citrix.
  • https://www.citrix.com/blogs/2016/07/01/introducing-remote-powershell-sdk-v2-for-citrix-cloud/
  • You must configure a Windows server with Powershell 3.0 or above, install the Citrix VDA for virtual apps and install the Citrix SDK and powershell module.

Configuration:

  • Application Path: powershell.exe
  • Argument: C:locationofyourscript.ps1
  • Max connections per user: 1

Use Case Analysis and Benefits

 

Benefits:

  • Self Service: User can restart their own PCs when experiencing issues connecting remotely.
  • Faster resolution: Users can restart their own PCs without IT’s intervention which reduces resolution time by 15 – 30 minutes (based on SLA)
  • Reduced number of incidents to helpdesk
  • Increased productivity for IT team: Average time for IT to resolve one incident is 15 – 30 minutes which are saved when users self reboot via this script.

Security

  • Users are only allowed to reboot their assigned PCs by specifying the query that lists PCs:
  • Only returns desktops, NOT virtual desktops, apps or servers.
  • Only return desktops where the account launching the script matches the user assigned to the desktop.
  • We use Citrix Studio as the ACL source.
  • We reboot the PC with a domain account which has rights to reboot remotely, NOT with the user’s account.
  • If this script is stopped the application closes to prevent users from issues other commands in the session.
  • Monitoring: This script sends an email to the IT team every time there is a successful or failed attempt to monitor WHO, WHAT and WHEN.

Caveat

This is not a WOL technology so the PC must accept remote commands via WinRM to allow the reboot.

This script will not work if the PC is turned off by a power outage.

Sources:

https://docs.citrix.com/en-us/tech-zone/design/design-decisions/remote-pc-access.html