Find characters between Brackets []

$string = "LastName, FirstName ([samaccountname])"
[Regex]::Matches($string, '(?<=\[)(.*?)(?=])').Value
Details
Uses a regex expression with find all characters that match the expression.

Example
PS C:\> $string = "LastName, FirstName ([samaccountname])"
>> [Regex]::Matches($string, '(?<=\[)(.*?)(?=])').Value

samaccountname