I have found a script online that does this beautifully
https://social.technet.microsoft.com/Fo ... 358ef139e7
2 downfalls. It will not retrieve the drives while my techs are working VPN, and it takes about 10 seconds to return the results
Is there a way I can use this method if I know the SID?
$computers = 'Server1'
$key = 'S-1-5-21-XXXXXXXXX'
$valuename = 'Network'
[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('Users', $computer)
Get Mapped Drives using .net
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Get Mapped Drives using .net
Yup, the user will be logged in.
figured using remote registry would be much faster than the other processes.
figured using remote registry would be much faster than the other processes.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Get Mapped Drives using .net
What is it you are looking for a solution to? What is the purpose of this?
If a user connects over a VPN they are not logged into a remote system. All drives are mapped locally over the VPN. Get-PsDrive is all you need.
If a user connects over a VPN they are not logged into a remote system. All drives are mapped locally over the VPN. Get-PsDrive is all you need.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Get Mapped Drives using .net
Trying to return the Drive and Path of a logged on users network drives from HKEY_USERS using remote registry
I have found using remote registry is much quicker than powershell commands
Ignore VPN.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Get Mapped Drives using .net
Show technicians the drives and the paths so our build guys can map them
Yes, I can export the registry but that will map drives they may no longer have access to.. So in our form if I put
Z: \\server1\accounting
Y: \\server1\records
The build team actually maps these and can tell us they no longer have access.
I'm trying to prevent moving bad data from one PC to another
Re: Get Mapped Drives using .net
What drivers and data are you looking for in the registry? There are no drivers associated with mapped drives. You seem to use "drivers" a nd "drives" interchangeably. They are not the same.
Your question is much too vague to even guess at an answer.
Your question is much too vague to even guess at an answer.
- MarvelManiac
- Posts: 63
- Last visit: Thu Sep 13, 2018 3:40 pm
Re: Get Mapped Drives using .net
Hmm, not sure where you see I typed Drivers but I did come to this solution
So it's working in the ISE but it only returns the length in a DGV
I'd like to return something like this
but I'm stuck. I might just have to put it in a textbox
So it's working in the ISE but it only returns the length in a DGV
- $computer = 'Server1'
- $regkey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::Users, $Computer)
- $ref = $regKey.OpenSubKey("S-1-5-21-XXXXXXX\Network");
- $keys = $ref.GetSubKeyNames()
- $results = foreach ($key in $keys)
- {
- $ref2 = $regKey.OpenSubKey("S-1-5-21-XXXXXXX\Network\$key");
- "$key $($ref2.GetValue("RemotePath"))"
- }
- $results
but I'm stuck. I might just have to put it in a textbox
Last edited by MarvelManiac on Wed Jan 10, 2018 3:19 pm, edited 1 time in total.