我正在尝试创建一个脚本,按顺序创建术语组、集合和名称。
$TermGroup = Read-Host -Prompt 'Input your Term group'
$TermSet = Read-Host -Prompt 'Input your Term set'
$TermName = Read-Host -Prompt 'Input your Term name'
#Check if Term Group is empty
If($TermGroup)
{
#Check if Term group exists
If(-Not(Get-PnPTermGroup -Identity $TermGroup -ErrorAction SilentlyContinue))
{
#Create new group in Termstore
New-PnPTermGroup -Name $TermGroup -Description $TermGroupDescription
Write-host -f Green "Term Group '$TermGroup' created successfully!"
}
Else
{
Write-host -f Yellow "Term Group '$TermGroup' already exists!"
}
}
Else
{
Write-host -f Yellow "No 'TermGroup' provided"
}
#Check if Term Set is empty
If($TermSet)
{
#Check if Term set exists
If(-Not(Get-PnPTermSet -Identity $TermSet -TermGroup $TermGroup -ErrorAction SilentlyContinue))
{
#Create new set in Termstore
New-PnPTermSet -Name $TermSet -TermGroup $TermGroup
Write-host -f Green "Term Set '$TermSet' created successfully!"
}
Else
{
Write-host -f Yellow "Term Set '$TermSet' already exists!"
}
}
Else
{
Write-host -f Yellow "No 'TermSet' provided"
}
#Check if Term Name is empty
If($TermName)
{
#Check is Term Name exists
If(-Not(Get-PnPTerm -Identity $TermName -TermSet $TermSet -TermGroup $TermGroup -ErrorAction SilentlyContinue))
{
#Create new Term
New-PnPTerm -Name $TermName -TermSet $TermSet -TermGroup $TermGroup
}
Else
{
Write-host -f Yellow "Term 'TermName' already exists!"
}
}
Else
{
Write-host -f Yellow "No 'TermName' provided"
}
但术语集和名称部分不断出现此错误。
指定的参数超出了有效值的范围。参数名称:lcid
任何人都可以帮忙解释为什么会这样吗?
添加了-Lcid“1033”并且它起作用了。