Login script

Is there a login or logout script to capture everybodys current drive mappings?
LVL 5
thenrichAsked:
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.

vixtroCommented:
What type of output are you looking for, writing to a text file or something along those lines?
0
CausalityCommented:
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:        \\192.168.0.23\Dalian     Microsoft Windows Network
0

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.
0
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.

CausalityCommented:
You Can use this command :

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

drives.cmd
=========
net use > \\server\share\%username%.txt

Thanks,
Raj
0
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.
0
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.
0
CausalityCommented:
net use | findstr /i /r Windows > \\server\share\%USERNAME%

0
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.
0
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.