MyITGuy
9/26/2019 - 7:47 PM

Get-AltirisDeploymentAgentConfig

#region Get-AltirisDeploymentAgentConfig
function Get-AltirisDeploymentAgentConfig {
    [CmdletBinding()]
    PARAM(
        [Parameter(Mandatory = $false, Position = 0, ValueFromPipeline = $true)]
        [string]
        $ComputerName
    )

    begin {
        Write-Verbose $MyInvocation.MyCommand
    }

    process {
        try {
            if ($ComputerName) {
                $key = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $ComputerName)
            }
            else {
                $key = [Microsoft.Win32.Registry]::LocalMachine
            }
            $subkey = $key.OpenSubKey('SOFTWARE\Altiris\Client Service')
 
            $Properties = @{}
            $subkey.GetValueNames() | ForEach-Object {
                $Properties."$_" = $subkey.GetValue($_)
            } 
            $obj = New-Object -TypeName PSObject -Property $Properties
            Write-Output -InputObject $obj
        }
        catch {
            Throw $_
        }
    }

    end {
    }
}
#endregion Get-AltirisDeploymentAgentConfig