Login script

Is there a login or logout script to capture everybodys current drive mappings?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What type of output are you looking for, writing to a text file or something along those lines?
You can get all mappings with this command

"net use"

C:\Users\xxxxxxx>net use
New connections will not be remembered.
Status       Local     Remote                    Network
OK           Z:        \\\Dalian     Microsoft Windows Network

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thenrichAuthor Commented:
Yes I'd like to write to a file based on the user login name.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

You Can use this command :

net use > C:\%USERNAME%
Raj-GTSystems EngineerCommented:
Create a batch file with the above command and run it as a logon script using a GPO.

net use > \\server\share\%username%.txt

thenrichAuthor Commented:
If I could just get a script that would wite file with the drive mappings vs a single line of code that would be great.
Raj-GTSystems EngineerCommented:
That single line of code IS the script. :-)

Just create the file drives.cmd in your SYSVOL\DOMAIN\scripts share on the DC and run it as a logon script for all users using the default domain group policy.

This will create individual text files with username.txt under the \\server\share you specify.
net use | findstr /i /r Windows > \\server\share\%USERNAME%

Raj-GTSystems EngineerCommented:
Careful with using the above, as it will not log all the lines when the share path is longer than 25 chars.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.