Follow

How To Run Secondary .INI Files During, Before, or After Logon

Product: ProfileUnity          

Product Version: 6.0+

Expires on: 365 days from publish date

Updated: October 12, 2015

 

Problem:

A separate configuration needs to be executed either before, during, or after the existing configuration.

This can be useful in situations such as where a file needs to be unlocked before the main configuration executes, or another script needs to be run after execution.

 

Resolution:

1. Save the attached postLogon.exe file.

You can name the executable whatever you want; it is simply a fake executable used to run the secondary .ini file. 

Save the attached postLogon.exe file to a sub-folder on your Netlogon\ProfileUnity share (this is the default location, but you can save it in any folder that allows read permissions for users). 

Note: In this example the file was saved in %logonserver%\netlogon\ProfileUnity\Scripts to make sure it executes.


2. Editing the primary INI file

- Create a runonce key (using "Registry" module) and include the executable.

  • Action: Write Value
  • Hive: HKEY_CURRENT_USER
  • Key: Software\Microsoft\Windows\CurrentVersion\RunOnce
  • Type: REG_SZ
  • Value: Fake
  • Data:  %systemroot%\system32\cmd.exe /c \\your_domain\netlogon\ProfileUnity\Scripts\postLogon.exe


- In a trigger module create a rule with the following values

  • Type: "Application Open"
  • Module: Application Launcher (Note: Any module can be specified. However, in this example Application Launcher will be used.)
  • Application Name: postLogon.exe
  • INI Path: \\yourDomain\NETLOGON\Profileunity\scripts\secondary.ini (advanced section -  light blue tab)

NOTE: INI Path section indicates a location of the secondary INI file created later in this KB.


3. Editing Secondary INI file

Create a new 'manual configuration' (in this example it is called 'secondary').

This new configuration can do whatever you want (map a printer, remove a file lock, or execute a script. In the example below, an Application Launcher rule is used to create a script.

 

Example: Running a script in an alternate configuration

 

Filespec: %systemroot%\system32\cmd.exe
Arguments: /c c:\windows\system32\wscript.exe <path to a desired script> //b   (NOTE: make sure users can read form the path specified)

 

4. IMPORTANT: Save the .INI file in a sub-folder to keep it separate from the primary INI.

 

That will prevent an execution of the primary INI every time the user logs in. 

 

NOTE 1: The application will run elevated. This is the best way to workaround a problem. It is also a solution that will be supported with future versions of the product

NOTE 2: This solution will not work for Portability. Portability is run at logoff; therefore you would lose what ran initially at login.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.