Simple domain logon script to capture locally mapped drives and printers

I have a project where I need to deploy Group Policy Preferences to replace statically mapped drives and printers.  Unfortunately, nobody really knew too much about the environment.  Login scripts weren't in place.  People were connecting to printers however they figured out how to do it.

I needed to be able to come up with some structure to map shares (OU, groups, etc).  I needed to tie printers to PCs and drive mappings to users.

I went as simple as I could.  I added a simple batch file as a logon script to the domain policy which was the only policy active in the Active Directory forest.

REM=======Script ========
@echo off
net use >> \\server\share\%COMPUTERNAME%_%USERNAME%.txt
date /T >> \\server\share\%COMPUTERNAME%_%USERNAME%.txt
cscript \\domain\netlogon\prnmngr.vbs -l >> \\server\share\%COMPUTERNAME%_%USERNAME%.txt

REM ===========END of Script ===================

Notice prnmngr.vbs?  That's a Windows XP / Server 2003 utility.  I copied it to the NETLOGON share so Windows 7 machines could run the tool.

Within a few days, I had enough data that I could shut off this logon script. 

If this were a huge environment with tens of thousands of users, I would have used logon scripts at each OU with different shares for each business unit and/or location.


Popular posts from this blog

ADMT fails to migrate SID History

Exchange 2010 event errors 2601, 2604, 2501

Robocopy Error 31 A device attached to the system is not functioning