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
# MIIoLQYJKoZIhvcNAQcCoIIoHjCCKBoCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCA+SYwK6aSxmkQa
# MrnYTFJMM31grDuHpogCjLtajE58raCCDXYwggX0MIID3KADAgECAhMzAAADrzBA
# DkyjTQVBAAAAAAOvMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoa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