PowerShell Wrapper for the Auvik API
Description: Set the URI for API access. Will set Base URI to default of https://auvikapi.us1.my.auvik.com if no option is provided.
Options: [-BaseURI <URL>]
Options: [-DC <US|EU>]
Options: [-DC <US#|EU#>]
Set the Base URI to the US2 Datacenter
Add-AuvikBaseURI -DC US2
Description: Returns the URI configured for the current session
Options: None
Description: Removes the URI from the current session
Options: None
Description: Sets a credential for use in the current session
Options: [-UserName <Auvik Username>] [-ApiKey <User API Key>]
Description: Returns the current session credential object
Options: None
Description: Removes the credential from the current session
Options: None
Description: Stores the current session Module Settings including URI and Credential for later use for the current user only.
Options: None
Description: Loads previously exported settings.
Options: None
Description: Returns Alerts History
Options: [-ID <List of Alert IDs>]
Options: [-Tenants <List of Tenant IDs>] [-Entities <List of Entity IDs>]
[-AlertSpecificationID <Match for Alert Specification ID>]
[-Severity <unknown|emergency|critical|warning|info>]
[-Status <created|resolved|paused|unpaused>]
[-Dismissed <True|False>]
[-Dispatched <True|False>]
[-DetectedAfter <Datestamp for earliest record>]
[-DetectedBefore <Datestamp for latest record>]
Description: Returns Billing Information
Options: [-Tenant|PrimaryTenant <tenantdomainname>]
[-QueryTenant <tenantdomainname>] [-Descendants <all|children>]
[-Date|FromDate <Datestamp for earliest record>]
[-ToDate <Datestamp for latest record>]
[-Daily <True|False>]
Description: Returns Billing Details
Options: [-Tenant|PrimaryTenant <tenantdomainname>]
[-QueryTenant <tenantdomainname>] [-Descendants <all|children>]
[-Date|FromDate <Datestamp for earliest record>]
[-ToDate <Datestamp for latest record>]
[-Daily <True|False>]
Description: Returns Component Information
Options: [-ID <List of Component IDs>]
Options: [-Tenants <List of Tenant IDs>] [-Devices <List of Device IDs>]
[-DeviceName <Match for Device Name>]
[-CurrentStatus <ok|degraded|failed>]
[-ModifiedAfter <Datestamp for earliest record>]
Description: Returns information on device configurations.
Options: [-ID <Configuration ID>]
Options: [-Tenants <List of Tenant IDs>] [-Devices <List of Device IDs>]
[-BackupTimeAfter <Datestamp for earliest backup>]
[-BackupTimeBefore <Datestamp for latest backup>]
[-IsRunning <True|False|Null>]
Description: Test the current or provided credential to verify access. Returns the server response or True/False with -Quiet
Options: [-UserName <Auvik Username>] [-ApiKey <User API Key>] [-Quiet]
Options: [-Credential <Credential Object>] [-Quiet]
Description: Returns Device Information
Options: [-ID <List of Device IDs>] [-IncludeDetailFields <discoveryStatus,components,connectedDevices,configurations,manageStatus,interfaces>]
Options: [-Tenants <List of Tenant IDs>] [-Networks <List of Network IDs>]
[-MakeModel <Match for Make/Model>] [-VendorName <Match for Vendor>]
[-ModifiedAfter <Datestamp for earliest record>]
[-IncludeDetailFields <discoveryStatus,components,connectedDevices,configurations,manageStatus,interfaces>]
[-Status <online|offline|unreachable|testing|unknown|dormant|notPresent|lowerLayerDown>]
[-DeviceType <unknown|switch|l3Switch|router|accessPoint|firewall|workstation|server|storage|printer|copier|hypervisor|multimedia|phone|tablet|handheld|virtualAppliance|bridge|controller|hub|modem|ups|module|loadBalancer|camera|telecommunications|packetProcessor|chassis|airConditioner|virtualMachine|pdu|ipPhone|backhaul|internetOfThings|voipSwitch|stack|backupDevice|timeClock|lightingDevice|audioVisual|securityAppliance|utm|alarm|buildingManagement|ipmi|thinAccessPoint|thinClient>]
Description: Returns Device Details
Options: [-ID <List of Device IDs>]
Options: [-Tenants <List of Tenant IDs>] [-ManagedStatus <True|False|Null>]
[-SNMPDiscovery <disabled|determining|notSupported|notAuthorized|authorizing|authorized|privileged>]
[-WMIDiscovery <disabled|determining|notSupported|notAuthorized|authorizing|authorized|privileged>]
[-LoginDiscovery <disabled|determining|notSupported|notAuthorized|authorizing|authorized|privileged>]
[-VMWareDiscovery <disabled|determining|notSupported|notAuthorized|authorizing|authorized|privileged>]
Description: Returns Extended Device Information. Information varies by Device Type
Options: [-ID <List of Device IDs>]
Options: [-Tenants <List of Tenant IDs>] [-ModifiedAfter <Datestamp for earliest record>]
[-DeviceType <unknown|switch|l3Switch|router|accessPoint|firewall|workstation|server|storage|printer|copier|hypervisor|multimedia|phone|tablet|handheld|virtualAppliance|bridge|controller|hub|modem|ups|module|loadBalancer|camera|telecommunications|packetProcessor|chassis|airConditioner|virtualMachine|pdu|ipPhone|backhaul|internetOfThings|voipSwitch|stack|backupDevice|timeClock|lightingDevice|audioVisual|securityAppliance|utm|alarm|buildingManagement|ipmi|thinAccessPoint|thinClient>]
Description: Returns Audit Information
Options: [-ID <List of Audit IDs>]
Options: [-Tenants <List of Tenant IDs>] [-User <Match for User Name>]
[-Category <unknown|tunnel|terminal>]
[-Status <unknown|initiated|created|closed|failed>]
[-ModifiedAfter <Datestamp for earliest record>]
Description: Returns Note Information
Options: [-ID <List of Note IDs>]
Options: [-Tenants <List of Tenant IDs>] [-Entities <List of Entity IDs>]
[-EntityName <Match for Entity Name>]
[-User <Match for User Name>]
[-Type <root|device|network|interface>]
[-ModifiedAfter <Datestamp for earliest record>]
Description: Returns Interface Information
Options: [-ID <List of Interface IDs>]
Options: [-Tenants <List of Tenant IDs>] [-Devices <List of Device IDs>]
[-InterfaceType <ethernet|wifi|bluetooth|cdma|coax|cpu|firewire|gsm|ieee8023AdLag|inferredWired|inferredWireless|linkAggregation|loopback|modem|wimax|optical|other|parallel|ppp|rs232|tunnel|unknown|usb|virtualBridge|virtualNic|virtualSwitch|vlan|distributedVirtualSwitch|interface>]
[-AdminStatus <True|False|Null>]
[-OperationalStatus <online|offline|unreachable|testing|unknown|dormant|notPresent>]
[-ModifiedAfter <Datestamp for earliest record>]
Description: Returns Meta Data Field Information
Options: -Endpoint <endpoint name> -Field <field name>
Description: Returns Network Information
Options: [-ID <List of Network IDs>] [-IncludeDetailFields <scope,primaryCollector,secondaryCollectors,collectorSelection,excludedIpAddresses>]
Options: [-Tenants <List of Tenant IDs>] [-Devices <List of Device IDs>]
[-NetworkType <routed|vlan|wifi|loopback|network|layer2|internet>]
[-IncludeDetailFields <scope,primaryCollector,secondaryCollectors,collectorSelection,excludedIpAddresses>]
[-ScanStatus <true|false|notAllowed|unknown>]
[-ModifiedAfter <Datestamp for earliest record>]
Description: Returns Network Details
Options: [-ID <List of Network IDs>]
Options: [-Tenants <List of Tenant IDs>] [-Devices <List of Device IDs>]
[-NetworkType <routed|vlan|wifi|loopback|network|layer2|internet>]
[-IncludeDetailFields <scope,primaryCollector,secondaryCollectors,collectorSelection,excludedIpAddresses>]
[-ScanStatus <true|false|notAllowed|unknown>]
[-Scope <private|public>]
[-ModifiedAfter <Datestamp for earliest record>]
Description: Returns the list of tenant IDs available for the current user
Options: None
Return all tenants. Return managed devices for each tenant and return device counts for each type of device.
Import-Module AuvikAPI
If (Confirm-AuvikAPICredential -Quiet) {
$AuvikTenants = Get-AuvikTenants | Where-Object {$_.attributes.tenantType -eq 'client'}
ForEach ($tenant in $AuvikTenants) {
$TenantDevices = Get-AuvikDevicesInfo -Tenant $tenant.ID -IncludeDetailFields manageStatus
$ManagedDeviceIDs = $TenantDevices | Select-Object -ExpandProperty 'Included' -ErrorAction SilentlyContinue | Where-Object {$_.attributes.manageStatus -eq 'true'} | Select-Object -ExpandProperty 'ID' -ErrorAction SilentlyContinue
$ManagedDevices = $TenantDevices | Select-Object -ExpandProperty 'Data' -ErrorAction SilentlyContinue | Where-Object {$ManagedDeviceIDs -contains $_.ID}
$ManagedDevicesGroup = $ManagedDevices | Select-Object -ExpandProperty Attributes -ErrorAction SilentlyContinue | Group-Object -Property deviceType -AsHashTable -ErrorAction SilentlyContinue
If ($ManagedDevicesGroup) {
Write-Output "Client: $($tenant.attributes.domainPrefix)"
ForEach ($deviceType in $ManagedDevicesGroup.Keys) {
Write-Output "$deviceType,$($ManagedDevicesGroup.$deviceType.Count)"
}
}
}
}