У меня есть кластерный ресурс типа «файловый ресурс», но когда я пытаюсь настроить параметр «безопасность», я получаю следующую ошибку (отрывок):
Set-ClusterParameter : Parameter 'security' does not exist on the cluster object
Используя cluster.exe, я получаю лучший результат, а именно обычное ничего, когда команда работала. Но когда я проверяю диспетчер отказоустойчивого кластера, разрешения не изменились. В Server 2003 работал метод cluster.exe.
Любые идеи?
Обновить:
Вся команда и ошибка.
PS C:\> $resource=get-clusterresource testshare
PS C:\> $resource
Name State Group ResourceType
---- ----- ----- ------------
testshare Offline Test File Share
PS C:\> $resource|set-clusterparameter security "domain\account,grant,f"
Set-ClusterParameter : Parameter 'security' does not exist on the cluster object 'testshare'. If you are trying to upda
te an existing parameter, please make sure the parameter name is specified correctly. You can check for the current par
ameters by passing the .NET object received from the appropriate Get-Cluster* cmdlet to "| Get-ClusterParameter". If yo
u are trying to update a common property on the cluster object, you should set the property directly on the .NET object
received by the appropriate Get-Cluster* cmdlet. You can check for the current common properties by passing the .NET o
bject received from the appropriate Get-Cluster* cmdlet to "| fl *". If you are trying to create a new unknown paramete
r, please use -Create with this Set-ClusterParameter cmdlet.
At line:1 char:31
+ $resource|set-clusterparameter <<<< security "domain\account,grant,f"
+ CategoryInfo : NotSpecified: (:) [Set-ClusterParameter], ClusterCmdletException
+ FullyQualifiedErrorId : Set-ClusterParameter,Microsoft.FailoverClusters.PowerShell.SetClusterParameterCommand
Я нашел простой и очевидный ответ. Это настолько просто, что можно не поверить, что это решение Microsoft.
$ permissions - это массив разрешений, содержащий учетную запись (домен \ пользователь), разрешение (полный контроль) и тип (разрешить).
# create access rule based on permissions
$rule = new-object system.security.accesscontrol.filesystemaccessrule $permissions
# get an acl, remove access rules, add our rule
$acl = get-acl "c:\" # need to get acl from root of drive to avoid inheritance
$acl.access | foreach-object {$acl.removeaccessrule($_)}
$acl.setaccessrule($rule)
# get security descriptor from acl and convert to binary security descriptor
$sddl = $acl.sddl
$sdhelper = [wmiclass]"win32_securitydescriptorhelper"
$binarysd = ($sdhelper.sddltobinarysd($sddl)).binarysd
# get cluster resources from registry
$resources = get-childitem "hklm:\cluster\resources"
# ...with paths that powershell will understand
$resources = $resources | foreach-object {$_.pspath}
# find clustershare resource path
$resource = $resources | where-object {(get-itemproperty $_ name).name -eq $clustershare}
# derive path to resource parameters
$parameters = "$resource\parameters"
# configure security descriptor
set-itemproperty $parameters "security descriptor" $binarysd
Это действительно так просто.
Единственная проблема в том, что это работает только для одного узла и должно повторяться на каждом узле. Он действительно переживает отработку отказа (и разрешения, установленные на узле, снова появятся, когда общий ресурс не вернется к узлу). Кроме того, он работает только для «полного контроля», но не для «чтения» или других разрешений. Не знаю почему.
Я не приму это как ответ, потому что на самом деле это не так. Но похоже, что это наиболее близкое к решению этой проблемы, поскольку в Windows Server 2003 просто не существовало (cluster.exe мог устанавливать разрешения для общего доступа), и что Microsoft, похоже, не обращается НИГДЕ.