Created
July 26, 2022 12:19
-
-
Save ScriptingPro/51822b7bfb71fa4811bc709af10b0be2 to your computer and use it in GitHub Desktop.
Compare two Remote Desktop Connection Manager RDG files and find out what's different
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Flatten-RDGFile | |
{ | |
Param | |
( | |
# Param1 help description | |
[Parameter(Mandatory=$true)] | |
[string]$RDGFile | |
) | |
$rdcman = $([xml](gc $RDGFile)).RDCMAN | |
foreach($ParentGroup in $rdcman.file.group){ | |
foreach($SubGroup in $ParentGroup.group){ | |
foreach($Server in $SubGroup.server){ | |
[PSCustomObject]@{ | |
ParentGroup = $ParentGroup.properties.name | |
SubGroup = $SubGroup.properties.name | |
Server = $Server.properties.name | |
} | |
} | |
} | |
} | |
} | |
$rdg1 = Flatten-RDGFile -RDGFile ~\Documents\Contoso.rdg | %{"$($_.ParentGroup)#$($_.SubGroup)#$($_.Server)"} | |
$rdg2 = Flatten-RDGFile -RDGFile ~\Documents\Fabrikam.rdg | %{"$($_.ParentGroup)#$($_.SubGroup)#$($_.Server)"} | |
Compare-Object $rdg1 $rdg2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment