Public/DisMount-ProfileRegistry.ps1

function DisMount-ProfileRegistry {
    <#
    .DESCRIPTION
    Loads any local users registry hive into the registry as a friendly name. Useful for modifying a users registry without the need of them being logged in locally.
 
    .PARAMETER SamAccountName
    SamAccountName of the domain account that you are mounting the local registry for.
 
    .PARAMETER DomainController
    Domain Controller that has Powershell Remoting enabled on it. For importing a session with the Active directory Module.
 
    .EXAMPLE
    DisMounts the Mounted ProfileRegistry
 
    DisMount-ProfileRegistry -SamAccountName JohnS
 
    .Link
    https://github.com/TheTaylorLee/AdminToolbox
    #>


    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true)]$SamAccountName
    )

    #DisMount registry key for user
    reg.exe unload HKU\$SamAccountName
}