Hi,
For this Central Tips edition we are sharing a PowerShell script that queries multiple API endpoints and merges the results into a single CSV report, with one row per host.
Consider the following before you use this script-based solution to update your users:
- You must be a Master Account Holder. Otherwise, you won't be able to retrieve your Company ID and PSK.
- Make sure you store your PSK in a secure place, for example in a password manager, like LastPass. This way, you can easily retrieve the key whenever you need it.
- For advanced customization of the script, make sure you have the right programming skills as GoTo does not provide support for this solution.
The following endpoints are queried:
- Host list
- Custom fields
- Antivirus
- Windows Update
- Hardware inventory
- System inventory
By default, the script writes the CSV to stdout. Use -OutputPath to write directly to a file instead.
You can use the following parameters to filter or narrow the report:
Prepare and run the script
To run the PowerShell script, you must update it with your company's details. Here's how:
- Sign in to your LogMeIn Central account.
- Go to the Configuration > API menu and copy your CompanyID and PSK values.
- Download the PowerShell script from
https://github.com/goto-developers/central-public-api-demo/blob/main/get-aggregated-host-info/Get-AggregatedHostInfo.ps1
.
- Run the script with the necessary parameters as described below.
Customization options
While GoTo cannot assist with custom script development, you’ll find comprehensive API documentation to support your needs. Here are some examples of running the script with various parameters:
Print the full report to stdout
You can generate a full report and save it in CSV format.
.\Get-AggregatedHostInfo.ps1-CompanyId 123456-Psk "your-psk-here"
Input parameters:
- companyId: Your company's ID that you can find on the Configuration > API page.
- PSK: Your company's Pre-shared Key, found on the same page.
Write to a file, but exclude software and hardware inventory data
The advantage of excluding data areas is that you can speed up report generation.
.\Get-AggregatedHostInfo.ps1-CompanyId 123456-Psk "your-psk-here"-OutputPath .\hosts.csv -Exclude HardwareInventory,SystemInventory
Input parameters:
- companyId: Your company's ID that you can find on the Configuration > API page.
- PSK: Your company's Pre-shared Key, found on the same page.
- Exclude: Omits a comma-separated list of data areas from the report.
Only report on hosts in specific groups
You can select specific computer groups to run a report on.
.\Get-AggregatedHostInfo.ps1-CompanyId 123456-Psk "your-psk-here"-GroupNames "Sales","Support"
Input parameters:
- companyId: Your company's ID that you can find on the Configuration > API page.
- PSK: Your company's Pre-shared Key, found on the same page.
- GroupNames: Limits the report to groups matching specific names.