This is what I ended up doing with the GitHub Code from Philip Heede. Works great.
https://github.com/pheede/agsadmin-devsummit
static async Task DoWork()
{
AGSClient Client = new AGSClient("https://server:6080/arcgis/admin/", "user", "pwd");
await Client.Authenticate();
Console.Out.WriteLine("Authenticated against {0}: {1}", Client.ServerUrl, Client.IsAuthenticated);
Console.Out.WriteLine("Session expires at {0}", Client.TokenExpiration.ToLocalTime());
Console.Out.WriteLine("------------------");
// get status of all services in all folders
var folders = await Client.GetFolderNames();
Console.Out.WriteLine("The following folders are defined on the server:");
Console.Out.WriteLine("/");
foreach (string folder in folders)
{
Console.Out.WriteLine(folder);
}
Console.Out.WriteLine("------------------");
var taskServiceReports = await Client.GetAllServiceReports();
foreach (string folder in taskServiceReports.Keys)
{
Console.Out.WriteLine(folder);
foreach (var report in taskServiceReports[folder])
{
Console.Out.WriteLine(folder);
Console.Out.WriteLine(string.Format(" - {0}: {1}", report.serviceName, report.status.realTimeState.ToString()));
var manifest = await Client.GetServiceManifest(report, report.folderName);
foreach (var db in manifest.databases)
{
//Console.Out.WriteLine(db.onPremiseConnectionString);
foreach (var ds in db.datasets)
{
Console.Out.WriteLine(ds.onServerName);
}
}
}
}
Console.Out.WriteLine("------------------");
}