Link to home
Start Free TrialLog in
Avatar of thenrich
thenrich

asked on

Login script

Is there a login or logout script to capture everybodys current drive mappings?
Avatar of vixtro
vixtro
Flag of Australia image

What type of output are you looking for, writing to a text file or something along those lines?
ASKER CERTIFIED SOLUTION
Avatar of Causality
Causality

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of thenrich
thenrich

ASKER

Yes I'd like to write to a file based on the user login name.
You Can use this command :

net use > C:\%USERNAME%
Avatar of Raj-GT
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
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.
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%

Careful with using the above, as it will not log all the lines when the share path is longer than 25 chars.