This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Powershell create bulk tickets in Solarwinds Web Helpdesk

Hi, I am trying to create a powershell script that will create multiple tickets in solarwinds based off the security groups in Active Directory.  This is for my companies termination process.  I am an user administrator to multiple outside vendor websites, where we create access to the sites for the employees in my company.  I am responsible for disabling there access in those websites when they are terminated.  Because we have nearly 100 different website applications that we grant access to, knowing what application each user has access to is hard. So we created security group markers in AD to let us know what application they are in.

I need to create individual tickets for each security group, instead of doing it manual.  I would like to automate it by creating a powershell script to create the individual tickets.  Is this possible?

Any assistance would be appreciated.

#Loop through each row containing user details in the CSV file

foreach ($User in $bulkTerms)

{

$Termeduser = Get-ADUser -Identity $User.SamAccountName -Properties *

$Date = Get-Date -format s

$termticket = @{

  "reportDateUtc" = $Date,

  "room": "",

  "emailTech": true,

  "emailTechGroupLevel": false,

  "emailGroupManager": false,

  "emailCc": false,

  "ccAddressesForTech": "ADD Email",

  "emailBcc": false,

  "bccAddresses": "",

  "subject": "Terminate Access",

  "detail": "Terminate access in Application.",

  "assignToCreatingTech": false,

  "problemtype": {

    "type": "ProblemType",

    "id": 6

  },

  "sendEmail": false,

  "location": {

    "type": "Location",

    "id": 1

  },

  "department": {

    "type": "Department",

    "id": 1

  },

  "clientReporter": {

    "type": "Client",

    "id": 1

  },

  "customField_1": "Version 9.1.7",

  "statustype": {

    "type": "StatusType",

    "id": 1

  },

  "prioritytype": {

    "type": "PriorityType",

    "id": 1

  },

  "assets": [

    {

      "id": 1,

      "type": "Asset"

    },

    {

      "id": 2,

      "type": "Asset"

    }

  ]

}

{

if (Get-ADUser -F {SamAccountName -eq $SAM}) {

$json = $termticket | ConvertTo-Json

Invoke-RestMethod whd/.../ra -Method POST -Body $json -ContentType "application/json" -Verbose 

}

else

{

#If user does not exist in Active Directory

Write-Warning "A user account with username $SAM does not exist in Active Directory."

}

  • You would likely have to call the WHD rest API programmatically from Powershell.

    Here is the API guide Web Help Desk REST API Guide

  • Thank you for your reply, and I understand that I would have to call the WHD API from Powershell.  Each security group in AD needs its own individual ticket. Can that be done?  Can I define a specific security group to a custom field in the WebHelp desk.  So that when I run the script it would look at the name of the security group in Active directory and know what custom field needs to be selected.

    Example:

    Security Group 1 in AD -> Custom Field 1 in WHD

    Security Group 2 in AD -> Custom Field 2 in WHD

    etc...etc...

    Is this possible?

  • Custom fields are only assignable to request types, not users or user groups. There also is no way to build in logic you can upvote this existing feature request for that one( ).

    I don't know if you can somehow do that programmatically via powershell to figure it out and past in to a custom field.