15,170,505 members
See more: , +
Hello,

using a batch file, on my admin account, I would like to load the regedit hive of a disconnected windows user (NTUSER.DAT). Then, getting part of the "RemotePath" value of one of his mapped drive (what comes next \\\\server\\users\\) :
[HKEY_CURRENT_USER\Network\z]
"RemotePath"="\\\\server\\users\\tsmith"
"ProviderName"="Microsoft Windows Network"
"ProviderType"=dword:00020000
"ConnectionType"=dword:00000001
"DeferFlags"=dword:00000004

is this possible in batch ? How ?

Any help would help me so much.

What I have tried:

I have no specific idea of about how to achieve this.
Any help would greatly help me improve my script.
Thank you.
Posted
Updated 15-Feb-21 7:10am

## Solution 1

According to this StackOverflow answer[^], it is possible to do this in Powershell.
PowerShell
reg.exe load 'HKLM\TempHive' Path\to\offline\file.dat
\$path = Get-ItemProperty -Path "HKLM:\TempHive\Network\z" -name RemotePath | Select-Object -ExpandProperty RemotePath
reg.exe unload 'HKLM\TempHive'