Using Task Scheduler, Batch File, and PowerShell
Overview
When PowerShell is used in conjunction with a batch file and Windows Task Scheduler, the Internet Portal Controller can be run continuously without requiring a Windows User login. However, it also requires that no other Windows Users be able to access the machine because this method ties the Office License to a single user. If there are no other Windows User accounts that will need access to run Microsoft Office on the controller machine and the access to this machine is limited to network administrators, then this is the recommended option.

In short, this method uses a combination of Windows Task Scheduler and PowerShell to run a batch file that gets started on machine startup (not Windows User login). The batch file is then designed to check every 15 seconds that DB Precision is running and will restart the application on reboot or application failure (rare) if DB Precision is not running.

Alternatively, to keep DB Precision running on the Internet Controller Server, you can either use a third-party product called AlwaysUp (click here for instructions), or a Windows Batch file (without PowerShell) in conjunction with Windows Task Scheduler (click here for instructions).
Implementation Steps
To run DB Precision on the Internet Controller Server using PowerShell, perform the following steps on that server.
  • Create Windows User for Controller: make sure the Windows User is not a Service Account User and has licensed access to Microsoft Office (Word and Excel). This is most easily done by logging in to the account an then opening each, making sure that you can open a document for both Word and Excel.
  • Create Batch File: create a text file in Notepad, copy the following, and save as a batch file named StartDBP.bat. Move this batch file to the application folder (c:\program files\pensionsoft\db precision).

    ECHO OFF

    SET DBPName=pension.exe
    SET DBPFullPath=C:\Program Files\PensionSoft\DB Precision\pension.exe

    :LoopStart

    TASKLIST | FINDSTR /I "%DBPName%"
    IF ERRORLEVEL 1 GOTO :StartDBP
    GOTO :LoopWait

    :StartDBP
    START "" "%DBPFullPath%"

    :LoopWait
    timeout /t 15 /nobreak
    GOTO :LoopStart

  • Create PowerShell File: create a text file in Notepad, copy the following, and save as a PowerShell script file named StartDBP.ps1. Move this file to the application folder as well (c:\program files\pensionsoft\db precision). For User Name (MyUserName) and Password (MyPassword) below, replace with these items for the user created in Step 1.

    $username = "MyUserName"
    $password = "MyPassword"
    $startWithElevatedRights = "c:\program files\pensionsoft\db precision\StartDBP.bat"
    $credentials = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
    $ps = Start-Process -LoadUserProfile -PassThru -FilePath powershell -Credential $credentials -ArgumentList '-command &{Start-Process ', $startWithElevatedRights, ' -Wait}'
    $ps.WaitForExit()
  • Open Windows Task Scheduler: from the Windows Start Menu, search for Task Scheduler and then open the program when located.
  • Create a New Task: Select "Create Task" under the Actions menu and then, assign a name to the task ("Start DBPPS" for example) along with a description ("Check every 15 seconds to ensure DB Precision is running" for example).



  • Specify Trigger: Select the Triggers tab at the top of the window and then press the "New" button. Use the dropdown menu at the top to select that the trigger "At startup".



  • Specify Action: Select the Actions tab at the top of the window and then press the "New" button. Use the dropdown to select that the action is to "Start a program". For the Program/script, enter Powershell.exe and for the Add arguments (optional), c:\program files\pensionsoft\db precision\StartDBP.ps1 -ExecutionPolicy bypass



  • Additional Options: continue by selecting the "Conditions" tab, and uncheck any boxes under "Power". Next, select the "Settings" tab and uncheck the boxes about how long the task is allowed to run and ending the task. Finally, select "Ok" to create the task.





  • DB Precision Configuration: open DB Precision on the controller account and log in by entering the user ID and password for the Internet Controller user account. Make sure to check the box "Do not show this screen on startup" and then press OK.



  • Launch Component Services (32-bit): launch Component Service by typing mmc comexp.msc /32 in the Windows Start menu. Find Microsoft Word (1997 - 2003) by navigating to Computers\My Computer\DCOM Config



    View the properties by right-clicking the Word item
    On the Identity Tab, change identity to "This user" and enter the User ID and password for the login (from the first step above).



    Repeat these same steps for Microsoft Excel Application.
  • Test the Configuration: Restart your server making sure that DB Precision opens and that users can both login as well as complete calculations on the portal (ensures that both Office and all drive access/mappings are properly configured).

With each new DB Precision release, this process keeping DB Precision always running will need to be temporarily stopped to allow for the update of DB Precision. To do this, please do the following:
  • Open Windows Task Manager: open Windows Task Manager by searching for this in Windows Start.
  • Stop the Batch File: on the Details tab, select cmd.exe and press the End Task button.
  • Stop DB Precision: still on the Details tab, select pension.exe and press the End Task button.
  • Update DB Precision: update DB Precision by copying the files indicated in the release notes or by running an updated setup file.
  • Open Windows Task Scheduler: from the Windows Start Menu, search for Task Scheduler and then open the program when located.
  • Restart Batch Process: right-click the task created above (Start DBPPS) and select Run from the resulting menu.

Prior Next
PensionSoft Corporation | 860.540.3690 | support@pensionsoft.com