Categories: PowerShellScripts

Powershell: AutoTask – Get Picklist Values

When using AutoTask’s API it’s required to lookup a various amount of picklist values that are used in updating you’re web request. This is a powershell way to pull those picklist values. The first part of the script validates your AT URI, the second part gets the entity data, in this case I was looking for “ticket” related fields.

Edit: Updated to give a more friendly output

# Username and password for Autotask
$ATurl = "https://webservices1.autotask.net/atservices/1.5/atws.wsdl"
$ATusername = "{AT Username}"
$ATpassword = ConvertTo-SecureString "{AT Password}" -AsPlainText -Force
$ATcredentials = New-Object System.Management.Automation.PSCredential($ATusername,$ATpassword)

$atws = New-WebServiceProxy -URI $ATurl -Credential $ATcredentials
$zoneInfo = $atws.getZoneInfo($ATusername)
$ATurl = $zoneInfo.URL.Replace(".asmx",".wsdl")
$atws = New-WebServiceProxy -URI $ATurl -Credential $ATcredentials
 
$entity= $atws.getFieldInfo("Ticket")
 
foreach ($picklist in $entity) {
	$picklist | select Name,Label,Description | ft
	foreach ($values in $picklist.PicklistValues) { $values | select Label,Value,IsActive }
}

$output= $atws.getThresholdAndUsageInfo()
$output.EntityReturnInfoResults.message
TomLasswell

Share
Published by
TomLasswell

Recent Posts

Autotask: PowerShell: Enable Client Portal for all users

This is a quick one, it's been forever since I've posted here. After moving back…

2 years ago

PowerShell :: Get Exchange Mailboxes Over XXGB

Simple command turned crazy. I ended up coming up with this due to the fact…

3 years ago

PowerShell: ConnectWise Documents API, Uploading a document or attachment to a ticket

Phew, this one took a minute to figure out. ConnectWise has a form based documents…

5 years ago

PowerShell: ConnectWise REST API Query Contacts by Email Address

I've found myself at a new job, recreating many of the processes that I spent…

5 years ago

First post in a long time — changing hosting providers

Wow, it's been a while since I've done a real post on this site. I've…

6 years ago

PowerShell – NetApp Gather Volume Information

This is a simple script to gather volume information including dedupe schedule and autogrow settings.…

10 years ago