

# This is our RDG file for launching RDCMan, although it is not required that it be provided a. # Create a temporary file to hold the XML $fileElement.RemoveChild($groupTemplateElement) # Remove the Group template object, as it is just a blank stub at this point. # Add (via AppendChild method) a single Server object to a Group objectįunction Add-ServerToGroup($group, $serverName) # Create an RDG (XML formatted) file for RDCMan to import so that all workstations are in relevant groups.

$ExampleGroup = Get-Group $fileElement 'ExampleUser1-group' 'exampleUser1' (Secure-Password $RDCMan ((New-Object PSCredential "user",$credentialHash).GetNetworkCredential().password)) ‘ExampleDomain’ $adminGroup = Get-Group $fileElement 'Admin-group' $env:USERNAME (Secure-Password $RDCMan ((New-Object PSCredential "user",$credentialHash).GetNetworkCredential().password)) $env:USERDOMAIN # Name your root element in the RDCMan connection window. # Root XML element that objects will append to # Be aware that you may need to update the path based on where you store the file # Store the XML template into a variable for more sensible parsing / operating $RDCMan = "E:\Remote Desktop Connection Manager\RDCMan.exe" 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.# Store the location of the Remote Desktop Connection Manager file If we want to query AD we need the ActiveDirectory module. 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. The following step is creating an XML Template. We can filter AD Computer by OU(Organisational Unit), by OperatingSystem, Name, TAG, etc. Feel free to adapt the script to your needs. Most probably AD is your primary Source of Truth in our company for the windows environment.

The content can be stored or imported from a file txt/csv or even AD. NET Framework.įirst of all, we need to gather a list of servers in our environment/infrastructure. In this article, I’ll show how to generate an RDG file with a little bit of help offered by PowerShell and the. One thing is being tempted, another thing is starting to code without even thinking of the end goal. 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. There are ways that are quick and dirty and in general, you need to avoid.
