Jump to content

Get PC answers to use as PShell variables


Recommended Posts

Hi,

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?

Thanks,

Dan

Link to post
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.

Cheers,

Steve

Link to post
Share on other sites

Thanks @Steve G

Am I correct in thinking then that is would be like this, with the custom field variable being the &[global["flowcoderefs"]["resultRef"]["customFieldA"]] bit?
image.png.d00fb00e05674b0d1fb0210cc3ee0044.png
 

Link to post
Share on other sites

@Dan Munns

Yeah that's correct, so in your node that's starting a job against this package operation in workflow, you'd have that variable in the PSVariable input parameter.

Link to post
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...