A Simple Self Request Form using PowerShell and NODE.JS

In this blog post I will walk you through the simple steps to create a self request form using PowerShell and NODE.JS. As you guessed, I used the below packages to make my job easy.

  1. Express
  2. node-powershell
  3. pug

Our goal is to deliver a form as illustrated below!

First Name:
Last Name:
Copyright © 2018 Chendrayan Venkatesan

Looks simple and clean which is more than enough for our demo. Let’s focus the steps to back fill information from Active Directory. The field values like First Name , Last Name, Email and Department will be back filled from Active Directory!

Get Started

Navigate to your desired location create a project root folder and in our case we created as xSelfServiceRequestForm and below that create views and scripts folder where views holds index and RequestForm landing pages named index.pug and RequestForm.pug respectively.  Place the PowerShell script file GetUserInformation.ps1 under scripts folder. The structure appears as illustrated below


Install required packages

Now we are in the root folder i.e xSelfServiceRequestForm which is the correct location to start the project work.

Just follow the instructions and key in the required information which yields the package.json file in the root folder. Now, install all required packages in one using the below snippet

Which yields the package.json file as illustrated below.

Let’s code

Open server.js and use the below code

PUG File

The RequestForm.pug code appears as shown below

PowerShell Code

It’s your choice to use AD module or ADSI module. But, I used a snippet as shown below



Welcome Chendrayan Venkatesan

Employee Onboarding Form

First Name:
Last Name:

Copyright © 2018 Chendrayan Venkatesan

Cool! It’s just a beginning and in my next blog I will explain the POST method in detail until then enjoy PowerShell. Follow me on twitter @ChendrayanV!

Leave a Reply

Your email address will not be published. Required fields are marked *