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."
}