func collectPlatformDependentApplicationData() []model.ApplicationData {
	var data, apps []model.ApplicationData
	var cmd string
	var err error
	exeArch := runtime.GOARCH
	log.GetLogger().Debugf("Exe architecture as detected by golang runtime - %v", exeArch)
	osArch := detectOSArch(PowershellCmd, ArgsForDetectingOSArch)
	log.GetLogger().Debugf("Detected OS architecture as - %v", osArch)
	if strings.Contains(osArch, KeywordFor32BitArchitectureReportedByPowershell) {
		if exeArch != Architecture64BitReportedByGoRuntime {
			cmd = ConvertGuidToCompressedGuidCmd + ArgsToReadRegistryFromProducts + ArgsToReadRegistryFromWindowsCurrentVersionUninstall
			apps = executePowershellCommands(PowershellCmd, cmd, model.Arch32Bit)
			data = append(data, apps...)
		} else {
			log.GetLogger().Error("Detected an unsupported scenario of 64 bit aliyun OOS agent running on 32 bit windows OS - nothing to report")
		}
	} else if strings.Contains(osArch, KeywordFor64BitArchitectureReportedByPowershell) {
		if exeArch == Architecture64BitReportedByGoRuntime {
			cmd = ConvertGuidToCompressedGuidCmd + ArgsToReadRegistryFromProducts + ArgsToReadRegistryFromWow6432Node
			apps = executePowershellCommands(PowershellCmd, cmd, model.Arch32Bit)
			data = append(data, apps...)
			if data != nil && len(data) > ApplicationCountLimit {
				err = fmt.Errorf(ApplicationCountLimitExceeded+", got %d", len(data))
				log.GetLogger().WithError(err).Error("collection application failed")
				return []model.ApplicationData{}
			}
			cmd = ConvertGuidToCompressedGuidCmd + ArgsToReadRegistryFromProducts + ArgsToReadRegistryFromWindowsCurrentVersionUninstall
			apps = executePowershellCommands(PowershellCmd, cmd, model.Arch64Bit)
			data = append(data, apps...)
		} else {
			cmd = ConvertGuidToCompressedGuidCmd + ArgsToReadRegistryFromProducts + ArgsToReadRegistryFromWow6432Node
			apps = executePowershellCommands(PowershellCmd, cmd, model.Arch32Bit)
			data = append(data, apps...)
			if data != nil && len(data) > ApplicationCountLimit {
				err = fmt.Errorf(ApplicationCountLimitExceeded+", got %d", len(data))
				log.GetLogger().WithError(err).Error("collection application failed")
				return []model.ApplicationData{}
			}
			cmd = ConvertGuidToCompressedGuidCmd + ArgsToReadRegistryFromProducts + ArgsToReadRegistryFromWindowsCurrentVersionUninstall
			apps = executePowershellCommands(SysnativePowershellCmd, cmd, model.Arch64Bit)
			data = append(data, apps...)
		}
	} else {
		log.GetLogger().Error("Can't find application data because unable to detect OS architecture - nothing to report")
	}
	if data != nil && len(data) > ApplicationCountLimit {
		err = fmt.Errorf(ApplicationCountLimitExceeded+", got %d", len(data))
		log.GetLogger().WithError(err).Error("collection application failed")
		return []model.ApplicationData{}
	}
	return data
}
collectPlatformDependentApplicationData collects application data for windows platform
package application
import (
	"encoding/json"
	"fmt"
	"os/exec"
	"runtime"
	"strings"
	"github.com/aliyun/aliyun_assist_client/agent/log"
	"github.com/aliyun/aliyun_assist_client/agent/inventory/model"
)
const (
	PowershellCmd                                   = "powershell"
	SysnativePowershellCmd                          = `C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe `
	ArgsForDetectingOSArch                          = `get-wmiobject -class win32_processor | select-object addresswidth`
	KeywordFor64BitArchitectureReportedByPowershell = "64"
	KeywordFor32BitArchitectureReportedByPowershell = "32"
	Architecture64BitReportedByGoRuntime            = "amd64"
	ConvertGuidToCompressedGuidCmd = `function Convert-GuidToCompressedGuid {
						[CmdletBinding()]
						[OutputType('System.String')]
						param (
							[Parameter(ValueFromPipeline="", ValueFromPipelineByPropertyName="", Mandatory=$true)]
							[string]$Guid
						)
						begin {
							$Guid = $Guid.Replace('-', '').Replace('{', '').Replace('}', '')
						}
						process {
							try {
								$Groups = @(
									$Guid.Substring(0, 8).ToCharArray(),
									$Guid.Substring(8, 4).ToCharArray(),
									$Guid.Substring(12, 4).ToCharArray(),
									$Guid.Substring(16, 16).ToCharArray()
								)
								$Groups[0..2] | foreach {
									[array]::Reverse($_)
								}
								$CompressedGuid = ($Groups[0..2] | foreach { $_ -join '' }) -join ''
								$chararr = $Groups[3]
								for ($i = 0; $i -lt $chararr.count; $i++) {
									if (($i % 2) -eq 0) {
										$CompressedGuid += ($chararr[$i+1] + $chararr[$i]) -join ''
									}
								}
								$CompressedGuid
							} catch {
								Write-Error $_.Exception.Message
							}
						}
					}
                    function Clean-Quotes-Backslash {
                         param ([string]$str)
                         if($str.length -ge 2 -and $str.Substring(0,1) -eq '"' -and $str.Substring($str.length - 1) -eq '"'){
                                 $str = $str.Substring(1, $str.length - 2)
                             }
                         $str = $str.Replace('\', '\\')
                         $str = $str.Replace('"', '\"')
                         return $str
                     }
				     `
	ArgsToReadRegistryFromProducts = `$products = Get-ItemProperty HKLM:\Software\Classes\Installer\Products\* | Select-Object  @{n="PSChildName";e={$_."PSChildName"}} |
				      Select -expand PSChildName
				     `
	RegistryPathCurrentVersionUninstall            = `HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*`
	RegistryPathWow6432NodeCurrentVersionUninstall = `HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*`
	ArgsToReadRegistryApplications                 = `
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Get-ItemProperty %v |
Where-Object {($_.DisplayName -ne $null -and $_DisplayName -ne '' -and $_.DisplayName -notmatch '^KB[000000-999999]') -and
	($_.UninstallString -ne $null -and $_.UninstallString -ne '') -and
	($_.SystemComponent -eq $null -or ($_.SystemComponent -ne $null -and $_.SystemComponent -eq '0'))  -and
	($_.ParentKeyName -eq $null) -and
	($_.WindowsInstaller -eq $null -or ($_.WindowsInstaller -eq '0') -or ($_.WindowsInstaller -eq 1 -and $products -contains (Convert-GuidToCompressedGuid $_.PSChildName))) -and
	($_.ReleaseType -eq $null -or ($_.ReleaseType -ne $null -and
		$_.ReleaseType -ne 'Security Update' -and
		$_.ReleaseType -ne 'Update Rollup' -and
		$_.ReleaseType -ne 'Hotfix'))
} |
Select-Object @{n="Name";e={$_."DisplayName"}},
	@{n="PackageId";e={$_."PSChildName"}}, @{n="Version";e={$_."DisplayVersion"}}, Publisher,
	@{n="InstalledTime";e={[datetime]::ParseExact($_."InstallDate","yyyyMMdd",$null).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")}} | %% { [Console]::WriteLine(@"
{"Name":"$(Clean-Quotes-Backslash $_.Name)","PackageId":"$($_.PackageId)","Version":"$(Clean-Quotes-Backslash $_.Version)","Publisher":"$(Clean-Quotes-Backslash $_.Publisher)","InstalledTime":"$($_.InstalledTime)"},
"@)} `
)
var ArgsToReadRegistryFromWindowsCurrentVersionUninstall = fmt.Sprintf(ArgsToReadRegistryApplications, RegistryPathCurrentVersionUninstall)
var ArgsToReadRegistryFromWow6432Node = fmt.Sprintf(ArgsToReadRegistryApplications, RegistryPathWow6432NodeCurrentVersionUninstall)
var cmdExecutor = executeCommand
func executeCommand(command string, args ...string) ([]byte, error) {
	return exec.Command(command, args...).CombinedOutput()
}