Wednesday, November 11, 2015

New Azure RemoteApp PowerShell cmdlet to remotely reboot ARA RDSH Servers

A new PowerShell cmdlet for Azure RemoteApp has been released. The command is Restart-AzureRemoteAppVM. What this command is able to do is remotely restart a RD Session Host server as part of you Azure RemoteApp Collection. For the parameters you need to provide Azure RemoteApp collection name and a UserUpn. The collection name is obvious, the UserUpn needs some explaining. The idea that Microsoft had behind this command is that you use it as sort of a last resort when you run into issues with a specific user. Using this command, you can easily restart the RD Session Host VM that the user is logged on to. To some degree I can understand the idea behind this, although since we now also have the new PowerShell cmdlet Get-AzureRemoteAppVM available to retrieve all RD Session Host servers with their logged on users, allowing to provide a hostname is stead of a UserUPN would also make sense.

Couple of things to be aware of:

- The reboot that is performed is a remotely executed reboot within the VM. By that I mean the reboot is not performed on a Hyper-V level. So in case the RD Session Host server for whatever reason is not accessiable on the network, the reboot will fail.

- The reboot is a forced reboot within the OS without any warning or a delay. This means that all other users that might be running on that VM will also lose their connection, and their work. If you need to use this command, I would advise you to first use the command Get-AzureRemoteAppVM to retrieve a list of users currently active on that specific RD Session Host server, and warn them about upcoming reboot to allow them to save their work.

- If you are running a Hybrid (Domain-Joined) deployment of Azure RemoteApp, you can also easily perform that remote reboot using Remote PowerShell because the RD Session Host servers as part of the Hybrid collection are part of the domain and thus accessible. For Cloud (non-domain joined) collections where you did not create a back door local admin account inside the Template Image, this new PowerShell cmdlet is definitely helpful.

Here is de command in action, using the Get-AzureRemoteAppOperationResult Cmdlet we’re able to track the status of the command.image

This is what the a user will see who was logged on to VM and still had a session, he will see the shutdown take place and after that this screen will close.
image

And here are the details on the Cmdlet.

NAME
    Restart-AzureRemoteAppVM

SYNTAX
    Restart-AzureRemoteAppVM [-CollectionName] <string> [-UserUpn] <string> [[-LogoffMessage] <string>] [[-LogoffWaitSe
    conds] <int>] [-Profile <AzureSMProfile>] [-WhatIf] [-Confirm]  [<CommonParameters>]

ALIASES
    None

REMARKS
    None

No comments:

Post a Comment