Public/Get-specRegistryPath.ps1

Function Get-specRegistryPath {
<#
.SYNOPSIS
    Determines and returns the appropriate registry path based on the device's architecture (x64 or x86).
 
.DESCRIPTION
    The Get-specRegistryPath function identifies the device architecture (64-bit or 32-bit) and returns the corresponding
    registry path for querying TeamViewer configuration. This is useful when interacting with the TeamViewer registry settings.
 
.PARAMETER None
    This function does not take any parameters.
 
.EXAMPLE
    Get-specRegistryPath
    Determines the device architecture and returns the appropriate registry path for querying TeamViewer configuration.
 
.NOTES
    Author : owen.heaume
    Version : 1.0
 
#>


    # returns the required reg path depending if x64 or x86 device
    param ()

    if ([Environment]::Is64BitOperatingSystem) {
        #Write-specLogMessage "This is a 64-bit device" -Colour DarkGray
        Write-specLogMessage "Querying [HKLM:\SOFTWARE\TeamViewer\DeviceManagementV2]" -Colour DarkGray
        $RegistryPath = "HKLM:\SOFTWARE\WOW6432Node\TeamViewer\DeviceManagementV2"
        
    } else {
        #Write-specLogMessage "This is a 32-bit device" -Colour DarkGray
        Write-specLogMessage "Querying [HKLM:\SOFTWARE\WOW6432Node\TeamViewer\DeviceManagementV2]" -Colour DarkGray
        $RegistryPath = "HKLM:\SOFTWARE\TeamViewer\DeviceManagementV2"
    }

    return $RegistryPath

}