AzStackHciStandaloneObservability/package/scripts/ExtensionHelper.psm1

##------------------------------------------------------------------
## <copyright file="ExtensionHelper.psm1" company="Microsoft">
## Copyright (C) Microsoft. All rights reserved.
## </copyright>
##------------------------------------------------------------------

#region Constants
$global:systemDriveLetter = $env:SystemDrive.split(':')[0]
$global:extensionRootLocation = Split-Path -Parent $PSScriptRoot
$global:packageBinPath = Join-Path -Path $global:extensionRootLocation -ChildPath "bin"
$global:ObsArtifactsPaths = @{
    FDA =                           Join-Path -Path $global:packageBinPath -ChildPath "FDA\content\FleetDiagnosticsAgent"
    GMA =                           Join-Path -Path $global:packageBinPath -ChildPath "GMA"
    LogCollectionConfigurations =   Join-Path -Path $global:packageBinPath -ChildPath "Configs"
    ObservabilityAgent =            Join-Path -Path $global:packageBinPath -ChildPath "ObsAgent\lib"
    MAWatchdog =                    Join-Path -Path $global:packageBinPath -ChildPath "MAWatchdog"
    SBCClient =                     Join-Path -Path $global:packageBinPath -ChildPath "SBRPClient"
    UtcExporter =                   Join-Path -Path $global:packageBinPath -ChildPath "UtcExporter"
    VS17 =                          Join-Path -Path $global:packageBinPath -ChildPath "VS17"
}

$global:DeviceType = $null
#endregion Constants
#region Imports
Import-Module (Join-Path -Path $global:ObsArtifactsPaths.GMA -ChildPath 'GMATenantJsonHelper.psm1') `
    -DisableNameChecking `
    -Verbose:$false
#endregion Imports

#region Functions

#region Pre-installation validation functions

function Assert-SufficientDiskSpaceAvailableForGMACache {
    $availableMemoryOnStamp = ((Get-Volume -DriveLetter $global:systemDriveLetter).SizeRemaining) / 1GB

    if ($availableMemoryOnStamp -lt $MiscConstants.AvailableDiskSpaceLimitInGB) {
        return $ErrorConstants.InsufficientDiskSpaceForGMACache.Name
    }
    
    return $true
}

function Invoke-PreInstallationValidation {
    param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name
    
    $validationFunctionNames = (
        $MiscConstants.ValidationFunctionNames.AssertSufficientDiskSpaceAvailableForGMACache
    )
    
    Write-Log `
        -Message "$functionName : Performing pre-installation validation." `
        -LogFile $logFile
    
    foreach($validationFunction in $validationFunctionNames) {
        $validationResult = (Invoke-Expression $validationFunction)
        if ($validationResult -ne $true) {
            Write-Log `
                -Message "$validationFunction : $($ErrorConstants.$validationResult.Message)" `
                -LogFile $LogFile `
                -Level $MiscConstants.Level.Error
                
            throw $validationResult
        }

        Write-Log `
            -Message "$validationFunction : $validationResult" `
            -LogFile $LogFile `
    }
    
    Write-Log `
        -Message "$functionName : Pre-installation validation completed successfully." `
        -LogFile $logFile
}
#endregion Pre-installation validation functions

#region GCS functions
function Get-CloudName {
    Param (
        [Parameter(Mandatory)]
        [System.String] $ExistingCloudName,
        
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name
    Write-Log `
        -Message "$functionName : ExistingCloudName = $ExistingCloudName" `
        -LogFile $LogFile

    $publicSettings = Get-HandlerConfigSettings -LogFile $LogFile
    
    ## Check if any cloud value is passed through Config settings, if yes than use that
    if (-not ([System.String]::IsNullOrEmpty($publicSettings.cloudName)) -and `
        -not ([System.String]::IsNullOrWhiteSpace($publicSettings.cloudName))) {
        Write-Log `
            -Message "$functionName : CloudName from publicSetting = $($publicSettings.cloudName)" `
            -LogFile $LogFile

        return $publicSettings.cloudName
    }

    Write-Log `
        -Message "$functionName : Exiting. CloudName: $cloudName" `
        -LogFile $LogFile

    return $ExistingCloudName
}

function Get-GcsEnvironmentName {
    Param (
        [Parameter(Mandatory)]
        [System.String] $CloudName,
        
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name
    
    Write-Log `
        -Message "$functionName : CloudName = $CloudName" `
        -LogFile $LogFile

    ## Default environment value.
    $gcsEnvironmentName = $MiscConstants.GCSEnvironment.Prod

    ## Check whether cloud name is Canary or PPE or reg key created for CI exists or not, if yes then change the GCSEnvironment to point to PPE instead.
    if ($CloudName -in $MiscConstants.CloudNames.AzureCanary -or `
        $CloudName -in $MiscConstants.CloudNames.AzurePPE -or `
        (Test-RegKeyExists -Path $MiscConstants.CIRegKey.Path -Name $MiscConstants.CIRegKey.Name)) {
        $gcsEnvironmentName = $MiscConstants.GCSEnvironment.Ppe
    }
    elseif ($CloudName -in $MiscConstants.CloudNames.AzureUSGovernmentCloud) {
        $gcsEnvironmentName = $MiscConstants.GCSEnvironment.Fairfax
    }
    elseif ($CloudName -in $MiscConstants.CloudNames.AzureChinaCloud) {
        $gcsEnvironmentName = $MiscConstants.GCSEnvironment.Mooncake
    }
    elseif (Get-IsArcAEnvironment) {
        $gcsEnvironmentName = $MiscConstants.GCSEnvironment.ArcAPpe
    }

    Write-Log `
        -Message "$functionName : GcsEnvironmentName based on CloudName ($CloudName) = $gcsEnvironmentName" `
        -LogFile $LogFile

    return $gcsEnvironmentName
}

function Get-GcsRegionName {
    Param (
        [Parameter(Mandatory)]
        [System.String] $RegistrationRegion,
        
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name
    $gcsRegionName = $RegistrationRegion
    Write-Log `
        -Message "$functionName : Existing RegistrationRegion = $gcsRegionName" `
        -LogFile $LogFile

    ## Check if any region value is passed through Config settings, if yes than use that
    $publicSettings = Get-HandlerConfigSettings -LogFile $LogFile

    if (-not ([System.String]::IsNullOrEmpty($publicSettings.region)) -and `
        -not ([System.String]::IsNullOrWhiteSpace($publicSettings.region))) {
        Write-Log `
            -Message "$functionName : RegionName from publicSetting = $($publicSettings.region)" `
            -LogFile $LogFile

        $gcsRegionName = $publicSettings.region
    }

    Write-Log `
        -Message "$functionName : Exiting. GCSRegionName: $gcsRegionName" `
        -LogFile $LogFile

    return $gcsRegionName
}

function Wait-ForGcsConfigSync() {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory)]
        [System.String] $LogFile,

        [Parameter(Mandatory = $false)]
        [int] $TimeInSeconds = 60
    )

    $functionName = $MyInvocation.MyCommand.Name
    Write-Log `
        -Message "$functionName : Entering. TimeOut: $TimeInSeconds" `
        -LogFile $LogFile

    Write-Host "Going to wait for GCSConfig sync $TimeInSeconds"
    Start-Sleep -Seconds $TimeInSeconds
    $cacheDir = Get-CacheDirectories
    $gcsConfigFiles = Get-ChildItem -Path $cacheDir.DiagnosticsCache -Filter GcsConfig -Recurse
    if($gcsConfigFiles.Count -eq 0)
    {
        Write-Log `
            -Message "$functionName : $($ErrorConstants.GcsConfigFilesNotFound.Message)" `
            -LogFile $LogFile `
            -Level $MiscConstants.Level.Error
    }

    Write-Log `
        -Message "$functionName : Exiting. GCSCongfile count: $($gcsConfigFiles.Count)" `
        -LogFile $LogFile
}

#endregion GCS functions

#region Handler/Extension functions

## Get sequence number from env variable provided by Agent.
function Get-ConfigSequenceNumber { if ($null -eq $env:ConfigSequenceNumber) { 0 } else { $env:ConfigSequenceNumber } }

function Get-GmaPackageContentPath { $global:ObsArtifactsPaths.GMA }

function Get-HandlerConfigSettings {
    <#
        Sample config json file:
        ------------------------------------------------------------
        {
            "runtimeSettings":
            [
                {
                    "handlerSettings":
                    {
                        "publicSettings":
                        {
                            "region": "eastus",
                            "cloudName": "AzureCanary",
                            "deviceType": "AzureEdge"
                        }
                    }
                }
            ]
        }
        -----------------------------------------------------------
 
        Or If you don't want to pass any values, it can be empty as follows:
 
        { "runtimeSettings": [ { "handlerSettings":{ "publicSettings":{} } } ] }
    #>

    param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name
    $handlerEnvInfo = Get-HandlerEnvInfo -LogFile $LogFile

    if (-not (Test-Path $handlerEnvInfo.configFolder -PathType Container)) {
        Write-Log `
            -Message "$functionName : $($ErrorConstants.ConfigFolderDoesNotExist.Message)" `
            -LogFile $LogFile `
            -Level $MiscConstants.Level.Error

        throw $ErrorConstants.ConfigFolderDoesNotExist.Name
    }

    $configFile = Get-ChildItem -Path $handlerEnvInfo.configFolder | Sort-Object CreationTime -Descending | Select-Object -First 1
    # Parse config file to read parameters
    $configJson = Get-Content -Path $configFile.FullName -Raw | ConvertFrom-Json
    return $configJson.runtimeSettings[0].handlerSettings.publicSettings
}

function Get-HandlerEnvInfo {
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    <#
    Sample HandlerEnvironment.json content:
    [
        {
            "handlerEnvironment": {
                "configFolder": "C:\\Packages\\Plugins\\Microsoft.AzureStack.Observability.Observability\\0.0.0.4\\RuntimeSettings",
                "deploymentid": "",
                "heartbeatFile": "C:\\Packages\\Plugins\\Microsoft.AzureStack.Observability.Observability\\0.0.0.4\\status\\HeartBeat.Json",
                "hostResolverAddress": "",
                "instance": "",
                "logFolder": "C:\\ProgramData\\GuestConfig\\extension_logs\\Microsoft.AzureStack.Observability.Observability",
                "rolename": "",
                "statusFolder": "C:\\Packages\\Plugins\\Microsoft.AzureStack.Observability.Observability\\0.0.0.4\\status"
            },
            "name": "Microsoft.RecoveryServices.Test.AzureSiteRecovery",
            "version": "1"
        }
    ]
    #>


    $envFile = Join-path -Path $global:extensionRootLocation -ChildPath "HandlerEnvironment.json"

    if (-not (Test-Path $envFile -PathType Leaf)) {
        throw $ErrorConstants.HandlerEnvJsonDoesNotExist.Name
    }

    # Read handler config
    $envJson = Get-Content -Path $envFile -Raw | ConvertFrom-Json
    if ($envJson -is [System.Array]) {
        $envJson = $envJson[0]
    }

    return $envJson.handlerEnvironment
}

function Get-HandlerHeartBeatFile {
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $handlerEnvInfo = Get-HandlerEnvInfo -LogFile $LogFile

    return $handlerEnvInfo.heartbeatFile
}

function Get-HandlerLogFile { Join-Path $(Get-LogFolderPath) -ChildPath $MiscConstants.HandlerLogFileName }

function Get-LogFolderPath {
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $handlerEnvInfo = Get-HandlerEnvInfo -LogFile $LogFile

    if (-not (Test-Path $handlerEnvInfo.logFolder -PathType Container)) {
        throw $ErrorConstants.LogFolderDoesNotExist.Name
    }

    return $handlerEnvInfo.logFolder
}

function Get-StatusFolderPath {
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $handlerEnvInfo = Get-HandlerEnvInfo -LogFile $LogFile

    if (-not (Test-Path $handlerEnvInfo.statusFolder -PathType Container)) {
        throw $ErrorConstants.StatusFolderDoesNotExist.Name
    }

    return $handlerEnvInfo.statusFolder
}

function Get-StatusFilePath {
    $configSeqNum = Get-ConfigSequenceNumber
    $statusFolder = Get-StatusFolderPath
    return "$statusFolder\$configSeqNum.status"
}
#endregion Handler/Extension functions

#region Misc functions
function Get-CacheDirectories {
    Param ()

    $gmaCacheLocation = Join-Path -Path $env:SystemDrive -ChildPath "GMACache"

    return [ordered] @{
        GMACache = $gmaCacheLocation
        DiagnosticsCache =      Join-Path -Path $gmaCacheLocation -ChildPath "DiagnosticsCache"
        HealthCache =           Join-Path -Path $gmaCacheLocation -ChildPath "HealthCache"
        JsonDropLocation =      Join-Path -Path $gmaCacheLocation -ChildPath "JsonDropLocation"
        MonAgentHostCache =     Join-Path -Path $gmaCacheLocation -ChildPath "MonAgentHostCache"
        TelemetryCache =        Join-Path -Path $gmaCacheLocation -ChildPath "TelemetryCache"

        ObservabilityVolume =   Join-Path -Path $env:SystemDrive -ChildPath "Observability"
    }
}

function New-CacheDirectories {
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
        -Message "$functionName : Creating cache directories." `
        -LogFile $LogFile

    $cacheDirectories = Get-CacheDirectories

    foreach ($directory in $cacheDirectories.Values) {
        New-Directory `
            -Path $directory `
            -LogFile $logFile
    }

    Write-Log "$functionName : Created cache directories." `
        -LogFile $LogFile

    return $cacheDirectories
}

function New-Directory {
    param (
        [Parameter(Mandatory = $true)]
        [System.String] $Path,

        [Parameter(Mandatory = $false)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
            -Message "$functionName : Directory to create is '$Path'." `
            -LogFile $LogFile
    
    if (Test-Path $Path -PathType Container) {
        Write-Log `
            -Message "$functionName : Directory '$Path' exists already." `
            -LogFile $LogFile
    }
    else {
        New-Item `
            -Path $Path `
            -ItemType "Directory" `
            -Force `
            -Verbose:$False `
            | Out-Null

        Write-Log `
            -Message "$functionName : Directory '$Path' created." `
            -LogFile $LogFile
    }
}

function Get-UtcExporterPackageContentPath { $global:ObsArtifactsPaths.UtcExporter }

function Get-FDAPackageContentPath { $global:ObsArtifactsPaths.FDA }

function Get-WatchdogPackageContentPath { $global:ObsArtifactsPaths.MAWatchdog }

function Get-VCRuntimePackageContentPath { $global:ObsArtifactsPaths.VS17 }

function Get-WatchdogStatusFile
{
    param (
        [Parameter(Mandatory = $true)]
        [System.String] $LogFile
    )
    $watchdogStatusDirectory = Join-Path -Path $(Get-LogFolderPath) -ChildPath "WatchdogStatus"
    New-Directory -Path $watchdogStatusDirectory -LogFile $LogFile
    return Join-Path -Path $watchdogStatusDirectory -ChildPath $MiscConstants.WatchdogStatusFileName
}

function Set-Status {
    Param (
        [Parameter(Mandatory)]
        [System.String] $Name,

        [Parameter(Mandatory)]
        [System.String] $Operation,

        [Parameter(Mandatory)]
        [System.String] $Message,

        [Parameter(Mandatory)]
        [ValidateSet("transitioning", "error", "success", "warning")]
        [System.String] $Status,

        [Parameter(Mandatory)]
        [System.Int16] $Code
    )
    
    & "$PSScriptRoot\ReportStatus.ps1" `
        -Name $Name `
        -Operation $Operation `
        -Status $Status `
        -Code $Code `
        -Message $Message
}

function Get-IsArcAEnvironment {
   return (Test-RegKeyExists -Path $MiscConstants.ArcARegKey.Path -Name $MiscConstants.ArcARegKey.Name -GetValueIfExists) -eq $true
}
#endregion Misc functions

#region UTC setup functions
Function Initialize-UTCSetup {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    try {
        Write-Log `
            -Message "$functionName : Initializing UTC setup." `
            -LogFile $logFile

        #region Stop diagtrack service
        Stop-ServiceForObservability `
            -ServiceName $MiscConstants.ObsServiceDetails.DiagTrack.Name `
            -LogFile $logFile
        #endregion Stop diagtrack service
    
        ## Create the UTC exporter destination folder (if not present) and copy the UtcGenevaExporter dll in it.
        Write-Log `
            -Message "$functionName : Create folder for UTCExporterdll and place the respective binary in it." `
            -LogFile $logFile

        $utcExporterDllName = $MiscConstants.UtcxporterDllName
        $utcExporterSourcePath = Join-Path -Path (Get-UtcExporterPackageContentPath) -ChildPath $utcExporterDllName
    
        $utcExporterDestinationDirectory = $MiscConstants.UtcExporterDestinationDirectory
    
        New-Directory `
            -Path $utcExporterDestinationDirectory `
            -LogFile $logFile
    
        Copy-Item `
            -Path $utcExporterSourcePath `
            -Destination $utcExporterDestinationDirectory `
            -Force `
            | Out-Null
    
        $utcExporterDestinationPath = Join-Path -Path $utcExporterDestinationDirectory -ChildPath $utcExporterDllName
    
        if (Test-Path $utcExporterDestinationPath) {
            Write-Log `
                -Message "$functionName : Successfully copied '$utcExporterDllName' to '$utcExporterDestinationPath'." `
                -LogFile $logFile
        }
        else {
            Write-Log `
                -Message "$functionName : Failed to copy '$utcExporterDllName' to '$utcExporterDestinationPath'." `
                -LogFile $logFile `
                -Level $MiscConstans.Status.Error
    
            throw $ErrorConstants.CannotCopyUtcExporterDll.Name
        }
    
        #region Create reg keys
        New-RegKey `
            -Path $MiscConstants.DiagTrackExportersRegKeyPath `
            -LogFile $logFile `
            -CreatePathOnly
    
        New-RegKey `
            -Path $MiscConstants.GenevaExporterRegKey.Path `
            -LogFile $logFile `
            -CreatePathOnly
    
        New-RegKey `
            -Path $MiscConstants.DiagTrackRegKey.Path `
            -Name $MiscConstants.DiagTrackRegKey.Name `
            -PropertyType $MiscConstants.DiagTrackRegKey.PropertyType `
            -Value $MiscConstants.DiagTrackRegKey.Value `
            -LogFile $logFile
    
        New-RegKey `
            -Path $MiscConstants.GenevaExporterRegKey.Path `
            -Name $MiscConstants.GenevaExporterRegKey.Name `
            -PropertyType $MiscConstants.GenevaExporterRegKey.PropertyType `
            -Value $utcExporterDestinationPath `
            -LogFile $logFile
    
        New-RegKey `
            -Path $MiscConstants.TestHooksRegKey.Path `
            -Name $MiscConstants.TestHooksRegKey.Name `
            -PropertyType $MiscConstants.TestHooksRegKey.PropertyType `
            -Value $MiscConstants.TestHooksRegKey.Value `
            -LogFile $logFile
    
        New-RegKey `
            -Path $MiscConstants.GenevaExporterRegKey.Path `
            -Name $MiscConstants.GenevaNamespaceRegKey.Name `
            -PropertyType $MiscConstants.GenevaNamespaceRegKey.PropertyType `
            -Value $MiscConstants.GenevaNamespaceRegKey.Value `
            -LogFile $logFile
        #endregion Create reg keys
    
        #region Start diagtrack service
        Start-ServiceForObservability `
            -ServiceName $MiscConstants.ObsServiceDetails.DiagTrack.Name `
            -LogFile $logFile
        #endregion Start diagtrack service
    
        Write-Log `
            -Message "$functionName : Successfully initialized UTC setup." `
            -LogFile $logFile

    }
    finally {
        if ((Get-Service $MiscConstants.ObsServiceDetails.DiagTrack.Name).Status -eq "Stopped") {
            Write-Log `
                -Message "$functionName : Starting $($MiscConstants.ObsServiceDetails.DiagTrack.Name) service after it was stopped." `
                -LogFile $LogFile
            
            Start-Service `
                -Name $MiscConstants.ObsServiceDetails.DiagTrack.Name `
                -ErrorAction SilentlyContinue `
                -Verbose:$false `
                | Out-Null
        }
    }
}

Function Clear-UTCSetup {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    try {
        Write-Log `
            -Message "$functionName : Cleaning up UTC related artifacts." `
            -LogFile $logFile

        #region Stop diagtrack service
        Stop-ServiceForObservability `
            -ServiceName $MiscConstants.ObsServiceDetails.DiagTrack.Name `
            -LogFile $LogFile
        #endregion Stop diagtrack service

        #region Remove UtcExporter dll
        Write-Log `
            -Message "$functionName : Removing UTCExporterdll file and its folder." `
            -LogFile $logFile
        
        $utcExporterDestinationPath = Join-Path -Path $MiscConstants.UtcExporterDestinationDirectory -ChildPath $MiscConstants.UtcxporterDllName

        if (Test-Path -Path $utcExporterDestinationPath) {

            Remove-Item `
                -Path $utcExporterDestinationPath `
                -Force `
                -Verbose:$false `
                | Out-Null

            Write-Log `
                -Message "$functionName : Removed file '$utcExporterDestinationPath'." `
                -LogFile $logFile


            if ((Get-ChildItem -Path $MiscConstants.UtcExporterDestinationDirectory | Measure-Object).Count -eq 0) {
                Remove-Item `
                    -Path $MiscConstants.UtcExporterDestinationDirectory `
                    -Force `
                    -Verbose:$false `
                    | Out-Null

                Write-Log `
                    -Message "$functionName : Removed directory '$($MiscConstants.UtcExporterDestinationDirectory)'." `
                    -LogFile $logFile
            }

            Write-Log `
                -Message "$functionName : Removed UTCExporterdll file '$utcExporterDestinationPath' and its folder path '$($MiscConstants.UtcExporterDestinationDirectory)'." `
                -LogFile $logFile
        }
        else {
            Write-Log `
                -Message "$functionName : UTCExporter dll does not exists at path '$utcExporterDestinationPath'. Nothing to remove." `
                -LogFile $logFile
        }
        #endregion Remove UtcExporter dll

        #region Remove reg keys
        Remove-RegKey `
            -Path $MiscConstants.DiagTrackRegKey.Path `
            -Name $MiscConstants.DiagTrackRegKey.Name `
            -LogFile $logFile

        Remove-RegKey `
            -Path $MiscConstants.TestHooksRegKey.Path `
            -Name $MiscConstants.TestHooksRegKey.Name `
            -LogFile $logFile

        Remove-RegKey `
            -Path $MiscConstants.GenevaExporterRegKey.Path `
            -Name $MiscConstants.GenevaExporterRegKey.Name `
            -LogFile $logFile

        Remove-RegKey `
            -Path $MiscConstants.GenevaExporterRegKey.Path `
            -Name $MiscConstants.GenevaNamespaceRegKey.Name `
            -LogFile $logFile

        Remove-RegKey `
            -Path $MiscConstants.GenevaExporterRegKey.Path `
            -LogFile $logFile `
            -RemovePathOnly
        #endregion Remove reg keys

        #region Start diagtrack service
        Start-ServiceForObservability `
            -ServiceName $MiscConstants.ObsServiceDetails.DiagTrack.Name `
            -LogFile $LogFile
        #endregion Start diagtrack service

        Write-Log `
            -Message "$functionName : Cleaned up artifacts related to UTC setup." `
            -Logfile $logFile
    }
    finally {
        if ((Get-Service $MiscConstants.ObsServiceDetails.DiagTrack.Name).Status -eq "Stopped") {
            Write-Log `
                -Message "$functionName : Starting $($MiscConstants.ObsServiceDetails.DiagTrack.Name) service after it was stopped." `
                -LogFile $LogFile
            
            Start-Service `
                -Name $MiscConstants.ObsServiceDetails.DiagTrack.Name `
                -ErrorAction SilentlyContinue `
                -Verbose:$false `
                | Out-Null
        }
    }
}
#endregion UTC setup functions

#region VCRuntime setup function
function Install-VCRuntime
{
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    ) 
    $functionName = $MyInvocation.MyCommand.Name

    $vcRedistFilePath = Join-Path -Path (Get-VCRuntimePackageContentPath) -ChildPath $MiscConstants.VCRuntimeExeName
    Write-Log -Message "Installing VC Runtime. $vcRedistFilePath /install /quiet /norestart" -LogFile $LogFile
    $vcInstall = Start-Process -File $vcRedistFilePath -ArgumentList "/install /quiet /norestart" -Wait -NoNewWindow -PassThru
    if ($vcInstall.ExitCode -ne 0)
    {
        Write-Log `
            -Message "$functionName : $($ErrorConstants.VCRedistInstallFailed.Message)" `
            -LogFile $LogFile `
            -Level $MiscConstants.Level.Error
        throw $ErrorConstants.VCRedistInstallFailed.Name
    }
    Write-Log -Message "VC Runtime $vcRedistFilePath successfully installed." -LogFile $LogFile

}
#endregion VCRuntime setup function

#region Registry functions
function  New-RegKey {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [System.String] $Path,

        [Parameter(Mandatory = $false)]
        [System.String] $Name,
        
        [Parameter(Mandatory = $false)]
        [System.String] $PropertyType,
        
        [Parameter(Mandatory = $false)]
        [System.String] $Value,

        [Parameter(Mandatory = $false)]
        [System.String] $LogFile,

        [Parameter(Mandatory=$false)]
        [System.Management.Automation.SwitchParameter] $CreatePathOnly
    )

    $functionName = $MyInvocation.MyCommand.Name

    if ($CreatePathOnly) {
        if (-not (Test-Path -Path $Path)) {
            New-Item `
                -Path $Path `
                -Force `
                -Verbose:$false `
                | Out-Null
            
            Write-Log `
                -Message "$functionName : Created RegKey path ($Path)." `
                -LogFile $LogFile
        }
        else {
            Write-Log `
                -Message "$functionName : RegKey path ($Path) exists already." `
                -LogFile $LogFile
        }
    }
    else {
        if (-not (Test-RegKeyExists -Path $Path -Name $Name)) {
            New-ItemProperty `
                -Path $Path `
                -Name $Name `
                -PropertyType $PropertyType `
                -Value $Value `
                -Force `
                | Out-Null
            
            Write-Log `
                -Message "$functionName : Created registry key with path ($Path), name ($Name) and value ($Value)." `
                -LogFile $LogFile
        }
        else {
            Write-Log `
                -Message "$functionName : RegKey path ($Path) and name ($Name) exists already." `
                -LogFile $LogFile
        }
    }
}

Function  Remove-RegKey {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $True)]
        [System.String] $Path,

        [Parameter(Mandatory = $False)]
        [System.String] $Name,

        [Parameter(Mandatory = $False)]
        [System.String] $LogFile,

        [Parameter(Mandatory=$False)]
        [System.Management.Automation.SwitchParameter] $RemovePathOnly
    )

    $functionName = $MyInvocation.MyCommand.Name

    if ($RemovePathOnly) {
        if (Test-Path -Path $Path) {
            Remove-Item `
                -Path $Path `
                -Force `
                -Verbose:$false `
                | Out-Null

            Write-Log `
                -Message "$functionName : Path ($Path) removed successfully." `
                -LogFile $LogFile
        }
        else {
            Write-Log `
                -Message "$functionName : Path ($Path) does not exists. Nothing to remove" `
                -LogFile $LogFile
        }
    }
    else {
        if (Test-RegKeyExists -Path $Path -Name $Name) {
            
            Remove-ItemProperty `
                -Path $Path `
                -Name $Name `
                -Force `
                -Verbose:$false `
                | Out-Null
            
            Write-Log `
                -Message "$functionName : RegKey path ($Path) and name ($Name) removed successfully." `
                -LogFile $LogFile
        }
        else {
            Write-Log `
                -Message "$functionName : RegKey path ($Path) and name ($Name) does not exists. Nothing to remove" `
                -LogFile $LogFile
        }
    }
}
#endregion Registry functions

#region Scheduled task functions
function Enable-ObsScheduledTask {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
        -Message "$functionName : Enabling ObsScheduledTask ($($MiscConstants.ObsScheduledTaskDetails.TaskName))." `
        -LogFile $LogFile

    $taskObject = Get-ScheduledTask `
                    -TaskPath $MiscConstants.ObsScheduledTaskDetails.TaskPath `
                    -TaskName $MiscConstants.ObsScheduledTaskDetails.TaskName `
                    -ErrorAction $MiscConstants.ErrorActionPreference.SilentlyContinue

    if ($null -eq $taskObject) {
        Write-Log `
            -Message "$functionName : No scheduled task with name ($($MiscConstants.ObsScheduledTaskDetails.TaskName)) was found to enable." `
            -LogFile $LogFile
    }
    else {
        Enable-ScheduledTask `
            -InputObject $taskObject `
            -ErrorAction $MiscConstants.ErrorActionPreference.Stop `
            -Verbose:$false `
            | Out-Null

        Write-Log `
            -Message "$functionName : Successfully enabled obs scheduled task with name $($taskObject.TaskName) at path $($taskObject.TaskPath)." `
            -LogFile $LogFile
    }
}

function Disable-ObsScheduledTask {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name
    
    Write-Log `
        -Message "$functionName : Disabling ObsScheduledTask ($($MiscConstants.ObsScheduledTaskDetails.TaskName))." `
        -LogFile $LogFile

    $taskObject = Get-ScheduledTask `
                    -TaskPath $MiscConstants.ObsScheduledTaskDetails.TaskPath `
                    -TaskName $MiscConstants.ObsScheduledTaskDetails.TaskName `
                    -ErrorAction $MiscConstants.ErrorActionPreference.SilentlyContinue

    if ($null -eq $taskObject) {
        Write-Log `
            -Message "$functionName : No scheduled task with name ($($MiscConstants.ObsScheduledTaskDetails.TaskName)) was found to disable." `
            -LogFile $LogFile
    }
    else {
        Disable-ScheduledTask `
            -InputObject $taskObject `
            -ErrorAction $MiscConstants.ErrorActionPreference.Stop `
            -Verbose:$false `
            | Out-Null

        Write-Log `
            -Message "$functionName : Successfully disabled obs scheduled task with name name $($taskObject.TaskName) at path $($taskObject.TaskPath)." `
            -LogFile $LogFile
    }
}

function Remove-ObsScheduledTask {
    param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    $trimmedTaskPath = $MiscConstants.ObsScheduledTaskDetails.TaskPath.TrimEnd('\')
    $tasks = Get-ScheduledTask -TaskPath "$trimmedTaskPath\*" -ErrorAction $MiscConstants.ErrorActionPreference.SilentlyContinue
    if ($tasks)
    {
        foreach($task in $tasks) {
            if($task.TaskName -eq $MiscConstants.ObsScheduledTaskDetails.TaskName) {
                Unregister-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath -Confirm:$false | Out-Null

                Write-Log `
                    -Message "$functionName : Successfully removed scheduled task $($task.TaskName) from path $($task.TaskPath)." `
                    -LogFile $LogFile
            }
        }
    }
    else
    {
        Write-Log `
            -Message "$functionName : Either the path '$trimmedTaskPath' doesn`'t exists or no scheduled tasks found to delete." `
            -LogFile $LogFile
    }
}
#endregion Scheduled task functions

#region Windows service functions
function Register-ServiceForObservability {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [System.String] $ServiceName,

        [Parameter(Mandatory = $true)]
        [System.String] $ServiceDisplayName,

        [Parameter(Mandatory = $true)]
        [System.String] $ServiceBinaryFilePath,

        [Parameter(Mandatory = $false)]
        [System.String] $ServiceStartupType = 'Manual',

        [Parameter(Mandatory = $false)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    try {
        Write-Log `
            -Message "$functionName : Starting registration of service '$ServiceName'." `
            -LogFile $logFile
        
        Write-Log `
            -Message "$functionName : Configuring service '$ServiceName' from path '$ServiceBinaryFilePath'" `
            -LogFile $LogFile
        
        if (Get-Service $ServiceName -ErrorAction SilentlyContinue)
        {
            Write-Log `
                -Message "$functionName : Service '$ServiceName' already registered." `
                -LogFile $LogFile
        }
        else
        {
            New-Service `
                -Name $ServiceName `
                -BinaryPathName $ServiceBinaryFilePath `
                -DisplayName $ServiceDisplayName `
                -StartupType $ServiceStartupType `
                -ErrorAction Stop `
                -Verbose:$false `
                | Out-Null
        }
    
        Write-Log `
            -Message "$functionName : Registration of service '$ServiceName' with display name '$ServiceDisplayName' completed." `
            -LogFile $logFile
    }
    catch {
        Write-Log `
            -Message "$functionName : $($ErrorConstants.CannotRegisterService.Message) Service Name: '$ServiceName'. Exception: $_" `
            -LogFile $LogFile `
            -Level $MiscConstants.Level.Error
    
        throw $ErrorConstants.CannotRegisterService.Name
    }
}

function Start-ServiceForObservability {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [System.String] $ServiceName,

        [Parameter(Mandatory = $false)]
        [System.String] $LogFile,

        [Parameter(Mandatory = $false)]
        [int] $Retries = $MiscConstants.Retries
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
        -Message "$functionName : Starting service '$ServiceName'." `
        -LogFile $logFile

    # Start MA Watchdog Agent Service
    $retryCount = $Retries
    $serviceStatus = (Get-Service $ServiceName).Status

    if ($serviceStatus -eq "Running") {
        Write-Log `
            -Message "$functionName : Service '$ServiceName' running already." `
            -LogFile $LogFile
        
        return
    }

    while(($serviceStatus -ne "Running") -and ($retryCount -gt 0)) {     
        Start-Service $ServiceName `
            -WarningAction SilentlyContinue `
            -WarningVariable $startSvcWarn
        
        if ($null -ne $startSvcWarn) {
            Write-Log `
                -Message "$functionName : $startSvcWarn" `
                -Level $MiscConstants.Level.Warning `
                -LogFile $LogFile
        }

        Write-Log `
            -Message "$functionName : Waiting for service '$ServiceName' to start..." `
            -LogFile $LogFile

        Start-Sleep -Seconds 5

        $serviceStatus = (Get-Service $ServiceName).Status
        $retryCount--
    }

    if ($serviceStatus -ne "Running") {
        Write-Log `
            -Message "$functionName : $($ErrorConstants.CannotStartService.Message) Service Name: '$ServiceName'" `
            -LogFile $LogFile `
            -Level $MiscConstants.Level.Error

        throw $ErrorConstants.CannotStartService.Name
    }

    Write-Log `
        -Message "$functionName : Successfully started service '$ServiceName'." `
        -LogFile $LogFile
}

function Stop-ServiceForObservability {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [System.String] $ServiceName,

        [Parameter(Mandatory = $false)]
        [System.String] $LogFile,

        [Parameter(Mandatory = $false)]
        [int] $Retries = $MiscConstants.Retries
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
        -Message "$functionName : Stopping service '$ServiceName'." `
        -LogFile $logFile

    # Stop MA Watchdog Agent Service
    $retryCount = $Retries
    $serviceStatus = (Get-Service $ServiceName).Status

    if ($serviceStatus -eq "Stopped") {
        Write-Log `
            -Message "$functionName : Service '$ServiceName' stopped already." `
            -LogFile $LogFile
        
        return
    }

    while (($serviceStatus -ne "Stopped") -and ($retryCount -gt 0)) {
        Stop-Service $ServiceName `
            -WarningAction SilentlyContinue `
            -WarningVariable $stopSvcWarn
        
        if ($null -ne $stopSvcWarn) {
            Write-Log `
                -Message "$functionName : $stopSvcWarn" `
                -Level $MiscConstants.Level.Warning `
                -LogFile $LogFile
        }

        Write-Log `
            -Message "$functionName : Waiting for service '$ServiceName' to stop..." `
            -LogFile $LogFile

        Start-Sleep -Seconds 5

        $serviceStatus = (Get-Service $ServiceName).Status
        $retryCount--
    }

    if ($serviceStatus -ne "Stopped") {
        Write-Log `
            -Message "$functionName : $($ErrorConstants.CannotStopService.Message) Service Name: '$ServiceName'" `
            -LogFile $LogFile `
            -Level $MiscConstants.Level.Error

        throw $ErrorConstants.CannotStopService.Name
    }

    Write-Log `
        -Message "$functionName : Successfully stopped service '$ServiceName'." `
        -LogFile $LogFile
}

Function Unregister-ServiceForObservability {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true)]
        [System.String] $ServiceName,

        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
        -Message "$functionName : Unregistering service '$ServiceName'." `
        -LogFile $LogFile
    
    if (Get-Service $ServiceName -ErrorAction SilentlyContinue) {
        Stop-ServiceForObservability -ServiceName $ServiceName -LogFile $LogFile
    }

    Write-Log `
        -Message "$functionName : $(sc.exe delete $ServiceName -Verbose)" `
        -LogFile $LogFile

    Write-Log `
        -Message "$functionName : Successfully unregistered service '$ServiceName'." `
        -LogFile $LogFile
}

function Set-StandaloneScenarioRegistry {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true)]
        [System.String] $LogFile
    )

    New-RegKey `
    -Path $MiscConstants.GMAScenarioRegKey.Path `
    -Name $MiscConstants.GMAScenarioRegKey.Name `
    -PropertyType $MiscConstants.GMAScenarioRegKey.PropertyType `
    -Value $MiscConstants.GMAScenarioRegKey.OneP `
    -CreatePathOnly `
    -LogFile $LogFile

    New-RegKey `
    -Path $MiscConstants.GMAScenarioRegKey.Path `
    -Name $MiscConstants.GMAScenarioRegKey.Name `
    -PropertyType $MiscConstants.GMAScenarioRegKey.PropertyType `
    -Value $MiscConstants.GMAScenarioRegKey.OneP `
    -LogFile $LogFile
}

#endregion

#region Diag functions
Function Confirm-IsDeviceTypeValid {
    ## Internal function not to export.
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $True)]
        [System.String] $DeviceType,

        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )
    
    $functionName = $MyInvocation.MyCommand.Name

    if ($DeviceType -in $MiscConstants.DeviceTypes.Values) {
        Write-Log `
            -Message "$functionName : Confirmed deviceType '$DeviceType' is valid." `
            -LogFile $LogFile
    }
    else {
        throw $ErrorConstants.InvalidDeviceTypeValue.Name
    }
}

Function Set-DeviceType {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    $deviceTypeFromRegKey = $null
    $deviceTypeFromPublicSettings = $null
    
    ## Check for device type value from registry key
    $deviceTypeFromRegKey = Test-RegKeyExists `
                                -Path $MiscConstants.DeviceTypeRegKey.Path `
                                -Name $MiscConstants.DeviceTypeRegKey.Name `
                                -LogFile $LogFile `
                                -GetValueIfExists

    $publicSettings = Get-HandlerConfigSettings -LogFile $LogFile
    
    ## Check if deviceType value exists in Config settings.
    if ($null -ne $publicSettings -and `
        -not ([System.String]::IsNullOrEmpty($publicSettings.deviceType)) -and `
        -not ([System.String]::IsNullOrWhiteSpace($publicSettings.deviceType))) {

        $deviceTypeFromPublicSettings = $publicSettings.deviceType
    }

    ## Case 1: Value NOT present either in public settings or in reg key.
    if ([System.String]::IsNullOrEmpty($deviceTypeFromPublicSettings) -and `
        [System.String]::IsNullOrEmpty($deviceTypeFromRegKey)) {
        throw $ErrorConstants.DeviceTypeValueNotFound.Name
    }
    ## Case 2: Value present in public settings and not in reg key.
    elseif (-not ([System.String]::IsNullOrEmpty($deviceTypeFromPublicSettings)) -and `
            [System.String]::IsNullOrEmpty($deviceTypeFromRegKey)) {
        $global:DeviceType = $deviceTypeFromPublicSettings

        New-RegKey `
            -Path $MiscConstants.DeviceTypeRegKey.Path `
            -LogFile $LogFile `
            -CreatePathOnly

        New-RegKey `
            -Path $MiscConstants.DeviceTypeRegKey.Path `
            -Name $MiscConstants.DeviceTypeRegKey.Name `
            -PropertyType $MiscConstants.DeviceTypeRegKey.PropertyType `
            -Value $global:DeviceType `
            -LogFile $logFile
        
        Write-Log `
            -Message "$functionName : Using deviceType value from public settings = $global:DeviceType" `
            -LogFile $LogFile
    }
    ## Case 3: Value present in reg key and not in public settings.
    elseif (-not ([System.String]::IsNullOrEmpty($deviceTypeFromRegKey)) -and `
            [System.String]::IsNullOrEmpty($deviceTypeFromPublicSettings)) {
        $global:DeviceType = $deviceTypeFromRegKey
        
        Write-Log `
            -Message "$functionName : Using deviceType value from registry key = $global:DeviceType" `
            -LogFile $LogFile
    }
    ## Case 4: Value present in both (i.e. public settings and registry key).
    else {
        ## Case 4.1: If value is same, use any.
        if ($deviceTypeFromRegKey -ieq $deviceTypeFromPublicSettings) {
            $global:DeviceType = $deviceTypeFromRegKey
        
            Write-Log `
                -Message "$functionName : Device type value from registry key is same as public settings = $global:DeviceType" `
                -LogFile $LogFile
        } else {
            ## Case 4.2: If both values are different, than there are three more cases.
            if
            (
                ## Case 4.2.1: If settings has HCI and reg key has EnvValidatorStandAlone, then HCI will be used.
                (
                    $deviceTypeFromPublicSettings -ieq $MiscConstants.DeviceTypes.HCI -and `
                    $deviceTypeFromRegKey -ieq $MiscConstants.DeviceTypes.EnvValidatorStandAlone
                ) -or `
                ## Case 4.2.2: If settigs has AzureEdge and reg key has either HCI or EnvValidatorStandAlone, then AzureEdge will be used.
                (
                    $deviceTypeFromPublicSettings -ieq $MiscConstants.DeviceTypes.AzureEdge -and `
                    (
                        $deviceTypeFromRegKey -ieq $MiscConstants.DeviceTypes.HCI -or `
                        $deviceTypeFromRegKey -ieq $MiscConstants.DeviceTypes.EnvValidatorStandAlone
                    )
                )
            ) {
                $global:DeviceType = $deviceTypeFromPublicSettings
                Write-Log `
                    -Message "$functionName : Device type value from public settings '$($global:DeviceType)' is selected over registry key '$deviceTypeFromRegKey'." `
                    -LogFile $LogFile
            } else {                
                ## Case 4.2.3: If not above two, then reg key value will be used over settings.
                $global:DeviceType = $deviceTypeFromRegKey
                Write-Log `
                    -Message "$functionName : Device type value from registry key '$($global:DeviceType)' is selected over public settings '$deviceTypeFromPublicSettings'." `
                    -LogFile $LogFile
            }
        }
    }

    Confirm-IsDeviceTypeValid `
        -DeviceType $global:DeviceType `
        -LogFile $LogFile
}

Function Move-LogCollectionConfigurations {
    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $False)]
        [System.String] $LogFile
    )

    $functionName = $MyInvocation.MyCommand.Name

    Write-Log `
        -Message "$functionName : Copying device type based log collection config files to their destinations." `
        -LogFile $LogFile

    $sourcePaths = @{
        FDAScenariosXML = Join-Path -Path $global:ObsArtifactsPaths.LogCollectionConfigurations -ChildPath "$($global:DeviceType)\$($MiscConstants.LogCollectionConfigs.ScenariosXml)"
        DiagLogRoleConfigJson = Join-Path -Path $global:ObsArtifactsPaths.LogCollectionConfigurations -ChildPath "$($global:DeviceType)\$($MiscConstants.LogCollectionConfigs.DiagLogRoleConfigJson)"
    }

    $destinationPaths = @{
        FDAScenariosXML = $global:ObsArtifactsPaths.FDA
        DiagLogRoleConfigJson = Join-Path -Path $global:ObsArtifactsPaths.ObservabilityAgent -ChildPath 'Scripts'
    }

    foreach ($key in $sourcePaths.Keys) {
        Copy-Item -Path $sourcePaths[$key] -Destination $destinationPaths[$key] -Force

        Write-Log `
            -Message "$functionName : Successfully copied config file '$($sourcePaths[$key])' to '$($destinationPaths[$key])'." `
            -LogFile $LogFile
    }

    Write-Log `
        -Message "$functionName : Successfully copied device type based log collection config files to their destinations." `
        -LogFile $LogFile
}
#endregion Diag functions

#region Telemetry functions
Function Confirm-IsTelemetryEnabled {
    <# Turn off telemetry by default for EnvValidatorStandAlone, we do not know whether user has consented for Telemetry or not and
    until we have a way to get consent value for EnvValidatorStandAlone, disable telemetry by default.#>

    if ($global:DeviceType -eq $MiscConstants.DeviceTypes.EnvValidatorStandAlone) {
        return $false
    }
    
    ## Default
    return $true
}

#endregion Telemetry functions

#endregion Functions

#region Exports
Export-ModuleMember -Function Get-GmaPackageContentPath

# Pre-installation validation functions
Export-ModuleMember -Function Invoke-PreInstallationValidation

## GCS functions
Export-ModuleMember -Function Get-CloudName
Export-ModuleMember -Function Get-GcsEnvironmentName
Export-ModuleMember -Function Get-GcsRegionName
Export-ModuleMember -Function Wait-ForGcsConfigSync

## Handler/Extension functions
Export-ModuleMember -Function Get-ConfigSequenceNumber
Export-ModuleMember -Function Get-HandlerConfigSettings
Export-ModuleMember -Function Get-HandlerEnvInfo
Export-ModuleMember -Function Get-HandlerHeartBeatFile
Export-ModuleMember -Function Get-HandlerLogFile
Export-ModuleMember -Function Get-LogFolderPath
Export-ModuleMember -Function Get-StatusFolderPath
Export-ModuleMember -Function Get-StatusFilePath

## Misc functions
Export-ModuleMember -Function Get-CacheDirectories
Export-ModuleMember -Function New-CacheDirectories
Export-ModuleMember -Function New-Directory
Export-ModuleMember -Function Get-FDAPackageContentPath
Export-ModuleMember -Function Get-UtcExporterPackageContentPath
Export-ModuleMember -Function Get-VCRuntimePackageContentPath
Export-ModuleMember -Function Get-WatchdogPackageContentPath
Export-ModuleMember -Function Get-WatchdogStatusFile
Export-ModuleMember -Function Set-Status
Export-ModuleMember -Function Set-StandaloneScenarioRegistry
Export-ModuleMember -Function Get-IsArcAEnvironment

## UTC setup functions
Export-ModuleMember -Function Initialize-UTCSetup
Export-ModuleMember -Function Clear-UTCSetup

## Registry functions
Export-ModuleMember -Function New-RegKey
Export-ModuleMember -Function Remove-RegKey

# VCRuntime setup function
Export-ModuleMember -Function Install-VCRuntime

## Scheduled task functions
Export-ModuleMember -Function Enable-ObsScheduledTask
Export-ModuleMember -Function Disable-ObsScheduledTask
Export-ModuleMember -Function Remove-ObsScheduledTask

## Windows service functions
Export-ModuleMember -Function Register-ServiceForObservability
Export-ModuleMember -Function Start-ServiceForObservability
Export-ModuleMember -Function Stop-ServiceForObservability
Export-ModuleMember -Function Unregister-ServiceForObservability

## Diag functions
Export-ModuleMember -Function Set-DeviceType
Export-ModuleMember -Function Move-LogCollectionConfigurations

## Telemetry functions
Export-ModuleMember -Function Confirm-IsTelemetryEnabled

#endregion Exports
# SIG # Begin signature block
# MIInlgYJKoZIhvcNAQcCoIInhzCCJ4MCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBumkdk0q4GGlHv
# R24ckVCTEDAZDwgMcMVGadLVuTV1UaCCDXYwggX0MIID3KADAgECAhMzAAADTrU8
# esGEb+srAAAAAANOMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlVTMRMwEQYD
# VQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQ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