Skip to content

cloudthinker-ai/CloudSkills / skills/connections/managing-lansweeper

managing-lansweeper

Verified

Use when working with Lansweeper — lansweeper IT asset discovery and inventory management covering network scanning, hardware and software inventory, compliance reporting, and vulnerability assessment. Use when discovering devices across the network, auditing installed software and patch levels, generating compliance reports for IT assets, or identifying unauthorized or unmanaged devices on the network.

Lansweeper IT Asset Discovery & Inventory Skill

Manage and analyze Lansweeper asset discovery, inventory, and compliance.

API Conventions

Authentication

All API calls use personal access token or OAuth2 — injected automatically.

Base URL

https://api.lansweeper.com/api/v2

Core Helper Function

#!/bin/bash

ls_api() {
    local method="$1"
    local endpoint="$2"
    local data="${3:-}"

    if [ -n "$data" ]; then
        curl -s -X "$method" \
            -H "Authorization: Bearer $LANSWEEPER_TOKEN" \
            -H "Content-Type: application/json" \
            "${LANSWEEPER_URL:-https://api.lansweeper.com}/api/v2${endpoint}" \
            -d "$data"
    else
        curl -s -X "$method" \
            -H "Authorization: Bearer $LANSWEEPER_TOKEN" \
            -H "Content-Type: application/json" \
            "${LANSWEEPER_URL:-https://api.lansweeper.com}/api/v2${endpoint}"
    fi
}

Common Operations

Asset Discovery

#!/bin/bash
echo "=== GraphQL: Asset Summary by Type ==="
curl -s -X POST \
    -H "Authorization: Bearer $LANSWEEPER_TOKEN" \
    -H "Content-Type: application/json" \
    "https://api.lansweeper.com/api/v2/graphql" \
    -d '{
        "query": "query { site { id name assetResources(pagination: {limit: 50, page: 1}, fields: [\"assetBasicInfo.name\", \"assetBasicInfo.type\", \"assetBasicInfo.ipAddress\", \"assetBasicInfo.lastSeen\"]) { total items { url key fields { value } } } } }"
    }' | jq -r '.data.site.assetResources | "Total assets: \(.total)"'

Hardware Inventory

#!/bin/bash
echo "=== Hardware Inventory ==="
curl -s -X POST \
    -H "Authorization: Bearer $LANSWEEPER_TOKEN" \
    -H "Content-Type: application/json" \
    "https://api.lansweeper.com/api/v2/graphql" \
    -d '{
        "query": "query { site { assetResources(fields: [\"assetBasicInfo.name\", \"assetBasicInfo.type\", \"assetBasicInfo.manufacturer\", \"assetBasicInfo.model\", \"assetBasicInfo.lastSeen\"], pagination: {limit: 25}, filters: {conjunction: AND, conditions: [{path: \"assetBasicInfo.type\", operator: EQUAL, value: \"Windows\"}]}) { total items { key fields { value } } } } }"
    }' | jq -r '.data.site.assetResources.items[:25] | .[] | [.fields[].value] | join("\t")' | column -t

Software Inventory

#!/bin/bash
echo "=== Installed Software Across Assets ==="
curl -s -X POST \
    -H "Authorization: Bearer $LANSWEEPER_TOKEN" \
    -H "Content-Type: application/json" \
    "https://api.lansweeper.com/api/v2/graphql" \
    -d '{
        "query": "query { site { assetResources(fields: [\"assetBasicInfo.name\", \"softwares.name\", \"softwares.version\"], pagination: {limit: 25}) { total items { key fields { value } } } } }"
    }' | jq -r '.data.site.assetResources.items[:20] | .[] | [.fields[].value] | join("\t")' | column -t

Compliance Reporting

#!/bin/bash
echo "=== Assets Not Seen in 30 Days ==="
THRESHOLD=$(date -u -d '30 days ago' +%Y-%m-%dT%H:%M:%SZ)
curl -s -X POST \
    -H "Authorization: Bearer $LANSWEEPER_TOKEN" \
    -H "Content-Type: application/json" \
    "https://api.lansweeper.com/api/v2/graphql" \
    -d "{
        \"query\": \"query { site { assetResources(fields: [\\\"assetBasicInfo.name\\\", \\\"assetBasicInfo.type\\\", \\\"assetBasicInfo.lastSeen\\\"], pagination: {limit: 25}, filters: {conjunction: AND, conditions: [{path: \\\"assetBasicInfo.lastSeen\\\", operator: LESS_THAN, value: \\\"${THRESHOLD}\\\"}]}) { total items { key fields { value } } } } }\"
    }" | jq -r '.data.site.assetResources | "Stale assets: \(.total)"'

Output Format

Present results as a structured report:

Managing Lansweeper Report
══════════════════════════
Resources discovered: [count]

Resource       Status    Key Metric    Issues
──────────────────────────────────────────────
[name]         [ok/warn] [value]       [findings]

Summary: [total] resources | [ok] healthy | [warn] warnings | [crit] critical
Action Items: [list of prioritized findings]

Target ≤50 lines of output. Use tables for multi-resource comparisons.

Anti-Hallucination Rules

  1. NEVER assume resource names — always discover via CLI/API in Phase 1 before referencing in Phase 2.
  2. NEVER fabricate metric names or dimensions — verify against the service documentation or --help output.
  3. NEVER mix CLI commands between service versions — confirm which version/API you are targeting.
  4. ALWAYS use the discovery → verify → analyze chain — every resource referenced must have been discovered first.
  5. ALWAYS handle empty results gracefully — an empty response is valid data, not an error to retry.

Counter-Rationalizations

ShortcutCounterWhy
"I'll skip discovery and check known resources"Always run Phase 1 discovery firstResource names change, new resources appear — assumed names cause errors
"The user only asked for a quick check"Follow the full discovery → analysis flowQuick checks miss critical issues; structured analysis catches silent failures
"Default configuration is probably fine"Audit configuration explicitlyDefaults often leave logging, security, and optimization features disabled
"Metrics aren't needed for this"Always check relevant metrics when availableAPI/CLI responses show current state; metrics reveal trends and intermittent issues
"I don't have access to that"Try the command and report the actual errorAssumed permission failures prevent useful investigation; actual errors are informative

Common Pitfalls

  • GraphQL API: Lansweeper Cloud uses GraphQL — not REST — construct queries carefully
  • Field paths: Use dot-separated field paths like assetBasicInfo.name, softwares.name
  • Pagination: Use pagination: {limit: N, page: N} — check total in response
  • Site context: Queries run against a specific site — multi-site deployments need site selection
  • Filter operators: Available operators include EQUAL, NOT_EQUAL, CONTAINS, LESS_THAN, GREATER_THAN
  • Rate limits: Cloud API has rate limits — check response headers
  • Scan freshness: lastSeen indicates last successful scan — stale data means the asset may be offline
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 466kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 192kUpdated Claude CodeCodexVerifiedInstall