Process Scheduler and Powershell

Process Scheduler and Powershell Scripts

The PeopleSoft Process Scheduler supports many different types of tools to run, but one thing it lacks is support to run shell scripts. Thankfully, David Kurtz offered a solution for that a while back, and revisted the solution recently. While making the process scheduler run shell scripts or Powershell scripts isn’t hard, the best part of David’s wrapper script is that it adds a layer to make your scripts API aware with the Process Monitor.

In my case, I have a number of Powershell scripts to run so I re-implemented David’s solution in Powershell. For a detailed description of how to configure shell scripts to run, visit here. The instructions below are an abbreviated version with small changes specific to Powershell.

All of the code is posted on GitHub in the ps-powershell repository. This is an Oracle-specific script, but it could easily be updated to work with SQL Server or DB2. To get started, download the scripts in the repository to c:\psft\tools.

Use Cases

There are a number uses for bringing Powershell scripts into the Process Monitor. The main use case I see is interfaces that are run from the OS you can now schedule and execute from within PeopleSoft. It’s common to use the Windows Task Scheduler to run Powershell scripts, but users have no visibility as to when the scripts run or if they completed successfully. Scheduling and executing those interfaces from the Process Monitor brings the visibility of the scripts into PeopleSoft where all your batch jobs are logged.

Configure the Process Type

To configure your process scheduler to run Powershell scripts, we need to configure a new Process Type and enable the server to run the new type.

  1. Navigate to PeopleTools > Process Scheduler > Process Type
  2. Add a new type called Powershell
  3. Select ORACLE as the Database Type and the Platform as Windows
  4. Select Other as the Generic Process Type
  5. For the Command Line, set it to powershell.exe
  6. The Parameter List is where we pass all of the arguments to our wrapper script. This is a longer string that I’ll break down:

    • -NoProfile: This tells Powershell to not run any profile scripts that could change your environment. It also helps speed up the start of Powershell scripts.
    • -ExecutionPolicy Bypass: Depending on your systems security level, you could exclude this option. This temporarily lowers the security policy for Powershell for the script you are running (but only for this script).
    • -File c:\psft\tools\psft.ps1: This is the location of the wrapper script.
    • -DBNAME %%DBNAME%% -ACCESSID %%ACCESSID%% -ACCESSPSWD %%ACCESSPSWD%% -PRCSINSTANCE %%INSTANCE%%: These are the required parameters the process scheduler will pass to the wrapper script.

    The full Paramter List is this: -NoProfile -ExecutionPolicy Bypass -File c:\psft\tools\psft.ps1 -DBNAME %%DBNAME%% -ACCESSID %%ACCESSID%% -ACCESSPSWD %%ACCESSPSWD%% -PRCSINSTANCE %%INSTANCE%%

  7. Set the working directory to c:\psft\tools

  8. Save the new Process Type

Next, we need to allow the new Process Types to run on your process scheduler.

  1. Navigate to PeopleTools > Process Scheduler > Servers
  2. Open your server definition (PSNT for me)
  3. In the “Process Types run on this Server” grid, add the Powershell Process Type and Save

Last, let’s configure the output format for the Powershell Process Types.

  1. Navigate to PeopleTools > Process Scheduler > System Settings
  2. Click the Process Type Output tab
  3. Select Other for the Process Type
  4. Check the Active checkbox for “Web” and also the Default checkbox
  5. Click the Process Output Format tab
  6. Select Other and Web, and then check the Active and Default checkboxes for the “Text Files (.txt)” row
  7. Save the changes

Our wrapper script is now configured for use.

Run Powershell Scripts

The wrapper script itself doesn’t do any process besides updating the Process Monitor tables. Next, let’s built a test script to verify we can run Powershell scripts. From the GitHub repository, we will use the test.ps1 script. Copy the test.ps1 script to c:\psft\tools\test.ps1

Next we will create a new Process Definition for the test script.

  1. Navigate to PeopleToos > Process Scheduler > Processes
  2. Click “Add a new value”
  3. Select Powershell as the Process Type
  4. Set the Process Name to PSTEST
  5. Add a Description: Test Powershell Script
  6. Click the Process Definition Options tab
  7. In the Process Security group box, set the Component to PRCSMULTI and the Process Group to TLSALL
  8. Click the Override Option tab
  9. Select “Append” for the Parameter List

    The append list is where we pass in commands that the psft.ps1 script will run for us. For our test script, we have one parameter to pass in addition to calling the script. We pass the database name to test.ps1 so it can print the database name.

    "c:\psft\tools\test.ps1 -DBNAME %%DBNAME%%"

    Make sure to wrap the parameter list in double quotes so that our wrapper script passes the entire string to our test.ps1 script.

  10. Save the new Process Definition.

Last, let’s test our new PSTEST process.

  1. Navigate to PeopleTools > Process Scheduler > System Process Request
  2. Add a new run control
  3. Click the Run button
  4. In the list of processes, select PSTEST and verify the output is “Web” and “TXT”
  5. Click OK

Go watch the process in Process Monitor and refresh the page. You should see the status of the process change from QUEUED to PROCESSING to DONE. When the process is done, go view the output under “View Log/Trace”.

#191 – Scheduled Migrations

This week on the podcast, Dan talks about a Terraform and Azure lab he attended, and some PeopleSoft 9.2 experiences. Kyle discusses the new Phire Scheduled Migrations and some great use cases for the new feature.

Show Notes

#187 – mitmproxy

This week on the podcast, Dan and Kyle talk about Tuxedo blocking IP addresses, the Kibana Dashboard and building custom visualizations, and Dan talks about using mitmproxy to troubleshoot integration errors.

Show Notes

#182 – PeopleSoft and Appsian w/ Chris Heller

This week on the podcast we interview Chris Heller. Chris shares fun stories from his days working at PeopleSoft and also talks about the work he is doing at Appsian.

We want to thank Appsian for sponsoring psadmin.conf 2019. Today is the last day to register!

Show Notes

  • Introducing Chris Heller @ 1:50
  • PeopleTools History @ 4:00
  • Building PeopleTools 8 @
  • PeopleTools Wishlist @
  • Starting GreyHeller @ 39:00
  • Application Security Platform @ 45:30
  • New Things at Appsian @ 53:00
  • Accessibility Improvements @ 59:00

#181 – Flood Stage

This week on the podcast, we share some MOS tips to stay updated on changes to PeopleSoft, Dan explains how Elasticsearch handles a full disk, and Kyle shares an “Oh No!” story.

Show Notes

#180 – PeopleTools 8.57 Hands-on

This week on the podcast, Jim Marion joins Kyle and Dan to talk about PeopleTools 8.57 and some of the lessons learned and things to watch out for in the new release. If you want to learn Fluid and improve your PeopleSoft Development skills, Jim has the best PeopleSoft training.

Show Notes

  • Branding Objects @ 3:30
  • Tile Wizard @ 8:00
  • Properties Editor in App Designer @ 11:45
  • Control-Delete @ 14:00
  • Unified Navigation – SSOTester @ 16:30
  • Push Notifications @ 18:45
  • Elasticsearch Plugins @ 20:30
  • Kibana Dashboard @ 21:00
  • Reload Web Profile @ 24:00
  • Macro Sets @ 28:00

#177 – The NavBar

This week on the podcast, Kyle follows up on the Hub routings and has a use case for them, Dan shares an XML Validation tool, and then they discuss if you should use the Navigator and NavBars with Fluid Navigation.

Show Notes