Solved

Can run User logon script on 2012 R2

Posted on 2016-09-12
8
68 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:Lionel MM
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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

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
 
LVL 24

Assisted Solution

by:Lionel MM
Lionel MM 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

Does Powershell have you tied up in knots?

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

While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…
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.

772 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