<# .SYNOPSIS Installs/configures the Datto RMM agent, fetches site lists, and optionally saves the site list to disk. .DESCRIPTION Centralizes Datto RMM operations in one function: - Fetch API credentials from a webhook (-UseWebhook) - Acquire OAuth token - Fetch site list (-FetchSites) - Save site list to Desktop as JSON or CSV (-FetchSites + -SaveSitesList) - Write site variables to registry (-PushSiteVars) - Download & launch the RMM agent installer (-InstallRMM) - Save a copy of the installer (-SaveCopy) .PARAMETER UseWebhook Fetches ApiUrl, ApiKey, and ApiSecretKey from the webhook when used with WebhookPassword. .PARAMETER WebhookPassword Password for authenticating to the credentials webhook. .PARAMETER WebhookUrl URL of the credentials webhook. Defaults to $Global:DattoWebhookUrl. .PARAMETER ApiUrl Direct Datto API endpoint URL (if not using webhook). .PARAMETER ApiKey Direct Datto API key (if not using webhook). .PARAMETER ApiSecretKey Direct Datto API secret (if not using webhook). .PARAMETER FetchSites Fetches the list of sites and skips all install steps. .PARAMETER SaveSitesList Saves the fetched site list to Desktop using OutputFile. Must be used with -FetchSites. .PARAMETER OutputFile Filename for saving the site list (.json or .csv). Defaults to 'datto_sites.csv'. .PARAMETER PushSiteVars Writes fetched site variables into HKLM:\Software\SVS\Deployment. .PARAMETER InstallRMM Downloads and runs the Datto RMM agent installer. .PARAMETER SaveCopy Saves a copy of the downloaded agent installer to C:\Temp. .PARAMETER SiteUID Unique identifier of the Datto site (required for install and registry push). .PARAMETER SiteName Friendly name of the Datto site (used for logging). .EXAMPLE # Fetch and save site list via webhook Install-DattoRMM -UseWebhook -WebhookPassword 'Tndmeeisdwge!' -FetchSites -SaveSitesList -OutputFile 'sites.csv' .EXAMPLE # Headless install with site variables Install-DattoRMM -ApiUrl 'https://api.example.com' -ApiKey 'KeyHere' -ApiSecretKey 'SecretHere' \ -SiteUID 'site-123' -SiteName 'Acme Corp' -PushSiteVars -InstallRMM .EXAMPLE # Download and save installer to C:\Temp without installing Install-DattoRMM -ApiUrl 'https://api.example.com' -ApiKey 'KeyHere' -ApiSecretKey 'SecretHere' \ -SiteUID 'site-123' -SiteName 'Acme Corp' -SaveCopy #>