When moving data to a new file structure, e.g. when implementing DFS, you need to update all references.
Data references are typically found in GPO‘s with settings for drive mapping and Software Distribution.
Many other references may exist such as, Excel sheet references, generic script references, etc.
For now we’ll be focusing on:
- GPO’s with drive mapping
Check this article for information on how to find and edit GPO’s with software distribution.
For detailed instructions on how you can create your own GPO analysis scripts read this.
Using PowerShell to Identify GPO Drive Mapping
In an old domain with a long history it may be difficult to find all policies that reference the data you’re moving.
To make sure you don’t miss anything it makes good sense to jump into some PowerShell’ing.
Use the following script to identify all drive mappings found in the GPO’s of your domain:
$Reports = Get-GPO -All | Get-GPOReport -ReportType Xml
$DriveMappings = @()
ForEach ($Report In $Reports) {
$GPO = ([xml]$Report).GPO
$LinkCount = ([string[]]([xml]$Report).GPO.LinksTo).Count
$Enabled = $GPO.User.Enabled
ForEach ($ExtensionData In $GPO.User.ExtensionData) {
If ($ExtensionData.Name -eq "Drive Maps") {
$Mappings = $ExtensionData.Extension.DriveMapSettings.Drive
ForEach ($Mapping In $Mappings) {
$DriveMapping = New-Object PSObject -Property @{
GPO = $GPO.Name
LinkCount = $LinkCount
Enabled = $Enabled
DriveLetter = $Mapping.Properties.Letter + ":"
Label = $Mapping.Properties.label
Path = $Mapping.Properties.Path
}
$DriveMappings += $DriveMapping
}
}
}
}
Write-Output $DriveMappings | ft GPO, LinkCount, Enabled, DriveLetter, Label, Path -AutoSize
The output from the script will look similar to this:
GPO LinkCount Enabled DriveLetter Label Path --- --------- ------- ----------- ----- ---- Drive Mapping H 1 true H: Documents \\fileserver1\data Drive Mapping U 1 true U: Personal drive \\fileserver1\homedir$\%LogonUser% Drive Mapping G 0 false G: Company archive \\fileserver1\dokumenter$ Drive Mapping P 3 true P: Accounting \\fileserver2\XAL Drive Mapping I 0 false I: Branch files \\fileserver2\infomenu
Once identified, review what GPO’s are referencing the data you’re moving. Then make a plan to update these GPO’s when doing the switch.
For a thorough primer on GPO, application order, filtering, etc., have a look at this article.