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