Do you ever need to run a PowerShell script on multiple machines? Say an upgrade script? RDM Agent is the tool for the job. First open an RDP connection to all the machines you want to execute the script on. Once opened, multi-select the opened session right-click -> Execute Script via Agent. Select the script type, set the script parameters and hit Execute.
In this example we want to start as service (say ASP .NET State Service). First select PowerShell and enter the command Start-Service -Name aspnet_state, select Run as Administrator and execute.
- Limited functionality
- Must be predefined
- More advance (supports Run as a different user for example)
- Runs within RDM
Both support environment and RDM variables. RDM variables (%$HOST$) are resolved on the client against the session it will be running on while environment variables (%windir%) will be resolved on the destination machine at execution time. When running file based scripts (.ps1) you can user RDM variables within the script, they will be resolved prior to sending the script over to the destination machine.
RDP Log Off
RDM Agent will also enable RDM to perform certain task more efficiently. Log off is an example. The RDP doesn’t support log off natively, we had implemented it using WMI but it’s slow. Now you can set the log off method to Automatic, RDM Agent or WMI. In the case of automatic if the RDM Agent is available it will perform the log off via the agent if not it will fall back to WMI. A simple example where RDM Agent can help improve an existing feature.
RDM Agent is a very powerful tool that can be used when appropriate. Keep in mind it’s not your only tool. Remote PowerShell or remote WMI can also perform most of the task that RDM Agent currently support. There are instances where remote PowerShell for example won’t work. That is if you are using an RDP Gateway, in this case RDM Agent will work seamlessly. Another advantage of course is the logging of RDM.