The Net Use command will only show me what drives that only I have mapped when I am logged into the server. What is the easiest way to see all mapped drives for all users and the status of the drives? Thanks.
EDIT
I'm specifically looking for all disconnected drives for all users that are not longer valid so I can disconnect them. I believe the old disconnected mapped drives are causing problems regarding Outlook and inserting attachments to emails.
EDIT AGAIN (WHY NOT?)
My original thought was that someone, somewhere created a tool that displayed this information, and that I was just unable to find it.
Tentative answer - iterate through the users under HKEY_USERS and extract the contents of the Network key. That won't tell you for all users logged in, that will tell you for all users that ever logged in. If you need it fancier, you could parse usernames from the output of qwinsta, correlate that to the SIDs under HKEY_USERS, and then pull only their Network keys.
I'm sure it would be easiest to do in PowerShell (which might have more built-in methods to do this anyway), but since you're on Win2k3, I'm not going to assume that's installed.
Edit- ok, now with that explanation of the problem, why don't you add a line to the start of your TS login scripts to do a
net use * /delete
? Then map everything after that. If anyone needs a mapped drive, add that into their login scripts.The following wmic commandline will return all mapped drives not in Connected state.
The following will return all mapped drives regardless of the connection state:
You can also remove the "get localname, name, username" and replace with list to get full details. If you run the command local to the server you can leave off the /node.
You also add a /format option to change how the info is output. For instance /format:csv will generate it in csv format, /format:htable will output it as a HTML table, and /format:xml as XML. If you add /output:"filename" as the first argument it will save the output to the specified file. If you use /output:clipboard it will place th eoutput in the clipboard.
More info on wmic can be found here.
Add something like the following to your logon script
Make sure to give all your users write access to the share, then let it populate.
After a day or two you'll have a great CSV file you can load up in Excel, sort on User, and flip around the data however works best for you.
Please look at the following link, which provide an ability to manage TS. It might allow getting such an information.