Function Reset-Computer {
    <#
    .SYNOPSIS
        Resets a computer account in DRA.

    .DESCRIPTION
        Resets the secure channel for a computer account in the DRA environment. This is equivalent to resetting the computer account in Active Directory.

    .PARAMETER ComputerName
        The name of the computer to reset.

    .PARAMETER DraServer
        The FQDN of the DRA server. Defaults to "mcguire.dra.us.af.mil".

    .EXAMPLE
        Reset-Computer -ComputerName 'COMPUTER1' -Verbose
        Resets the account for COMPUTER1 and shows verbose output.
    #>
    [CmdletBinding(SupportsShouldProcess=$true)]
    param(
        [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
        [string]$ComputerName,

        [Parameter(Position=1)]
        [string]$DraServer = "mcguire.dra.us.af.mil"
    )

    Process {
        $ouPath = ",OU=McGuire AFB Computers,OU=McGuire AFB,OU=AFCONUSWEST,OU=Bases,DC=AREA52,DC=AFNOAPPS,DC=USAF,DC=MIL"
        $identifier = "cn=$ComputerName$ouPath"

        Write-Verbose "Attempting to reset computer with identifier: $identifier"

        if ($pscmdlet.ShouldProcess($identifier, "Reset Computer Account")) {
            try {
                Reset-DRAComputer -ErrorAction Stop `
                    -Domain $env:USERDNSDOMAIN `
                    –DRARestServer $DraServer `
                    -DRARestPort 8755 `
                    –DRAHostServer $DraServer `
                    –DRAHostPort 11192 `
                    -Identifier $identifier `
                    -Force

                Write-Verbose "Successfully reset computer account: $ComputerName"
            }
            catch {
                Write-Error "Failed to reset computer '$ComputerName'. Error: $($_.Exception.Message)"
            }
        }
    }
}
