Delay logon script

Posted on 2013-10-17
Medium Priority
Last Modified: 2013-11-19
Hi all,

I need to create a specific batch file that does the following.

Pings an IP for 120 seconds
After the timeout it checks with which username I am logged in and it contacts the Domain Controller and gets the logon script dedicated to that user from the field “scriptpath” from the AD properties and runs that logon script dedicated for that particular user.

All this is needed since we have a particular security software installed and we need this workaround. This software disconnects the network on start-up for 2 minutes and logs in with a cached password. After the 2 minutes we would like to run the logon script so that it maps the mapped drives for the user. The first batch file will be placed in the start-up folder of each machine.

I cannot use local GPO or Server GPO since on startup there will be no connectivity to the domain but just after 2 minutes.

Can you please assist?

Question by:casscar
  • 3
  • 2
  • 2
  • +1
LVL 22

Expert Comment

by:Nick Rhode
ID: 39580166
LVL 81

Expert Comment

ID: 39581674
There is a GPO that you can set the requirement that the network connection be established before user login is available.
This will auto delay any login attempt until the network is established.

Author Comment

ID: 39581802
The problem is that with this program (it installs an Access List) on your network card and it just allows traffic to a specific port so therefore to connectivity to the domain is allowed. Connectivity/ports/traffic to the domain is allowed after 2 minutes. That is why i would like to create a local batch file on each machine and after 2 minutes it talks to the domain controller and gets the login script of that particular user.
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 81

Expert Comment

ID: 39585160
support tools, have a sleep command that you can use sleep 120 to delay processing by two minutes.

Expert Comment

ID: 39589807
ping -w 120000 -n 1

would make ping wait for 120s before continuing the script.

If that's the way you want to go.

Author Comment

ID: 39590191
Thanks i will use that command (ping -w 120000 -n 1) but after it has ping for 120 seconds how can i call to get the user's logon script? That is set in the Active Directory?  Was thinking of something like %username%logonscript...

Accepted Solution

lindento earned 1500 total points
ID: 39592724

i don't know of a way to access AD properties in batch files.

i would take to full unc path to the script and do a call in the batch file


Best regards

Author Closing Comment

ID: 39659423

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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.

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

623 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