Did you know that RDM has a Windows PowerShell snap-in? It was part of RDM 7.0, which was released early last year.
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).
Example: Create Web Data Entry
[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
- 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!
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.