Health and monitoring of a NC installation

I have made this little PowerShell script for a quick and dirty initial status and version control of my Nextcloud setup. All it requires is an App password on a user which can access the System settings hence have rights to access the serverinfo API.

$Response = Invoke-WebRequest -Uri “https://your.domain.tld/ocs/v2.php/apps/serverinfo/api/v1/info?format=json” -Headers @{Authorization = (“Basic " + [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(”$(‘USERNAME’):$(‘APP PASSWORD’)")))} | ConvertFrom-Json; Write-Host “==== NextCloud Production Status ====”; Write-Host “Status: “$Response.ocs.meta.statuscode “(”$Response.ocs.meta.status”)”; Write-Host "Version: "$Response.ocs.data.nextcloud.system.version; Write-Host "PHP: "$Response.ocs.data.server.php.version

Use it as is from a powershell coonsole, or modify it however you like to output the data for convenient use by better graphical tools.