I'm trying to create keyword using core service API through PowerShell. I can do this for keywords at top-level under a category
$keyword = [Tridion.ContentManager.CoreService.Client.KeywordData]$client.GetDefaultData($itemTypeKeyword, $ParentWebdavUrl, $readoptions)
$keyword.Title = $Value
$keyword.Key = $Key
$keyword.Description = $Description
however, if I try to use the GetDefaultData when the $ParentWebdavUrl is a keyword instead of a category, it fails (specifically: Exception calling "GetDefaultData" with "3" argument(s): "Unexpected item type: Keyword."). So, I'm trying to do this, below, but can't seem to get the ParentKeywords to work. I've tried many permutations of creating the $parentLinks object to no avail.
$keyword = New-Object Tridion.ContentManager.CoreService.Client.KeywordData
$keyword.Title = $Value
$keyword.Key = $Key
$keyword.Description = $Description
$parentLink = New-Object Tridion.ContentManager.CoreService.Client.LinkToKeywordData
$parentLink.IdRef = $parent.Id
$parentLinks = [Tridion.ContentManager.CoreService.Client.LinkToKeywordData[]]([Tridion.ContentManager.CoreService.Client.LinkToKeywordData]$parentLink)
$keyword.ParentKeywords = $parentLinks