I thought that RDMan, aka Remote Desktop Connection Manager, fitted perfectly in “A BLAST FROM THE PAST” category of software used back in the day by every System Engineer working on Windows Systems. I was wrong. Believe it or not, it is still strong today!
When you need to manage multiple servers/workstation remotely via RDP(Remote Desktop Protocol) it’s for most professionals the obvious choice. The GUI of the application is straightforward and in most cases or scenarios it’s fit for purpose.
Today, most of the action on Windows Administration side is or it should be on Windows Admin Center (WAC), which is my opinion, it is a way more efficient and flexible choice for System Engineers. But comparing WAC with RDMan is not fair, like comparing apples with pears.
I’ve talked about WAC in these articles :
- How to deploy Windows Admin Center on Windows Server 2016 Core with Powershell
- How to Upgrade Windows Admin Center with Powershell
Remote Desktop Connection Manager
RDCMan manages multiple remote desktop connections. It is useful for managing server labs or large server farms where you need regular access to each machine such as automated checkin systems and data centers. It is similar to the built-in MMC Remote Desktops snap-in, but more flexible. The RDCMan 2.7 version is a major feature release. New features include: – Virtual machine connect-to-console support – Smart groups – Support for credential encryption with certificates – Windows 8 remote action support – Support for Windows 8, Windows 8.1 / Windows Server 2012, Windows Server 2012 R2
RDMAN https://www.microsoft.com/en-au/download/details.aspx?id=44989
This is how it looks like:
Remote desktop manager stores Remote Desktop groups settings into RDG files.
RDG Files
The RDG file is in an XML format and looks like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 |
<?xml version="1.0" encoding="utf-8"?> <RDCMan programVersion="2.7" schemaVersion="3"> <file> <credentialsProfiles /> <properties> <expanded>True</expanded> <name>ScriptingLibrary</name> </properties> <group> <properties> <expanded>True</expanded> <name>Servers</name> </properties> <server> <properties> <name>Server1</name> </properties> </server> <server> <properties> <name>Server2</name> </properties> </server> <server> <properties> <name>Server3</name> </properties> </server> <server> <properties> <name>Server4</name> </properties> </server> <server> <properties> <name>Server5</name> </properties> </server> <server> <properties> <name>Server6</name> </properties> </server> <server> <properties> <name>Server7</name> </properties> </server> <server> <properties> <name>Server8</name> </properties> </server> <server> <properties> <name>Server9</name> </properties> </server> <server> <properties> <name>Server10</name> </properties> </server> <server> <properties> <name>Server11</name> </properties> </server> <server> <properties> <name>Server12</name> </properties> </server> <server> <properties> <name>Server13</name> </properties> </server> <server> <properties> <name>Server14</name> </properties> </server> <server> <properties> <name>Server15</name> </properties> </server> <server> <properties> <name>Server16</name> </properties> </server> <server> <properties> <name>Server17</name> </properties> </server> <server> <properties> <name>Server18</name> </properties> </server> <server> <properties> <name>Server19</name> </properties> </server> <server> <properties> <name>Server20</name> </properties> </server> <server> <properties> <name>Server21</name> </properties> </server> <server> <properties> <name>Server22</name> </properties> </server> <server> <properties> <name>Server23</name> </properties> </server> <server> <properties> <name>Server24</name> </properties> </server> <server> <properties> <name>Server25</name> </properties> </server> <server> <properties> <name>Server26</name> </properties> </server> <server> <properties> <name>Server27</name> </properties> </server> <server> <properties> <name>Server28</name> </properties> </server> <server> <properties> <name>Server29</name> </properties> </server> <server> <properties> <name>Server30</name> </properties> </server> <server> <properties> <name>Server31</name> </properties> </server> <server> <properties> <name>Server32</name> </properties> </server> <server> <properties> <name>Server33</name> </properties> </server> <server> <properties> <name>Server34</name> </properties> </server> <server> <properties> <name>Server35</name> </properties> </server> <server> <properties> <name>Server36</name> </properties> </server> <server> <properties> <name>Server37</name> </properties> </server> <server> <properties> <name>Server38</name> </properties> </server> <server> <properties> <name>Server39</name> </properties> </server> <server> <properties> <name>Server40</name> </properties> </server> <server> <properties> <name>Server41</name> </properties> </server> <server> <properties> <name>Server42</name> </properties> </server> <server> <properties> <name>Server43</name> </properties> </server> <server> <properties> <name>Server44</name> </properties> </server> <server> <properties> <name>Server45</name> </properties> </server> <server> <properties> <name>Server46</name> </properties> </server> <server> <properties> <name>Server47</name> </properties> </server> <server> <properties> <name>Server48</name> </properties> </server> <server> <properties> <name>Server49</name> </properties> </server> <server> <properties> <name>Server50</name> </properties> </server> <server> <properties> <name>Server51</name> </properties> </server> <server> <properties> <name>Server52</name> </properties> </server> <server> <properties> <name>Server53</name> </properties> </server> <server> <properties> <name>Server54</name> </properties> </server> <server> <properties> <name>Server55</name> </properties> </server> <server> <properties> <name>Server56</name> </properties> </server> <server> <properties> <name>Server57</name> </properties> </server> <server> <properties> <name>Server58</name> </properties> </server> <server> <properties> <name>Server59</name> </properties> </server> <server> <properties> <name>Server60</name> </properties> </server> <server> <properties> <name>Server61</name> </properties> </server> <server> <properties> <name>Server62</name> </properties> </server> <server> <properties> <name>Server63</name> </properties> </server> <server> <properties> <name>Server64</name> </properties> </server> <server> <properties> <name>Server65</name> </properties> </server> <server> <properties> <name>Server66</name> </properties> </server> <server> <properties> <name>Server67</name> </properties> </server> <server> <properties> <name>Server68</name> </properties> </server> <server> <properties> <name>Server69</name> </properties> </server> <server> <properties> <name>Server70</name> </properties> </server> <server> <properties> <name>Server71</name> </properties> </server> <server> <properties> <name>Server72</name> </properties> </server> <server> <properties> <name>Server73</name> </properties> </server> <server> <properties> <name>Server74</name> </properties> </server> <server> <properties> <name>Server75</name> </properties> </server> <server> <properties> <name>Server76</name> </properties> </server> <server> <properties> <name>Server77</name> </properties> </server> <server> <properties> <name>Server78</name> </properties> </server> <server> <properties> <name>Server79</name> </properties> </server> <server> <properties> <name>Server80</name> </properties> </server> <server> <properties> <name>Server81</name> </properties> </server> <server> <properties> <name>Server82</name> </properties> </server> <server> <properties> <name>Server83</name> </properties> </server> <server> <properties> <name>Server84</name> </properties> </server> <server> <properties> <name>Server85</name> </properties> </server> <server> <properties> <name>Server86</name> </properties> </server> <server> <properties> <name>Server87</name> </properties> </server> <server> <properties> <name>Server88</name> </properties> </server> <server> <properties> <name>Server89</name> </properties> </server> <server> <properties> <name>Server90</name> </properties> </server> <server> <properties> <name>Server91</name> </properties> </server> <server> <properties> <name>Server92</name> </properties> </server> <server> <properties> <name>Server93</name> </properties> </server> <server> <properties> <name>Server94</name> </properties> </server> <server> <properties> <name>Server95</name> </properties> </server> <server> <properties> <name>Server96</name> </properties> </server> <server> <properties> <name>Server97</name> </properties> </server> <server> <properties> <name>Server98</name> </properties> </server> <server> <properties> <name>Server99</name> </properties> </server> <server> <properties> <name>Server100</name> </properties> </server> </group> </file> <connected /> <favorites /> <recentlyUsed /> </RDCMan> |
There are ways that are quick and dirty and in general, you need to avoid. One of them, for example, is re-invent the wheel, building your own template generator instead of using a parser or a built-in library that manipulates XML. Please don’t!
One thing is being tempted, another thing is starting to code without even thinking of the end goal. That’s just wrong. Period.
In this article, I’ll show how to generate an RDG file with a little bit of help offered by PowerShell and the .NET Framework.
First of all, we need to gather a list of servers in our environment/infrastructure. The content can be stored or imported from a file txt/csv or even AD. Most probably AD is your primary Source of Truth in our company for the windows environment. Feel free to adapt the script to your needs.
We can filter AD Computer by OU(Organisational Unit), by OperatingSystem, Name, TAG, etc..
The following step is creating an XML Template. The benefits of using an XML file as an input template is that we can customize later on or having multiple versions without changing (with reasonable and valid settings for RDMan) our code/script, but just re-run it will give us a different output.
Powershell Script
If we want to query AD we need the ActiveDirectory module. For testing purpose, I’ve commented out the Get-ADComputer command and replace it with a fake list of server (server1 to server100), but you get the idea.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#requires -module activedirectory # This script requires a rdg.xml template and generates an rdg file for # RDMan - Remote Desktop Connection Manager #Paolo Frigo, https://www.scriptinglibrary.com #$ComputerListFromAD = get-adcomputer -Filter * -Properties * #Generating a list of fake servers from server1 to server100 instead of querying AD $ComputerListFromAD = 1..100 | foreach {write-output "Server$_"} $RDGTemplate = $PSScriptRoot + "\"+ "rdg.xml" $RDGFileOutPut = $PSScriptRoot + "\" +"scriptinglibrary.rdg" [XML] $template = Get-Content $RDGTemplate $template.RDCMan.file.group foreach ($pc in $ComputerListFromAD) { $s = $template.CreateNode("element", "server","") $p = $template.CreateNode("element", "properties","") $n = $template.CreateNode("element", "name","") $n.set_InnerXML($pc) $template.RDCMan.file.group.AppendChild($s).AppendChild($p).AppendChild($n) } $template.save($RDGFileOutPut) Write-Output "RDG File generated: $RDGFileOutPut" |
XML Template
I’ve also used an XML Template that I’ve created and used:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<?xml version="1.0" encoding="utf-8"?> <RDCMan programVersion="2.7" schemaVersion="3"> <file> <credentialsProfiles /> <properties> <expanded>True</expanded> <name>ScriptingLibrary</name> </properties> <group> <properties> <expanded>True</expanded> <name>Servers</name> </properties> </group> </file> <connected /> <favorites /> <recentlyUsed /> </RDCMan> |
WRAP UP
Whenever you’re in doubt, DRY (don’t repeat yourself) re-use code whenever possible. XML or JSON are essential for storing settings or for exchanging information between different systems or applications (eg. web services or API). Generating an XML File with Powershell for an application requires sometimes a little effort and testing but the only heavy lifting required is to read the requirements of the output XML properly and reading the documentation (from the .NET Framework https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmldocument?view=netframework-4.7.2).
As usual, all source code is available on my GitHub repository.