Obs/bin/GMA/Monitoring/Agent/Extensions/MetricsExtension/mdmDataCollection.ps1

<#
.SYNOPSIS
    Powershell script to collect data about Geneva Metrics (AKA MDM, AKA Geneva Hot Path) data publication.
.DESCRIPTION
    This script performs several operations for troubleshooting issues related to MetricsExtension such as:
    - Collection of metric traffic.
    - Collectio of information about the environment such as OS, processes running.
    - Collection of certificates.
    - Collection of logs.
    - Test connection to Frontends where we emit the metrics.
.EXAMPLE
    ./mdmDataCollection.ps1 -SkipAdminCheck -MetricCollectionDurationSec 60 -Table2CsvPath "C:/table2csv.exe"
.EXAMPLE
    ./mdmDataCollection.ps1 -SkipCollectionTsfLogs -SkipCollectionCertificates
.EXAMPLE
    ./mdmDataCollection.ps1 -LogicalDisks "C: D:"
.EXAMPLE
    ./mdmDataCollection.ps1 -MetricCollectionSizeMaxMB 100 -MetricCollectionDurationSec 60 -TimeOutSecondsSearchFiles -1
.EXAMPLE
    ./mdmDataCollection.ps1 -OutputDirectory "C:\dev"
#>


param (
    # If this switch is specified, the output of all commands will be showed in the output.
    [Parameter(Mandatory=$false)]
    [switch]$DebugMdmDataCollection = $false,

    # The arguments passed for the execution of table2csv.exe.
    # Default value: "-tail 150000"
    [Parameter(Mandatory=$false)]
    [string]$Table2CsvParameters = "-tail 150000",

    # It specifies the time we will be spent collecting the traffic of metrics in seconds.
    # Default value: 190
    [Parameter(Mandatory=$false)]
    [int]$MetricCollectionDurationSec = 190,

    # It specifies the maximum size in MB that will be stored from the collection of the metrics.
    # Default value: 500
    [Parameter(Mandatory=$false)]
    [int]$MetricCollectionSizeMaxMB = 500,

    # If this switch is specified, the check of admin permissions will be skipped
    [Parameter(Mandatory=$false)]
    [switch]$SkipAdminCheck = $false,

    # It specifies the path for cpprestutil.exe
    [Parameter(Mandatory=$false)]
    [string]$CppRestUtilPathParam = $null,

    # It specifies the path for table2csv.exe
    [Parameter(Mandatory=$false)]
    [string]$Table2CsvPathParam = $null,

    # The script needs to search files in the environment, this operation can be really long if your disk is not indexed.
    # This parameter allows you to set a TimeOut in the search. If you don't want to have TimeOut, pass the value -1.
    # Default value: 3600
    [Parameter(Mandatory=$false)]
    [int]$TimeOutSecondsSearchFiles = 3600,

    # It specifies the disks where we are going to search the files in the script.
    # Example for only searching in C: and D:, "C: D:". Use a whitespace as separator.
    [Parameter(Mandatory=$false)]
    [string]$LogicalDisksParam = $null,

    # If this switch is specified, the collection of tsf logs will be skipped.
    [Parameter(Mandatory=$false)]
    [switch]$SkipCollectionTsfLogs = $false,

    # If this switch is specified, the collection of certificates will be skipped.
    [Parameter(Mandatory=$false)]
    [switch]$SkipCollectionCertificates = $false,

    # It specifies in which directory the output is going to be stored.
    [Parameter(Mandatory=$false)]
    [string]$OutputDirectory = "..",

    # This is only used for tests purposes, please don't use it
    [Parameter(Mandatory=$false)]
    [switch]$ImportFunctions = $false
)

$ScriptVersion = "Windows-1.10"

$MeFrontendUrls = @(
    "global.prod.microsoftmetrics.com"
    "global.metrics.nsatc.net"
    "azglobal.metrics.nsatc.net"
)

$Ports = @(
    "80"
    "443"
)

$MeStamps = @(
    "https://global.prod.microsoftmetrics.com"
    "https://azglobal-red.prod.microsoftmetrics.com"
    "https://azglobal-black.prod.microsoftmetrics.com"
    "https://global.metrics.nsatc.net"
    "https://azglobal-red.azglobal.metrics.nsatc.net"
    "https://azglobal-black.azglobal.metrics.nsatc.net"
    "https://global.metrics.azure.microsoft.scloud"
    "https://global.metrics.azure.eaglex.ic.gov"
    "https://13.90.249.229"
    "https://40.77.24.27"
    "https://[2a01:111:f100:2000::a83e:33d6]"
    "https://[2603:1030:7::155]"
)

$StampPaths = @(
    "/public/lb-probe"
    "/public/monitoringAccount/MetricTeamInternalMetrics/acls"
)

$ExcludedEnvironmentVariables = @(
    "_NT_SYMBOL_PATH"
)

function Main
{
    Set-UTF8-Encoding

    Confirm-Admin-Permissions

    $mdmDataCollectionOutput = Get-MdmDataCollectionOutput
    $compressedDataOutput = Get-CompressedDataOutput $mdmDataCollectionOutput

    Show-Starting-Message

    Get-Logical-Disks
    $logicalDisks = Get-Content -Path .\LogicalDisks.txt

    $metricsExtensionPath = Get-File-Version "MetricsExtension.Native.exe" ".\MetricsExtensionProcesses.txt" "MetricsExtensionVersions.txt"

    $cppRestUtil = Search-CppRestUtil $metricsExtensionPath

    Test-ME-Stamps $mdmDataCollectionOutput $cppRestUtil

    Get-Etw-Session-And-IfxMetrics-At-Start

    Get-OS-And-Processes-Information

    Get-Local-Time-Information

    Get-Difference-Time-Server-And-Agent $cppRestUtil

    Get-Certificates

    Get-HTTP-Proxy-Configuration

    Get-Environment-Variables

    Get-Open-Sockets-And-Owning-Processes

    Test-Frontend-Urls

    Get-Application-Event-Logs

    Get-Raw-And-Aggregated-Metrics

    $commandLineArguments = Get-Command-Line-Arguments

    Get-Cached-Config $commandLineArguments

    Copy-Autopilot-Logs
    Get-Autopilot-Ini

    $monAgentHostPath = Get-File-Version "MonAgentHost.exe" ".\MonAgentHostProcesses.txt" "MonAgentHostVersions.txt"

    Get-Tsf-Logs $logicalDisks $mdmDataCollectionOutput $monAgentHostPath

    Get-Etw-Session-And-IfxMetrics-At-End

    Compress-Output $compressedDataOutput $mdmDataCollectionOutput

    Show-Ending-Message
}

function Set-UTF8-Encoding
{
    [void](chcp 65001)
}

function Confirm-Admin-Permissions
{
    if ($SkipAdminCheck) {
        Write-Warning "Administrative permissions check skipped due to SkipAdminCheck being set."
    }
    elseif(-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole(
        [Security.Principal.WindowsBuiltInRole] "Administrator"))
    {
        $errorMessage = "ERROR: This script has to be run with administrative permissions.`n"
        $errorMessage += "If you believe you have received this message due to an error, you can`n"
        $errorMessage += "skip this check by passing the command line parameter SkipAdminCheck."
        Write-Error $errorMessage
        break
    }
}

function Get-MdmDataCollectionOutput
{
    $folderSuffix = [DateTime]::UtcNow.ToString('yyyy_MM_dd_hh_mm_ss')
    $randomNumber = Get-Random
    $mdmDataCollectionOutput = "MdmDataCollectionOutput" + $folderSuffix + "_random_" + $randomNumber

    [void](Remove-Directory-If-It-Exists $mdmDataCollectionOutput)
    [void](mkdir $mdmDataCollectionOutput)
    [void](Set-Location $mdmDataCollectionOutput)

    return $mdmDataCollectionOutput
}

function Get-CompressedDataOutput([String]$mdmDataCollectionOutput)
{
    $compressedDataOutput = $mdmDataCollectionOutput + ".zip"

    return $compressedDataOutput
}

function Remove-Directory-If-It-Exists([String]$directory)
{
    if (Test-Path -Path $directory)
    {
        Write-Output "File $directory already exists deleting it before proceeding..."
        try
        {
            Invoke-Command "Remove-Item -LiteralPath $directory -Force -Recurse"
        }
        catch
        {
            Write-Error "Failed to delete the file ${directory}: $_. Aborting..."
        }
    }
}

function Show-Starting-Message
{
    $date = Get-Date
    Write-Output "Begin - MDM Data Collection Script - $date"
    Write-Output "Script version $ScriptVersion"
    Write-Output "Collecting general information..."
    Write-Output "MdmDataCollection script version $ScriptVersion" > AboutCollectionScript.txt
}

function Get-Logical-Disks
{
    Write-Output "Collecting information about logical disks"

    if (-Not [string]::IsNullOrEmpty($LogicalDisksParam))
    {
        $LogicalDisksParam = $LogicalDisksParam.Replace(" ", "`n")
        $LogicalDisksParam >> LogicalDisks.txt
    }

    else
    {
        $logicalDisks = Get-WmiObject -Class Win32_LogicalDisk

        foreach ($logicalDisk in $logicalDisks)
        {
            $logicalDisk.DeviceID >> LogicalDisks.txt
        }
    }
}

function Get-File-Version([String]$processName, [String]$inputFile, [String]$outputFile)
{
    Write-Host "Searching the process: $processName"
    wmic PROCESS WHERE "(Name='${processName}')" GET ExecutablePath /FORMAT:list | findstr "=" > $inputFile

    if ([String]::IsNullOrWhiteSpace((Get-content $inputFile)))
    {
        Write-Warning "The process $processName is not running"
        "The process $processName is not running" > $inputFile
        return
    }

    foreach ($process in Get-Content -Path $inputFile)
    {
        $executablePath = $process
        $prefix = "ExecutablePath="
        if ($executablePath.StartsWith($prefix))
        {
            $executablePath = $executablePath.Substring($prefix.Length)
        }
        Write-Output "$executablePath" >> $outputFile
        (Get-Item $executablePath).VersionInfo | format-list >> $outputFile
    }

    return $executablePath
}


function Search-CppRestUtil ([String]$metricsExtensionPath)
{
    if ((-Not [string]::IsNullOrEmpty($CppRestUtilPathParam)) -and (Test-Path -Path $CppRestUtilPathParam))
    {
        return $CppRestUtilPathParam
    }

    if (Test-Path -Path "..\CppRestUtil\CppRestUtil.exe")
    {
        return "..\CppRestUtil\CppRestUtil.exe"
    }

    if ($metricsExtensionPath.Contains("MetricsExtension\MetricsExtension.Native.exe"))
    {
        # MetricsExtension NuGet setup
        $possibleLocationCppRestUtil = $metricsExtensionPath.Replace("MetricsExtension\MetricsExtension.Native","CppRestUtil\CppRestUtil")
        if (Test-Path -Path $possibleLocationCppRestUtil)
        {
            return $possibleLocationCppRestUtil
        }

        # Monitoring Agent setup
        $possibleLocationCppRestUtil = $metricsExtensionPath.Replace("MetricsExtension.Native","CppRestUtil")
        if (Test-Path -Path $possibleLocationCppRestUtil)
        {
            return $possibleLocationCppRestUtil
        }
    }

    $warningMessage = "CppRestUtil was not found in the environment. Instead of CppRestUtil, internal Powershell tools will be used."
    $warningMessage += "Check more information in the following link: https://eng.ms/docs/cloud-ai-platform/azure-edge-platform-aep/aep-health-standards/observability/mdm/geneva-metrics-mdm/docs/tsg/customer-side/actions/winhttp-escalation#powershell-way"
    Write-Warning $warningMessage

    return [string]::Empty
}

function Get-Etw-Session-And-IfxMetrics-At-Start
{
    tasklist /M IfxMetrics.dll /FO CSV > ProcessLoadingIfxMetrics_At_Start.csv
    logman NativeMetricsExtension_Provider -ets > MetricsExtensionEtwSessionAtStart.txt
    logman -ets > EtwSessions.txt
}

function Get-OS-And-Processes-Information
{
    Get-WmiObject -Class Win32_OperatingSystem | Select-Object Caption, SystemDrive, Version > OS.txt
    Get-WmiObject -Class Win32_Process | Export-Csv -Path "AllProcesses.csv" -NoTypeInformation
}

function Get-Local-Time-Information
{
    Write-Output "Collecting time from ME client and server"

    Get-Date > DateTimeLocal.txt
    Get-TimeZone > TimeZoneInfo.txt
}

function Get-Difference-Time-Server-And-Agent([String]$cppRestUtil)
{
    if ([string]::IsNullOrEmpty($cppRestUtil))
    {
        Write-Warning "CppRestUtil.exe is not found. MdmDataCollection will not able to check if there is a difference of time between the server and the agent"
        return
    }

    $serverDate = Invoke-Expression "& '$cppRestUtil' https://global.prod.microsoftmetrics.com/public/lb-probe" | findstr /C:"Date"
    $serverDate > DateTimeServer.txt
    $serverDate = $serverDate.TrimStart("Date: ")
    $serverDate = Get-Date -Date "${serverDate}"
    $serverDateUtc = $serverDate.ToUniversalTime()

    $localDateUtc = [DateTime]::UtcNow

    $deltaMinutes = ($localDateUtc - $serverDateUtc).TotalMinutes

    if (($deltaMinutes -ge 1) -OR ($deltaMinutes -le -5))
    {
        "ERROR: There is a difference of ${deltaMinutes} minutes between ME client time and server time." > TimeDifferenceError.txt
        Write-Error "ERROR: There is a difference of ${deltaMinutes} minutes between ME client time and server time."
    }
}

function Get-Certificates
{
    if ($SkipCollectionCertificates)
    {
        Write-Warning "SkipCollectionCertificates has been set, skipping the collection of certificates."
    }
    else
    {
        certutil -silent -v -gmt -store "My" > Certificates_On_LocalMachine_My.txt
        certutil -user -v -gmt -silent -store "My" > Certificates_On_User_My.txt
    }
}

function Get-HTTP-Proxy-Configuration
{
    netsh winhttp dump > WinHttp_Config.txt
}

function Get-Environment-Variables
{
    Get-ChildItem env: | Where-Object -Value $ExcludedEnvironmentVariables -NotIn -Property Name > EnvironmentVariables.txt
}

function Test-ME-Stamps([String]$mdmDataCollectionOutput, [String]$cppRestUtil)
{
    Write-Output "Testing several MetricsExtension global endpoints"
    foreach ($meStamp in $MeStamps)
    {
        foreach ($stampPath in $StampPaths)
        {
            Test-Connection-To-URL $cppRestUtil $meStamp$stampPath >> .\CppRestUtilResults.txt
        }
    }
}

function Get-Open-Sockets-And-Owning-Processes
{
    Write-Output "Listing open sockets and owning processes"
    netstat -abno > ListeningSockets.txt
}

function Test-Frontend-Urls
{
    foreach ($meFrontendUrl in $MeFrontendUrls)
    {
        foreach ($port in $Ports)
        {
            $solvedDNS = Resolve-DnsName -Name $meFrontendUrl
            Write-Output "Running IPv4 against ${meFrontendUrl}:${port}" 1>> GlobalStamp_TCPPing.txt
            Test-NetConnection $solvedDNS.IP4Address -port ${port} -InformationLevel "Detailed" 1>> GlobalStamp_TCPPing.txt 2>&1
            Write-Output "Finished running IPv4 against ${meFrontendUrl}:${port}" 1>> GlobalStamp_TCPPing.txt
            Write-Output "Running IPv6 against ${meFrontendUrl}:${port}" 1>> GlobalStamp_TCPPing.txt
            Test-NetConnection $solvedDNS.IP6Address -port ${port} -InformationLevel "Detailed" 1>> GlobalStamp_TCPPing.txt 2>&1
            Write-Output "Finished running IPv6 against ${meFrontendUrl}:${port}" 1>> GlobalStamp_TCPPing.txt
        }
    }
}

function Get-Application-Event-Logs
{
    Write-Output "Collecting application event logs for Level Error and EventID 1000 happened within last one hour..."
    Write-Output "Collecting application event logs for Level Error and EventID 1000 happened within last one hour..." > ApplicationErrorLog.txt
    wevtutil qe Application /q:"*[System[Level=2 and EventID=1000 and TimeCreated[timediff(@SystemTime) <= 3600000]]]" /f:text /rd:true >> ApplicationErrorLog.txt
}

function Get-Raw-And-Aggregated-Metrics
{
    Set-MdmInputOutputProviders-File
    Write-Output "Collecting raw and aggregated metrics, please wait..."
    Invoke-Command "logman start MdmDataCollection -max ${MetricCollectionSizeMaxMB} -pf mdmInputOutputProviders.txt -o mdmRaw.etl -ets"
    timeout ${MetricCollectionDurationSec} /nobreak
    Invoke-Command "logman stop MdmDataCollection -ets"
    Invoke-Command "Remove-Item mdmInputOutputProviders.txt"

    logman -ets | findstr /i IfxViewerSession > IfxConsumerSessions.txt

    foreach ($ifxConsumerSession in Get-Content -Path .\IfxConsumerSessions.txt)
    {
        Invoke-Command "logman stop $ifxConsumerSession -ets"
    }
}

function Set-MdmInputOutputProviders-File
{
    $content = @(
        "{edc24920-e004-40f6-a8e1-0e6e48f39d84}"
        "{2f23a2a9-0de7-4cb4-a778-fbdf5c1e7372}"
    )
    $pathMdmInputOutputProviders = (Get-Item -Path ".\" -Verbose).FullName | Join-Path -ChildPath 'mdmInputOutputProviders.txt'
    [IO.File]::WriteAllLines($pathMdmInputOutputProviders, $content)
}

function Search-Files-Job([Object[]]$fileNames, [Object[]]$logicalDisks, [String]$outputFile, [String]$currentPath)
{
    $searchFilesFunc = $(Get-Command Search-Files).Definition
    $invokeCommandFunc = $(Get-Command Invoke-Command).Definition
    $scriptBlock =
    {
        param($fileNames, $logicalDisks, $outputFile, $currentPath)

        Set-Location $currentPath
        Invoke-Expression "function Search-Files {$using:searchFilesFunc}"
        Invoke-Expression "function Invoke-Command {$using:invokeCommandFunc}"
        Search-Files -fileNames $fileNames -logicalDisks $logicalDisks -outputFile $outputFile
    }

    $job = Start-Job -ArgumentList $fileNames, $logicalDisks, $outputFile, $currentPath -ScriptBlock $scriptBlock
    $job | Wait-Job -Timeout $TimeOutSecondsSearchFiles

    if ($job.State -ne "Completed")
    {
        Write-Warning "$fileNames were searched but they took more than $TimeOutSecondsSearchFiles seconds, aborting this search..."
    }
}

function Search-Files([Object[]]$fileNames, [Object[]]$logicalDisks, [String]$outputFile)
{
    foreach($logicalDisk in $logicalDisks)
    {
        foreach($fileName in $fileNames)
        {
            try
            {
                Write-Output "cmd /c dir /s/b ${logicalDisk}\${fileName}"
                cmd /c "dir /s/b ${logicalDisk}\${fileName} > lastDir.txt 2>>dirFailures.txt"
            }
            catch
            {
                "ERROR: cmd /c dir /s/b ${logicalDisk}\${fileName} failed: $_"  >> dirFailures.txt
                Write-Error "ERROR: cmd /c dir /s/b ${logicalDisk}\${fileName} failed: $_"
            }
            Invoke-Command "Get-Content .\lastDir.txt"
            Get-Content .\lastDir.txt >> $outputFile
        }
    }
}

function Get-Command-Line-Arguments
{
    $errorMessage = "CommandLineArguments from MetricsExtension.Native.exe were not found."

    try
    {
        $commandLineArguments = (Get-WmiObject Win32_Process -Filter "Name='MetricsExtension.Native.exe'").CommandLine
        if (-Not [string]::IsNullOrEmpty($commandLineArguments))
        {
            $commandLineArguments > CommandLineArgumentsME.txt
            return $commandLineArguments
        }
    }
    catch
    {
        $errorMessage += " Exception: $_"
        Write-Error $errorMessage
    }

    $errorMessage > CommandLineArgumentsME.txt
    return [string]::Empty
}

function Get-Cached-Config([String]$commandLineArguments)
{
    $dataDirectories = Get-Data-Directories $commandLineArguments
    $counter = 1

    foreach ($dataDirectory in $dataDirectories)
    {
        if (Test-Path -Path $dataDirectory)
        {
            Invoke-Command "New-Item -ItemType Directory -Path .\MetricsExtensionCachedConfig_$counter"
            Invoke-Command "Copy-Item -Path '$dataDirectory*' -Destination '.\MetricsExtensionCachedConfig_$counter' -Recurse -Force"
            $counter++
        }
    }
}

function Get-Data-Directories([String]$commandLineArguments)
{
    # As there could be several ME processes running at the same time, we will collect the data directories of all of them
    $dataDirectories = @()

    # Try to use the -DataDirectory parameter
    if (-Not [string]::IsNullOrEmpty($commandLineArguments))
    {
        $commandLineArgumentsArray = $commandLineArguments.Split(" ")
        for ($i = 1; $i -lt $commandLineArgumentsArray.Count; $i++)
        {
            $arg = $commandLineArgumentsArray[$i]
            if ($arg -eq "-DataDirectory")
            {
                $i++
                $dataDirectory = $commandLineArgumentsArray[$i]
                $dataDirectory = $dataDirectory.Replace('"', '')
                if ($dataDirectory[-1] -ne '\')
                {
                    $dataDirectory += '\'
                }
                $dataDirectories += $dataDirectory
            }
        }
    }

    # Try to get the path from env var MONITORING_DATA_DIR
    if (Test-Path env:MONITORING_DATA_DIR)
    {
        $dataDirectories += $env:MONITORING_DATA_DIR + '\MetricsExtensionData\'
    }

    # Try to get the path from env var DiagnosticStore
    if (Test-Path env:DiagnosticStore)
    {
        $dataDirectories += $env:DiagnosticStore + '\MetricsExtensionData\'
    }

    # Get the path from TEMP dir
    $dataDirectories += $env:TEMP + '\MetricsExtensionData\'

    return $dataDirectories
}

function Copy-Autopilot-Logs
{
    if (Test-Path -Path D:\Data\logs\local)
    {
        Write-Output "Copying autopilot logs..."
        Invoke-Command "mkdir .\GenevaMetricsExtensionLogs"
        Invoke-Command "Copy-Item -Path (Get-ChildItem D:\Data\logs\local\GenevaMetricsExtension_*.log) -Destination GenevaMetricsExtensionLogs"
        Invoke-Command "mkdir .\GenevaMetricsExtensionHostLogs"
        Invoke-Command "Copy-Item -Path (Get-ChildItem D:\Data\logs\local\GenevaMetricsExtensionHost_*.log) -Destination GenevaMetricsExtensionHostLogs"
    }
    else
    {
        Write-Warning "No autopilot logs were found. If this machine is not an Autopilot machine, this is not an issue."
    }
}

function Get-Autopilot-Ini
{
    if (Test-Path -Path D:\app\autopilot.ini)
    {
        Write-Output "Attempting to collect autopilot.ini..."
        Write-Output "Attempting to collect autopilot.ini..." > CollectAutopilotLogs.txt
        Invoke-Command "xcopy /C D:\app\autopilot.ini >> CollectAutopilotLogs.txt"
    }
    else
    {
        Write-Warning "D:\app\autopilot.ini was not found. If this machine is not an Autopilot machine, this is not an issue."
    }
}


function Convert-Tsf-Logs-To-Csv([String]$table2csv)
{
    $tsfCounter = 0
    foreach ($tsfLog in Get-Content -Path .\TsfLogs.txt)
    {
        try
        {
            Write-Output "$table2csv $Table2CsvParameters $tsfLog"
            Write-Output "Waiting for Table2Csv to complete..."
            Write-Output "${table2csv} $Table2CsvParameters} ${tsfLog}" >> Table2CsvLogs.txt
            Invoke-Expression "${Table2Csv} ${Table2CsvParameters} '${tsfLog}'" >> Table2CsvLogs.txt
        }
        catch
        {
            "ERROR: Command {$table2csv $Table2CsvParameters '$tsfLog'} Failed: $_" >> Table2CsvLogs.txt
            Write-Error "ERROR: Command {$table2csv $Table2CsvParameters '$tsfLog'} Failed: $_"
        }

        $tsfCounter++
        $csvFullPath = $tsfLog.Replace("tsf","csv")
        $tsfLogFileName = Split-Path $tsfLog -Leaf
        $csvLogFileName = $tsfLogFileName.Replace(".tsf", "_${tsfCounter}.csv")
        try
        {
            Write-Output "Copy-Item '${csvFullPath}' ${csvLogFileName}"
            Invoke-Command "Copy-Item '${csvFullPath}' .\${csvLogFileName} 2>> CsvCopyErrors.txt"
        }
        catch
        {
            "ERROR: Command {failed to copy ${csvFullPath} to .\${csvLogFileName}}: $_" >> CsvCopyErrors.txt
            Write-Error "ERROR: Command {failed to copy ${csvFullPath} to .\${csvLogFileName}}: $_"
        }
    }
}

function Get-Etw-Session-And-IfxMetrics-At-End
{
    tasklist /M IfxMetrics.dll /FO CSV > ProcessLoadingIfxMetrics_At_End.csv
    logman NativeMetricsExtension_Provider -ets > MetricsExtensionEtwSessionAtEnd.txt
}

function Compress-Output([String]$compressedDataOutput, [String]$mdmDataCollectionOutput)
{
    Write-Output "Compressing MDM Data Collection Output ..."
    try
    {
        Invoke-Command "Compress-Archive -Force -Path .\* -DestinationPath '$OutputDirectory\$compressedDataOutput'"
        Invoke-Command "Set-Location .."
        Invoke-Command "Remove-Item -r -Force $mdmDataCollectionOutput"
        Write-Output "Done -^> MDM Data ready at $OutputDirectory\$compressedDataOutput"
    }
    catch
    {
        Write-Error "ERROR: MDM Data Collection Output has not been compressed: $_"
    }
}

function Show-Ending-Message
{
    $date = Get-Date
    Write-Output "End - MDM Data Collection Script - $date"
}

function Invoke-Command([String]$command)
{
    $output = Invoke-Expression $command
    if ($DebugMdmDataCollection)
    {
        Write-Output $output
    }
}

function Test-Connection-To-URL([String]$cppRestUtil, [String]$url)
{
    try
    {
        if ([String]::IsNullOrEmpty($cppRestUtil))
        {
            [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
            Write-Output "(New-Object System.IO.StreamReader ((([System.Net.WebRequest]::Create($url)).GetResponse()).GetResponseStream())).ReadToEnd()"
            (New-Object System.IO.StreamReader ((([System.Net.WebRequest]::Create($url)).GetResponse()).GetResponseStream())).ReadToEnd()
        }
        else
        {
            Write-Output "'$cppRestUtil' --json $url"
            Invoke-Expression "& '$cppRestUtil' --json $url"
        }
    }
    catch
    {
        "Request to $url failed."
    }

    Write-Output ""
}

function Search-Table2csv([String]$monAgentHostPath)
{
    if ((-Not [string]::IsNullOrEmpty($Table2CsvPathParam)) -and (Test-Path -Path $Table2CsvPathParam))
    {
        return $Table2CsvPathParam
    }

    if (-Not [string]::IsNullOrEmpty($monAgentHostPath) -And $monAgentHostPath.Contains("MonAgentHost.exe"))
    {
        $table2CsvPath = $monAgentHostPath.Replace("MonAgentHost.exe","table2csv.exe")
        if (Test-Path -Path $table2CsvPath)
        {
            return $table2CsvPath
        }
    }

    return [string]::Empty
}

function Get-Tsf-Logs([Object[]]$logicalDisks, [String]$mdmDataCollectionOutput, [String]$monAgentHostPath)
{
    if ($SkipCollectionTsfLogs)
    {
        Write-Warning "SkipCollectionTsfLogs has been set, skipping the collection of tsf logs."
    }
    else
    {
        $fileNames = @(
            "MaMetricsExtensionEtw.tsf"
            "MAEventTable.tsf"
            "LocallyAggregatedMdmMetricsV1.tsf"
        )

        $table2csv = Search-Table2csv $monAgentHostPath
        if ([string]::IsNullOrEmpty($table2csv))
        {
            $warningMessage = "table2csv.exe was not found. Tsf logs will not be collected."
            $warningMessage += "Please take in account this scenario is useful only if you are using MonitoringAgent"
            Write-Warning $warningMessage
        }
        else
        {
            Search-Files-Job $fileNames $logicalDisks "TsfLogs.txt" "$PSScriptRoot\$mdmDataCollectionOutput"
            Convert-Tsf-Logs-To-Csv $table2csv
        }
    }
}

if (-Not $ImportFunctions)
{
    Main
}

# SIG # Begin signature block
# MIIoLAYJKoZIhvcNAQcCoIIoHTCCKBkCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCA+SYwK6aSxmkQa
# MrnYTFJMM31grDuHpogCjLtajE58raCCDXYwggX0MIID3KADAgECAhMzAAADTrU8
# esGEb+srAAAAAANOMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5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