You probably want to authenticate with your server credentials:
$jamf = [JAMF]::new('https://jamf.example.com', (Get-Credential))
You probably want the authenticate with an environment variable. Here's how to create the environment variable:
$userpass = 'user|P@$$w0rd!' # Pipe chars (|) are supported in the password but not the username.
$bytes = [System.Text.Encoding]::Utf8.GetBytes($userpass)
$env:JamfCreds = [Convert]::ToBase64String($bytes)
Here's how to use the environment variable:
$jamf = [JAMF]::new('https://jamf.example.com', (ConvertTo-SecureString $env:JamfCreds -AsPlainText -Force))
$computers = $jamf.getComputers()
$computers = $jamf.getManagedComputers()
$computerId = 1142
$extensionAttributes = $jamf.getComputerExtensionAttributes($computerId)
$computerId = 1142
$extensionAttributes = $jamf.getComputerExtensionAttribute($computerId, 'lldp')
$jamf = [JAMF]::new('https://jamf.example.com', (ConvertTo-SecureString $env:JamfCreds -AsPlainText -Force))
[Collections.ArrayList] $lldps = @()
foreach ($computer in $jamf.getManagedComputers()) {
$lldps.Add(@{
Id = $computer.id
Name = $computer.Name
LLDP = ([xml] $jamf.getComputerExtensionAttribute($computer.id, 'LLDP').values).lldp
}) | Out-Null
}