Solved

Can run User logon script on 2012 R2

Posted on 2016-09-12
8
52 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
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.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

930 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

8 Experts available now in Live!

Get 1:1 Help Now