From 996139ab4ab1620a6769a06d4b2215add6d3d001 Mon Sep 17 00:00:00 2001 From: patrick-sczepanski Date: Mon, 23 Aug 2021 11:12:56 +0200 Subject: [PATCH 1/2] Added folder redirection type --- Private/ConvertTo-XMLFolderRedirection.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Private/ConvertTo-XMLFolderRedirection.ps1 b/Private/ConvertTo-XMLFolderRedirection.ps1 index fe99af1..c43401b 100644 --- a/Private/ConvertTo-XMLFolderRedirection.ps1 +++ b/Private/ConvertTo-XMLFolderRedirection.ps1 @@ -4,6 +4,22 @@ [PSCustomObject] $GPO, [switch] $SingleObject ) + # Redirection types a stored as GUID in GPOs. This hash is used to translate into readable text. + $FolderID = @{ + "{1777F761-68AD-4D8A-87BD-30B759FA33DD}" = "Favorites" + "{FDD39AD0-238F-46AF-ADB4-6C85480369C7}" = "Documents" + "{33E28130-4E1E-4676-835A-98395C3BC3BB}" = "Pictures" + "{4BD8D571-6D19-48D3-BE97-422220080E43}" = "Music" + "{18989B1D-99B5-455B-841C-AB7C74E4DDFC}" = "Videos" + "{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}" = "AppDataRoaming" + "{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}" = "Desktop" + "{625B53C3-AB48-4EC1-BA1F-A1EF4146FC19}" = "StartMenu" + "{374DE290-123F-4565-9164-39C4925E467B}" = "Downloads" + "{4C5C32FF-BB9D-43B0-B5B4-2D72E54EAAA4}" = "Saved Games" + "{56784854-C6CB-462B-8169-88E350ACB882}" = "Contacts" + "{7D1D3A04-DEBB-4115-95CF-2F29DA2920DA}" = "Searches" + "{BFB9D5E0-C6A9-404C-B2B2-AE6DB6AF4968}" = "Links" + } if ($SingleObject) { $CreateGPO = [ordered]@{ DisplayName = $GPO.DisplayName @@ -18,6 +34,7 @@ [Array] $CreateGPO['Settings'] = foreach ($Folder in $GPO.DataSet) { foreach ($Location in $Folder.Location) { [PSCustomObject] @{ + FolderType = $FolderID[$Folder.Id] DestinationPath = $Location.DestinationPath SecuritySID = $Location.SecurityGroup.SID.'#text' SecurityName = $Location.SecurityGroup.Name.'#text' @@ -46,6 +63,7 @@ DomainName = $GPO.DomainName GUID = $GPO.GUID GpoType = $GPO.GpoType + FolderType = $FolderID[$Folder.Id] Id = $Folder.Id DestinationPath = $Location.DestinationPath SecuritySID = $Location.SecurityGroup.SID.'#text' From e56cf3bde39d8d6d50dd6ef9bf0b08a37db65e6d Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Tue, 24 Aug 2021 18:29:11 +0200 Subject: [PATCH 2/2] Moved ID, added ID to SingleObject --- Private/ConvertTo-XMLFolderRedirection.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Private/ConvertTo-XMLFolderRedirection.ps1 b/Private/ConvertTo-XMLFolderRedirection.ps1 index c43401b..2f5836e 100644 --- a/Private/ConvertTo-XMLFolderRedirection.ps1 +++ b/Private/ConvertTo-XMLFolderRedirection.ps1 @@ -34,6 +34,7 @@ [Array] $CreateGPO['Settings'] = foreach ($Folder in $GPO.DataSet) { foreach ($Location in $Folder.Location) { [PSCustomObject] @{ + ID = $Folder.ID FolderType = $FolderID[$Folder.Id] DestinationPath = $Location.DestinationPath SecuritySID = $Location.SecurityGroup.SID.'#text' @@ -63,8 +64,8 @@ DomainName = $GPO.DomainName GUID = $GPO.GUID GpoType = $GPO.GpoType - FolderType = $FolderID[$Folder.Id] Id = $Folder.Id + FolderType = $FolderID[$Folder.Id] DestinationPath = $Location.DestinationPath SecuritySID = $Location.SecurityGroup.SID.'#text' SecurityName = $Location.SecurityGroup.Name.'#text'