The RDM snap-in allows for quick and robust automation of actions, such as add/edit/open of sessions. The possibilities are endless, and are limited only by your imagination – and, of course, the tool’s functionality (use the forum to suggest new functionality!).
Since its release, this highly-requested feature has become a very useful in solving user requests. A quick search through our forum reveals many ingenious usages of the cmdlets, such as automating the creation of Windows Start Menu shortcuts for every RDM session (link).
To learn more, you can find full RDM cmdlet documentation available via online help, or directly in PowerShell using the Get-Help cmdlet.
Example: Create Web Data Entry
Here’s a simple example of the RDM PowerShell snap-in at work. We’ll be covering how I imported all blog URLs from Google Reader.
1. I started by exporting my Google Reader subscriptions (via Google Takeaway).
2. Next, I loaded the file into an XmlDocument using Get-Content.
3. Finally, I created an RDM session for each node, and assigned the appropriate properties:
[xml]$rss = Get-Content C:\rss.xml;
foreach ($site in $rss.opml.body.outline)
$session = New-RDM-Session -Name $site.Text -Kind "DataEntry"
$session.Group = "RSS"
$session.AddDataEntryKind(11 <# Web #>);
Set-RDM-Session $session -NoRefresh;
Set-RDM-Property -ID $session.ID -Path "DataEntry" -Property "Url" -Value $site.htmlUrl
Example: Reflect the group name as the company name
foreach ($list in Get-RDM-Session)
$group = Get-RDM-Property -id $list.id -Property "Group";
Set-RDM-Property -ID $list.ID -Path "MetaInformation" -Property "Company" -value $group -NoRefresh
Now, for you IT pros out there, this is a pretty simple example that you could do in your sleep! However, I merely wanted to illustrate how robust the feature is, and how you can use it to make your life easier and more productive.
Here are some additional tips to help you get the most out of the PowerShell snap-in:
- Use the
–NoRefreshflag for faster script execution, especially in loops, since the UI isn’t refreshed during the action.
- Use the
Set-RDM-Propertycmdlet to set almost any value within the session object. To find properties and paths, reverse engineer the session XML file format. Create a sample session in RDM and export it using the right click menu Import/Export -> Export Session (.rdm).... Once exported, open the .rdm file with your favorite editor. Browse the XML structure to find the property path and name.
- Use the
AddDataEntryKindmethod to set the data entry kind to Web (11 in this case). This is not actually documented – it’s just a bonus tip that we use here at Devolutions all the time!
So, how would you find more helpful tips like these? Simply visit our forum and ask! Plus, if the tool can’t do what you need it to, we’ll see what we can do to add it to a future release. In fact, most of the features we’ve built so far are a result of user requests for help and guidance.
As you can see, RDM PowerShell integration can be very useful – and the full potential hasn’t yet been tapped! If you have an interesting PowerShell script, or would like to see more examples, please comment below.