Parse JSON output from UAM Deploy apps to show version information in log

the logs for a Deploy Apps action on an image return the results as a JSON single string. This could be parsed and app name and version could be pulled and displayed in the logs so it would be easy to see the results, the app names, the previous version if it existed and the new version if it was updated. 

This is how it shows now in the logs:

the json gives us version and target version and app name, along with list of other apps detected:

{
  "Result": [
    {
      "Skipped": false,
      "Success": true,
      "Log": "Detect application [VideoLAN.VLC]\r\nApplication [VideoLAN.VLC] is found on target host\r\nPackageId: VideoLAN.VLC\r\nRepoUrl: https://cdn.winget.microsoft.com/cache\r\nVersion: > 3.0.20\r\nTarget version 3.0.21\r\nTry to upgrade\r\nUpgrade log:\r\nFound VLC media player [VideoLAN.VLC] Version 3.0.21\r\nThis application is licensed to you by its owner.\r\nMicrosoft is not responsible for, nor does it grant any licenses to, third-party packages.\r\nDownloading https://download.videolan.org/videolan/vlc/3.0.21/win64/vlc-3.0.21-win64.exe\r\nSuccessfully verified installer hash\r\nStarting package install...\r\nSuccessfully installed"
    },
    {
      "Skipped": true,
      "Success": true,
      "Log": "Detect application [Google.Chrome]\r\nApplication [Google.Chrome] is found on target host\r\nPackageId: Google.Chrome\r\nRepoUrl: https://cdn.winget.microsoft.com/cache\r\nVersion: 128.0.6613.138\r\nTarget version 128.0.6613.138\r\nUnable to upgrade\r\nSkipped"
    }
  ],
  "AllApps": [
    {
      "PackageId": "Microsoft.Edge",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "128.0.2739.67"
    },
    {
      "PackageId": "Microsoft.EdgeWebView2Runtime",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "128.0.2739.67"
    },
    {
      "PackageId": "Microsoft.Office",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "16.0.17726.20206"
    },
    {
      "PackageId": "Microsoft.OneDrive",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "24.166.0818.0003"
    },
    {
      "PackageId": "VideoLAN.VLC",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "> 3.0.20"
    },
    {
      "PackageId": "Microsoft.VCRedist.2015+.x64",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "14.26.28720.3"
    },
    {
      "PackageId": "Microsoft.VCRedist.2015+.x86",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "14.26.28720.3"
    },
    {
      "PackageId": "Google.Chrome",
      "RepoUrl": "https://cdn.winget.microsoft.com/cache",
      "Version": "128.0.6613.138"
    }
  ],
  "Log": [
    "Apps Manager v5.2",
    "Credential Manager exists",
    "Credentials for user was obtained",
    "A new Powershell session was successfully created",
    "OS type - workstation: Windows 10 Enterprise multi-session",
    "Checking if Winget is installed",
    "WinGet is installed",
    "Change directory to C:\\Program Files\\WindowsApps\\Microsoft.DesktopAppInstaller_1.22.11132.0_x64__8wekyb3d8bbwe",
    "Test winget - OK",
    "Test LGPO - OK",
    "Source found winget https://cdn.winget.microsoft.com/cache",
    "Source found msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0",
    "Register sources in user context:",
    "Source found winget https://cdn.winget.microsoft.com/cache",
    "Source found msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0",
    "Detect application [VideoLAN.VLC]",
    "Application [VideoLAN.VLC] is found on target host",
    "PackageId: VideoLAN.VLC",
    "RepoUrl: https://cdn.winget.microsoft.com/cache",
    "Version: > 3.0.20",
    "Target version 3.0.21",
    "Try to upgrade",
    "Upgrade log:",
    "Found VLC media player [VideoLAN.VLC] Version 3.0.21",
    "This application is licensed to you by its owner.",
    "Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.",
    "Downloading https://download.videolan.org/videolan/vlc/3.0.21/win64/vlc-3.0.21-win64.exe",
    "Successfully verified installer hash",
    "Starting package install...",
    "Successfully installed",
    "Detect application [Google.Chrome]",
    "Application [Google.Chrome] is found on target host",
    "PackageId: Google.Chrome",
    "RepoUrl: https://cdn.winget.microsoft.com/cache",
    "Version: 128.0.6613.138",
    "Target version 128.0.6613.138",
    "Unable to upgrade",
    "Skipped",
    "Detecting applications",
    "8 app(s) detected from winget source",
    "0 app(s) detected from msstore source",
    "Cleanup",
    "Remove PSSession"
  ]

 

It could instead output in the logs something like this, but include the skipped, success results.

0

Comments (3 comments)

Avatar
Dave Stephenson

Having the ability to get more verbose logs could be useful.
Are you thinking of having it always show in the logs or just have an option to download the logs if you're wanting more detail?

0
Avatar
Brian Stetson

Dave Stephenson I was thinking of always having it in the logs, being able to see at a glance rather than having to download logs. this saves time, and effort on some devices such as images. 

0
Avatar
Dave Stephenson

I think I'm understanding now.
Instead of the infinity scroll we do for the JSON (currently), you're wanting it to be more like our scripted actions where it displays part of the log but clicking show more... will show the entire log.
Right now, trying to copy the JSON (or even just viewing it) is kind of annoying.

0

Please sign in to leave a comment.