Skip to content

UNT-CAS/JAMF-Class

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Usage

Authentication

Development

You probably want to authenticate with your server credentials:

$jamf = [JAMF]::new('https://jamf.example.com', (Get-Credential))

Production

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))

Get List of Computers

$computers = $jamf.getComputers()

Get List of Managed Computers

$computers = $jamf.getManagedComputers()

Get Extension Attributes from a Computer

$computerId = 1142
$extensionAttributes = $jamf.getComputerExtensionAttributes($computerId)

Get an Extension Attribute from a Computer

$computerId = 1142
$extensionAttributes = $jamf.getComputerExtensionAttribute($computerId, 'lldp')

Examples

Get LLDP Attribute from All Managed Computers

$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
}

Releases

No releases published

Packages

No packages published