Solved

Can run User logon script on 2012 R2

Posted on 2016-09-12
8
44 Views
Last Modified: 2016-09-21
Have to run a USER Logon script on 2012 server through GPO, but no matter what I do the script doesn't run.

The script is simple:

SUBST Z: N:\DIRECTORY

If I run script manually, it works well. - The same setting worked like a charm on 2003 server.

EDIT1: *I have configured COMPUTER - RDP - Configure Logon Script Delay to 0 minutes.
EDIT2: *I have tried putting explorer.exe and notepad.exe into script, and those two are run correctly. But the "SUBST Z: N:\DIRECTORY" wont run
0
Comment
Question by:mrmut
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 35

Expert Comment

by:Cris Hanna
ID: 41795309
You're just trying to map a drive, correct??
Login Scripts pretty much ended with Server 2003, everything now is done via Group Policy or Group Policy Preferences..

Mapping  Drives with Group Policy Preferences https://youtu.be/-m0hIcE8Yr8
0
 
LVL 23

Expert Comment

by:Brian B
ID: 41795312
The network services may not be ready when the script runs. So the drive mapping is not complete. As for test try and copy a file to N:.

As was said, better to create drive mapping with policy. Alternatively, try and put a time delay at the beginning of your script.
0
 
LVL 24

Expert Comment

by:lionelmm
ID: 41795446
The problem is either that the users trying to use the SUBST command during ,logon do not have the required interactive admin rights or that SBST need to run with elevated rights. Will do some testing for you in the AM but in the meantime see if this info helps you.
1
 

Accepted Solution

by:
mrmut earned 0 total points
ID: 41795535
I need to run SUBST as the program I have i dependent on specific mapped drive: it is on on Terminal Server, and is DB intensive. Doing the usual drive mapping all the traffic goes over network port which slows DP interaction dramatically - therefore SUBST.

I think LIONELMM is right - the script does seem to run, but the user can not access the drive. However, i don't have a clue how to run it with elevated rights.

I did find two ways to circumvent this, but one is not optimal and the other ones is run at the Computer level:

1. [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\DOS Devices]
"Z:"="\\??\\N:\\DIRECTORY"

2. [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]
"Z Drive"="SUBST Z: N:\\DIRECTORY"

I am currently using solution 1., the two slow to execute, but I would really like the script to work as it simple and effective.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 24

Assisted Solution

by:lionelmm
lionelmm earned 500 total points
ID: 41795813
the script does seem to run, but the user can not access the drive
would it be feasible to put a shortcut on their desktops and have them run the script before using the program? Then check out this options provided in this link, trying the script as a startup instead of as a logon script and if that doesn't work a suggestion to use an utility program.
0
 
LVL 23

Expert Comment

by:Brian B
ID: 41795984
If the script requires elevated rights to run, wouldn't it also require elevated rights when you run it manually?

For what it is worth, here is a blog that talks about running elevated rights: https://blogs.msdn.microsoft.com/aaron_margosis/2007/06/29/faq-why-cant-i-bypass-the-uac-prompt/

Did you consider my suggestion? This will at least tell us if the problem is related to the network mapping.
0
 

Author Comment

by:mrmut
ID: 41797419
Currently, I have the issue temporarily solved by HKLM registry hack, but will need to read the lionelmm blog to see what they say on the issue (I would prefer script solution).
0
 

Author Closing Comment

by:mrmut
ID: 41808398
This solved the problem, making server functional.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now