Creating a policy that runs a .bat file on loging in from a network share

I would like to run a .bat file from a DFS drive that runs every time a user logs in a Pc on the network,
The file is on a server called file2 which is shared as everybody’s Y drive. I thought I can run this through a system policy and would like help with the correct syntax please.
Drive as said is the y drive on all users Pc and is as follows Y: \\FILE2\FIle2 DFS
and the bat file I want to run is below

 @echo off
if exist %systemdrive%\policy\it_policy1.szp goto end
if not exist %systemdrive%\policy\ goto next
mkdir %systemdrive%\policy
net use y: /d
net use y: \\file2\file2 DNS
copy y:\it_policy1.szp %systemdrive%\policy
Regedit /s y:\it_policy1.reg
net use y: /delete goto end

Would this work or am I totally wrong?
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.

dances1960Author Commented:
Or since the Y drive already exists do I need this at all?
No need to map the Y drive. You can use UNC paths instead. Group POlicy Preferences is preferred over regedit, especially when running on Vista/7/Windows 2008/R2 because of UAC. Group Policy Preferences can even copy over your file, so you don't actually need a script at all.

Group Policy Preferences

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
There is a policy specifically for this....

Run these programs at user logon
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
Microsoft Legacy OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.