| 连接 | Connect-VIServer -Server <vcenter> |
|---|---|
| 取权限 | Get-VIPrivilege -Name ... |
| 建角色 | New-VIRole -Name <角色名> -Privilege <权限集合> |
| 分配 | New-VIPermission -Entity <对象> -Principal <账号> -Role <角色> -Propagate |
示例:给运维组授予电源操作角色
示例:给运维组授予电源操作角色
$privs = Get-VIPrivilege -Name 'VirtualMachine.Interact.PowerOn','VirtualMachine.Interact.PowerOff'
New-VIRole -Name 'VM PowerOPS' -Privilege $privs
New-VIPermission -Entity (Get-Folder 'prod-vms') -Principal 'CORP\opsgroup' -Role 'VM PowerOPS' -Propagate $true批量授权前先用 Get-VIPermission 导出当前清单存档,便于变更回溯。