Report on remote users mapped drives

After a very thorough search, I can't find anyone else who has had this question answered.

I have a need to on-the-fly report on the mapped drives and their letters of users on remote computers. Running "Get-WmiObject -Class Win32_MappedLogicalDisk | select Name, ProviderName" only returns my drives under my credentials, not the remote user. Looking at HKU:\sid\network apparently only reports persisent mapped drives or drives mapped by the customer and not drives mapped by logon script that are not persistent.

There doesn't seem to be a way to do this on-the-fly which is dissapointing, so I'm hoping you'll have a trick up your sleeve!

The only way I can figure to get the information, but not on the fly, is to have a logon script run as the user and grab the info and save it somewhere. I'm really hoping not to resort to that. All of that becomes historical info and won't reflect changes that happen after logon, so it's not going to always be a true reflection of reality.

The key seems to be running a wmi query as someone else that you don't have credentials for. Is that possible? Or do you have another suggestion?

September 14th, 2012 11:56pm

I don't know how you could do that, but I was wondering what the purpose is in doing this kind of a report. It would suffer some of the same issues as the logon script approach, as you cannot be sure that someone wasn't going to map some share shortly after you run the script. It also would not tell you anything about users not currently logged on.

If  you are trying to identify shares that are never mapped (for possible deletion), another approach could be to delete the share for a while to see who complains.

Free Windows Admin Tool Kit Click here and download it now
September 15th, 2012 12:32am

I guess one way would be to have a script (not logon) that starts when a user logs in (runs from the 'All Users' StartUp folder) and runs the WMI query at a specified interval or a specified time and writes a report to a server share/SQL server... whatever you have.

You could have it watch a server share or a network port for a command to run your WMI query and report back... that way you could get a 'snapshot' report of all machines running at an instant of your choosing, all using the logged in users credentials.

I have a script (vbscript, sadly) which starts in the 'All Users' StartUp folder... it sleeps for a random number of minutes then does a software audit and sends the result to a SQL server.

A suggestion to mull over...

September 15th, 2012 1:10am

This will retrieve the mapped drives of the currently logged-on user, for local or remote computers:

gwmi win32_mappedlogicaldisk -ComputerName localhost

Free Windows Admin Tool Kit Click here and download it now
September 15th, 2012 12:00pm

Hi Bigteddy, how would you run that command on a remote machine?

September 15th, 2012 12:41pm

Hi Bigteddy, how would you run that command on a remote ma

Free Windows Admin Tool Kit Click here and download it now
September 15th, 2012 1:05pm

If I run this command against a remote computer ...

Get-WmiObject -Class Win32_MappedLogicalDisk -ComputerName <remote computer> | select Name, ProviderName

which logon is running the command?

September 15th, 2012 1:13pm

If I run this command against a remote computer ...

Get-WmiObject -Class Win32_MappedLogicalDisk -ComputerName <remote computer> | select Name, ProviderName

which logon is running the co

Free Windows Admin Tool Kit Click here and download it now
September 15th, 2012 1:30pm

If I run this command against a remote computer ...

Get-WmiObject -Class Win32_MappedLogicalDisk -ComputerName <remote computer> | select Name, ProviderName

which logon is running the co

September 15th, 2012 2:25pm

You've tested this for yourself, and you're absolutly

Free Windows Admin Tool Kit Click here and download it now
September 15th, 2012 2:43pm

You've tested this for yourself, and you're absolutly sure?

Just a humble Sy

September 15th, 2012 4:56pm

Yes, Gastone, you are right.  When a different user is logged on to the remote machine, the command returns nothing.
Free Windows Admin Tool Kit Click here and download it now
September 15th, 2012 6:17pm

Gastone echoed my question: "why, what is the purpose?". Perhaps if the OP would answer that, we might find some way to meet his requirement, which, I suspect, may be somewhat different from what he stated.
September 16th, 2012 9:47am

Hi,

I would like to confirm the issue status, if there is anything that we can do for you, please feel free let us know.

Regards,

Yan Li

TechNet Subscriber Support

If you are TechNet Subscription user and have any feedback on our support quality, please send your feedback here.

Free Windows Admin Tool Kit Click here and download it now
September 17th, 2012 12:50pm

I believe this post may already be closed.  I, however, would like to add my findings:  When I run this against different pc's with different users logged on:  Get-WmiObject -Class Win32_MappedLogicalDisk -ComputerName <remote computer> | select Name, ProviderName

(Keep in mind that I'm a local admin on my pc as well as the destination pc's as well.)

1. The logged on user is non-admin on their pc.

Mapped drives are not retrieved

2. The logged on user is admin on their pc.

Mapped drives are retrieved

3. I'm logged on to the remote pc (local admin)

Mapped drives are retrieved

Conclusion:  As long as the target pc logged on user is local admin on that pc then the mapped network drives will be pulled by the previously mentioned command.  Otherwise, it will come back empty.

A question posted previously was:  "I'm curious why you need to know mapped drives??" In my case, I am trying to back up mapped network drives for all domain users.  However, logon or logoff scripts are not an option.

The real question should be: Why is the previously mentioned command not pulling the mapped network drives when the logged on user is not a local admin on the target pc?

August 16th, 2013 10:09am

I believe this post may already be closed.  I, however, would like to add my findings:  When I run this against different pc's with different users logged on:  Get-WmiObject -Class Win32_MappedLogicalDisk -ComputerName <remote computer> | select Name, ProviderName

(Keep in mind that I'm a local admin on my pc as well as the destination pc's as well.)

1. The logged on user is non-admin on their pc.

Mapped drives are not retrieved

2. The logged on user is admin on their pc.

Mapped drives are retrieved

3. I'm logged on to the remote pc (local admin)

Mapped drives are retrieved

Conclusion:  As long as the target pc logged on user is local admin on that pc then the mapped network drives will be pulled by the previously mentioned command.  Otherwise, it will come back empty.

A question posted previously was:  "I'm curious why you need to know mapped drives??" In my case, I am trying to back up mapped network drives for all domain users.  However, logon or logoff scripts are not an option.

The real question should be: Why is the previously mentioned command not pulling the mapped network drives when the logged on user is not a local admin on the target pc?

I believe the answer is that the drives are not mapped to the remote computer per se, but to the user's process on the remote computer. And while an admin on that computer has significant power over the hardware and operating system, it cannot take control of the process, which is locked by the user's credentials.

Consider remote control. My regular account is logged onto another computer. I run mstsc to establish a remote control session on that remote system under the same credentials. The effect is to disconnect the other remote session and lock the system on its console, and for the new session to inherit the original process, seeing the same desktop with the same apps open.

I then run mstsc to establish another remote control session, this time using an account that is an administrator on that system. It tells me my regular account is already logged on, and gives me two options, abort my new session, or log the user out. using my admin credentials, I cannot take over the user's session and see what applications he has open or what drives he may have mapped.

Free Windows Admin Tool Kit Click here and download it now
August 16th, 2013 5:19pm

as to your purpose, if you need to backup all of their mapped drives, why not just backup the shares they might be mapping to?
August 16th, 2013 5:21pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics