Using Flow and Forms for SCCM record import

Recently we have been looking for a way to make it easier for our Service Desk department to add records to SCCM in order to start a new PXE installation, without actually having access to the SCCM environment.

There are lots of commercial self services products on the market you can buy that might be able to create these workflows. However, if your company already has Office 365 licenses that include both Microsoft Forms and Microsoft Flow, it is perfectly possible to create these workflows yourself using a bit of imagination, some basic PowerShell knowledge and of course some technical understanding of SCCM.

Prerequisites are:

  • On-premises data gateway
  • Microsoft Forms
  • Microsoft Flow
  • A functioning SCCM environment

The Gateway

In order to connect Microsoft Flow to on-premise resources (like our SCCM environment) we need to install the Microsoft on-premises data gateway which you can download right here.

You can install the on-premises data gateway on any server, but your SCCM environment needs to be able to have access through PowerShell. I’ve installed the on-premises data gateway on one of my SCCM Site Server to make sure this access is provided.

The Installation itself is pretty simple.

 Just click the big, blue “Install” button and the rest will follow automatically.
After the installation, start the on-premises data gateway application and sign in with the Office 365 account your will use with Microsoft Flow.
 

The Form

Now, let’s start a Form in Microsoft Forms.

Go to https://forms.office.com and login with your Office 365 account.

Based on the complexity of the record you would like to create in SCCM you need to create the relevant “questions”.

At the very least, you need a field to fill either the MAC Address and/or SMBIOS GUID. SCCM needs this information to be able to know if your physical device needs to respond to the PXE advertisement you’ve deployed to the “Pre-Installation” collection we will create, later in this article.

I’ve also created fields to select Office 365 suite architecture (x86 or x64), OS language and keyboard layout, hardware type (notebook or VM) and the location of the office the device is installed in (I use this to eventually base the device name on).

Of course, you can create any kind of field that fits your needs.

The Flow

After you have filled out the form with the correct values, and click the “Submit” button, you need to tell Microsoft Flow to pickup this form.

We can start doing this by creating a new automated flow and choosing “When a new response is submitted” as a trigger.

 

Next, in the newly created automated flow, add an “Apply to each” action.

In the “Apply to each” action, you should be able to choose “List of response notifications”. Please select this and add the action “Get response details”

In the “Get response details” action, once again select the form you want to use in the “Form id” field.

In the “Response Id” field, select the “Expression” tab, and paste the following:

first(triggerBody()?['value'])?['resourceData']?['responseId']

The expression you’ve paste in takes the first item in the collection of responses the flow expects back, since there can only be one answer for the trigger this is fine and will never result in errors. You can recreate this expression by just choosing the ‘first’ statement in the dynamic content expression window, and then choosing response id from dynamic content.

After adding the expression, click on “Add an action” and select “Create CSV Table”

Extend the “Show advanced options” setting an choose “Custom”.

Now, you’ll get the option to add custom headers and select corresponding values. In the example below, I put simple headers like “macaddress”, “smbiosguid” and “hardwaretype”.

In the “Values” column you can select the corresponding sections from the client registration form Forms we’ve created first.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

formatDateTime(utcnow(),'yyyyMMddhhmmss')

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Using Flow and Forms for SCCM record import

Leave a Reply

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

Scroll to top