Hi,
I'm trying out the new powershell CLI for VMWare ESX.
Is there a way to Get and Set the permission on a Virtual Machine, not de Host.
With Get-VM, i can retrieve my VM, but i don't see the actual permissions on that Object.
Thanks for your help!!
No, that would be a bit different.
To create a new permission on a VM you will need to use the New-VIPermission cmdlet.
You could do this as follows:
Get-VM -Name MyVM | New-VIPermssion -Role (Get-VIRole -Name "Admin") -Principal "ADDomain\ADGroup"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use the Get-VIPermission and Set-VIPermission cmdlets for that.
Get-VM MyVM | Get-VIPermission
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for the reply.
To Set-VIPermission on a virtual machine object i would do :
Get-VM -Name MyVM | Set-VIPermission -Permission 'ADDomain\ADGroup' -Role 'RoleDefiniedinVMWare'
But i doesn't work.
No, that would be a bit different.
To create a new permission on a VM you will need to use the New-VIPermission cmdlet.
You could do this as follows:
Get-VM -Name MyVM | New-VIPermssion -Role (Get-VIRole -Name "Admin") -Principal "ADDomain\ADGroup"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What is the syntax to change the "vipermission"
I would like to change Permission from the Standard-Permisson "virtual maschine user" to new a created "VI-Role" but the ADDomain\ADGroup should keep original.
is that possible?
I assume the object on which you want to change the permission is in the variable $entity.
Then you can do
Get-VIPermssion -Entity $entity | where {$_.Principal -eq "ADDomain\ADGroup"} | Set-VIPermission -Role (Get-VIRole -Name "VI-Role")
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you,
it works not in the first step for me. so I have to change some things
get-vm "VMNAME" | get-VIPermission | where {$_.Principal -q "ADDomain\ADGroup" } | Set-ViPermission -Role (Get-VIRole -Name "NEW-vCenterRole"
thx
I know this an old post. I have 300 machines with AD perimssion test@abc.com set under the permission tab. We are changing domains. I need to replace the current test@abc.com to test@aabc.com. How can I do that?
You can start by taking an inventory
Get-VM | Get-VIPermission
and then use the Remove-VIPermission to remove the obselete permission, followed by a New-VIPermission to set the new permission.
Watch out not to cut the branch on which you are sitting !
Make sure the account you use to run the script doesn't belong to the group you remove.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference