Jump to content

Get PC answers to use as PShell variables

Dan Munns

Recommended Posts


I am looking at ITOM to automate our user creation processes. I have looked at the Hornbill provided libraries but as we use a hybrid Azure AD setup, they don't look to be what we would need. 

We use the PShell command New-RemoteMailbox on our on prem exchange server to create the user and mailbox account as this creates the user on-prem AD account and mailbox as well as the associated mailbox in exchange on-line. 

As such I would need to be able to take PC answers from the request and use them as variables in a powershell script. I have looked on the wiki to no avail.

Is this possible to do?



Link to comment
Share on other sites

Hi @Dan Munns,

There are a couple of ways you could do this:

  1. You could write the answers into request custom fields, then pass the values through as input parameters to your package operation, reading them in the PowerShell and using however you need;
  2. In the PowerShell, you could make an API call to Hornbill to get the questions for the request you're processing, then extract and use the information from the response. You'd want to use the data::entityBrowseRecords2 API, something like this if you're using the HornbillAPI Module:
Set-HB-Instance -Instance "yourinstance" -Key "yourapikey"
Add-HB-Param "application" "com.hornbill.servicemanager"
Add-HB-Param "entity" "Questions"
Open-HB-Element "searchFilter"
Add-HB-Param "column" "h_entity_ref"
Add-HB-Param "value" $TheRequestReference
Add-HB-Param "matchType" "exact"
Close-HB-Element "searchFilter"
$Questions = Invoke-HB-XMLMC "data" "entityBrowseRecords2"

Let me know if you need anything else.



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...