Private/Get-UserProfileLocation.ps1
function Get-UserProfileLocation { Param ( [string]$ServerName, [string]$SID, [string]$Key, [string]$Path = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" ) Process { $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ServerName) $regKey = $reg.OpenSubKey("$Path\$SID") if ($regKey) { return $regKey.GetValue($Key) } return $null } } |