Solved

Can run User logon script on 2012 R2

Posted on 2016-09-12
8
116 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 24

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 25

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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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 25

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 24

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

630 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