This script will document your SCOM 2012 and SCOM 2016 RunAs accounts, and the RunAs profiles they are associated to.
This is handy for collecting data for change management, making sure multiple management groups have the same configuration, and ensuring you have documented accounts prior to a major upgrade.
The script is based on the work if Dirk Brinkmann's 2012 script - located here: https://gallery.technet.microsoft.com/Listing-SCOM-2012-R2-24be56b1
The script does not take any parameters, you simply edit the management server name, and the directory you want the CSV file output:
# Constants section - make changes here
$ManagementServer = "scoma1.opsmgr.net"
$OutCsvPath = "C:\bin\out.csv"