I'm sure the below could be improved but this seems to work and give the basic information needed to verify your vCenter permissions. I used this today to resolve an issue I was having with my new veeam backup setup.
This was based on the following for v6 : vCenter Server Granular Permissions (v6)
Code: Select all
#You will need the VMware vSphere PowerCLI Installed
# http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli
# You will Need to change the following Lines, the quotes are needed :
$myvCenter = "default"
$myvCenterUserID = "default"
$myvCenterPW = "default"
#This command will show you a listing of your roles in vCenter
#get-virole
#This is the Role you created in vCenter:
$myVeeamRole = "default"
## You shouldn't have to modify anything below this unless you want to clean up the formating.
#----------------------------------------------------------------------------------------------------------------------------------------
# Quick Variable Checks
if ($myvCenter -eq "default") {
write "Edit the $myvCenter variable in the script to run. This would be set to your vCenter server DNS Name or IP"
break
}
if ($myvCenterUserID -eq "default") {
write "Edit the $myvCenterUserID variable in the script to run. This would be set to your vCenter userid"
break
}
if ($myvCenterPW -eq "default") {
write "Edit the $myvCenterPW variable in the script to run. This would be set to your vCenter password"
break
}
if ($myVeeamRole -eq "default") {
write "Edit the $myVeeamRole variable in the script to run. This would be set to your Veeeam Role you created in vCenter"
break
}
#---------------------------------------------------------------------------------------------------------------------------------------
# Adding PowerCLI core snapin
if (!(get-pssnapin -name VMware.VimAutomation.Core -erroraction silentlycontinue)) {
add-pssnapin VMware.VimAutomation.Core
}
if (-not $vCenterconnection.IsConnected) {
write "Connecting to VI Server"
$vCenterConnection = Connect-VIServer -server $myvCenter -user $myvCenterUserID -password $myvCenterPW
}
# You will need to Add the Role you added for Veeam
$role = Get-VIRole $myVeeamRole
$resultGlobalLogEvent = $role.PrivilegeList -contains "Global.LogEvent"
$resultGlobalCheckLic = $role.PrivilegeList -contains "Global.Licenses"
$resultDatastoreLowLevelFileOp = $role.PrivilegeList -contains "Datastore.FileManagement"
$resultDatastoreBrowseDS = $role.PrivilegeList -contains "Datastore.Browse"
$resultDatastoreRMFile = $role.PrivilegeList -contains "Datastore.DeleteFile"
$resultDatsstoreAllocateSpace = $role.PrivilegeList -contains "Datastore.AllocateSpace"
$resultStateCreateSnapshot = $role.PrivilegeList -contains "VirtualMachine.State.CreateSnapshot"
$resultStateRemoveSnapshot = $role.PrivilegeList -contains "VirtualMachine.State.RemoveSnapshot"
$resultStateRevertSnapshot = $role.PrivilegeList -contains "VirtualMachine.State.RevertToSnapshot"
$resultConfigDiskChangeTracking = $role.PrivilegeList -contains "VirtualMachine.Config.ChangeTracking"
$resultConfDiskLease = $role.PrivilegeList -contains "VirtualMachine.Config.DiskLease"
$resultConfChangeResource = $role.PrivilegeList -contains "VirtualMachine.Config.Resource"
$resultConfAddExistingDisk = $role.PrivilegeList -contains "VirtualMachine.Config.AddExistingDisk"
$resultConfRemoveDisk = $role.PrivilegeList -contains "VirtualMachine.Config.RemoveDisk"
$resultConfAdvancedConf = $role.PrivilegeList -contains "VirtualMachine.Config.AdvancedConfig"
$resultConfAddNewDisk = $role.PrivilegeList -contains "VirtualMachine.Config.AddNewDisk"
$resultConfAddRemoveDev = $role.PrivilegeList -contains "VirtualMachine.Config.AddRemoveDevice"
$resultConfRename = $role.PrivilegeList -contains "VirtualMachine.Config.Rename"
$resultConfModifyDeviceSet = $role.PrivilegeList -contains "VirtualMachine.Config.EditDevice"
$resultProvisReadOnlyDiskAccess = $role.PrivilegeList -contains "VirtualMachine.Provisioning.DiskRandomRead"
$resultProfisAllowVMDL = $role.PrivilegeList -contains "VirtualMachine.Provisioning.GetVmFiles"
$resultProvAllowDiskAccess = $role.PrivilegeList -contains "VirtualMachine.Provisioning.DiskRandomAccess"
$resultProvVMFilesUL = $role.PrivilegeList -contains "VirtualMachine.Provisioning.PutVmFiles"
$resultInvRegister = $role.PrivilegeList -contains "VirtualMachine.Inventory.Register"
$resultInvRemove = $role.PrivilegeList -contains "VirtualMachine.Inventory.Delete"
$resultInvUnregister = $role.PrivilegeList -contains "VirtualMachine.Inventory.Unregister"
$resultResAsVMtoRP = $role.PrivilegeList -contains "Resource.AssignVMToPool"
$resultResCreateRP = $role.PrivilegeList -contains "Resource.CreatePool"
$resultResDeleteRP = $role.PrivilegeList -contains "Resource.DeletePool"
$resultHostStoragePartConfig = $role.PrivilegeList -contains "Host.Config.Storage"
$resultHostNetworkConfig = $role.PrivilegeList -contains "Host.Config.Network"
$resultVMIntPowerOn = $role.PrivilegeList -contains "VirtualMachine.Interact.PowerOn"
$resultVMIntPowerOff = $role.PrivilegeList -contains "VirtualMachine.Interact.PowerOff"
$resultNetworkAssignNet = $role.PrivilegeList -contains "Network.Assign"
$resultNetworkConfig = $role.PrivilegeList -contains "Network.Config"
$resultFolderCreate = $role.PrivilegeList -contains "Folder.Create"
$resultdvPortGrpCreate = $role.PrivilegeList -contains "DVPortgroup.Create"
$resultdvPortGrpDelete = $role.PrivilegeList -contains "DVPortgroup.Delete"
# ------------------------------------------------------------------------------------------------------------------
write ""
write " Veeam vCenter Server Granular Permissions v6 check Script"
write "ref: http://forums.veeam.com/viewtopic.php?f=24&t=10478"
write ""
write ""
write "vStorage API - SAN mode (Backup) -------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Disk change tracking : $resultConfigDiskChangeTracking "
write "Disk lease : $resultConfDiskLease "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write ""
write "vStorage API - Virtual Appliance mode (Backup) ------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Disk change tracking : $resultConfigDiskChangeTracking "
write "Disk Change resource : $resultConfChangeResource "
write "Add existing disk : $resultConfAddExistingDisk "
write "Remove disk : $resultConfRemoveDisk "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write ""
write "vStorage API - Network mode (Backup) ----------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Disk change tracking : $resultConfigDiskChangeTracking "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write ""
write "vStorage API - SAN mode (Replication) ----------------------------------- "
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Browse datastore : $resultDatastoreBrowseDS "
write "Remove file : $resultDatastoreRMFile "
write "Allocate space : $resultDatsstoreAllocateSpace "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write "Revert to snapshot : $resultStateRevertSnapshot "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Disk change tracking : $resultConfigDiskChangeTracking "
write "Disk lease : $resultConfDiskLease "
write "Advanced : $resultConfAdvancedConf "
write "Add new disk : $resultConfAddNewDisk "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow disk access : $resultProvAllowDiskAccess"
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Register : $resultInvRegister "
write "Remove : $resultInvRemove "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write ""
write "vStorage API - Virtual Appliance mode (Replication) ----------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Browse datastore : $resultDatastoreBrowseDS "
write "Remove file : $resultDatastoreRMFile "
write "Allocate space : $resultDatsstoreAllocateSpace "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write "Revert to snapshot : $resultStateRevertSnapshot "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Disk change tracking : $resultConfigDiskChangeTracking "
write "Change resource : $resultConfChangeResource "
write "Advanced : $resultConfAdvancedConf "
write "Add new disk : $resultConfAddNewDisk "
write "Add existing disk : $resultConfAddExistingDisk "
write "Remove disk : $resultConfRemoveDisk "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow disk access : $resultProvAllowDiskAccess"
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Register : $resultInvRegister "
write "Remove : $resultInvRemove "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write ""
write "vStorage API - Network mode (Replication) ------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Browse datastore : $resultDatastoreBrowseDS "
write "Remove file : $resultDatastoreRMFile "
write "Allocate space : $resultDatsstoreAllocateSpace "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write "Revert to snapshot : $resultStateRevertSnapshot "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Disk change tracking : $resultConfigDiskChangeTracking "
write "Add new disk : $resultConfAddNewDisk "
write "Advanced : $resultConfAdvancedConf "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow disk access : $resultProvAllowDiskAccess"
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Register : $resultInvRegister "
write "Remove : $resultInvRemove "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write ""
write "Instant VM Recovery --------------------------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Host Configuration --- "
write ""
write "Storage partition configuration : $resultHostStoragePartConfig "
write ""
write "---- Virtual machine - Interaction --- "
write ""
write "Power On : $resultVMIntPowerOn "
write "Power Off : $resultVMIntPowerOff "
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Register : $resultInvRegister "
write "Unregister : $resultInvUnregister "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write ""
write "SureBackup ------------------------------------------------------------------ "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write "Check Licenses : $resultGlobalCheckLic "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Remove file : $resultDatastoreRMFile "
write "Browse datastore : $resultDatastoreBrowseDS "
write ""
write "---- Host Configuration --- "
write ""
write "Network Configuration : $resultHostNetworkConfig "
write "Storage partition configuration : $resultHostStoragePartConfig "
write ""
write "---- Network --- "
write ""
write "Assign Network : $resultNetworkAssignNet "
write ""
write "---- Virtual machine - Interaction --- "
write ""
write "Power On : $resultVMIntPowerOn "
write "Power Off : $resultVMIntPowerOff "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Check Allow disk access : $resultProvAllowDiskAccess "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Add or remove device : $resultConfAddRemoveDevs "
write "Advanced : $resultConfAdvancedConf "
write ""
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Remove : $resultInvRemove "
write "Register : $resultInvRegister "
write "Unregister : $resultInvUnregister "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write "Create Resource Pool : $resultResCreateRP "
write "Remove Resource Pool : $resultResDeleteRP "
write ""
write "----- Folder ---- "
write ""
write ""
write "Create Folder : $resultFolderCreate "
write "Delete Folder : $resultFolderCreate "
write ""
write "----- dvPort Group ---- "
write ""
write "Create : $resultdvPortGrpCreate "
write "Delete : $resultdvPortGrpDelete "
write ""
write ""
write "Full VM Restore -------------------------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Browse datastore : $resultDatastoreBrowseDS "
write "Remove file : $resultDatastoreRMFile "
write "Allocate space : $resultDatsstoreAllocateSpace "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Revert to snapshot : $resultStateRevertSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write ""
write "---- Virtual machine - Interaction --- "
write ""
write "Power On : $resultVMIntPowerOn "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow disk access : $resultProvAllowDiskAccess"
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write "Allow virtual machine files upload : $resultProvVMFilesUL "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Advanced : $resultConfAdvancedConf "
write "Add new disk : $resultConfAddNewDisk "
write "Remove disk : $resultConfRemoveDisk "
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Remove : $resultInvRemove "
write ""
write ""
write "Replica Failover -------------------------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Browse datastore : $resultDatastoreBrowseDS "
write "Remove file : $resultDatastoreRMFile "
write ""
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Revert to snapshot : $resultStateRevertSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write ""
write "---- Virtual machine - Interaction --- "
write ""
write "Power On : $resultVMIntPowerOn "
write "Power Off : $resultVMIntPowerOff "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Advanced : $resultConfAdvancedConf "
write "Rename : $resultConfRename "
write ""
write ""
write "Replica Failback -------------------------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Browse datastore : $resultDatastoreBrowseDS "
write "Remove file : $resultDatastoreRMFile "
write "Allocate space : $resultDatsstoreAllocateSpace "
write ""
write "---- Virtual Machine - State ----"
write ""
write "Create Snapshot : $resultStateCreateSnapshot "
write "Revert to snapshot : $resultStateRevertSnapshot "
write "Remove Snapshot : $resultStateRemoveSnapshot "
write ""
write "---- Virtual Machine – Provisioning ----"
write ""
write "Allow read-only disk access : $resultProvisReadOnlyDiskAccess"
write "Allow virtual machine download : $resultProfisAllowVMDL"
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Advanced : $resultConfAdvancedConf "
write "Rename : $resultConfRename "
write "Disk change tracking : $resultConfigDiskChangeTracking "
write "Disk lease : $resultConfDiskLease "
write "Add new disk : $resultConfAddNewDisk "
write "Add existing disk : $resultConfAddExistingDisk "
write "Remove disk : $resultConfRemoveDisk "
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Register : $resultInvRegister "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write ""
write "File-Level Restore (Other Guest) -------------------------------------------------------- "
write ""
write ""
write "---- Global ----"
write ""
write "Log Event : $resultGlobalLogEvent "
write ""
write "---- Datastore ----"
write ""
write "Low Level File Operations : $resultDatastoreLowLevelFileOp "
write "Browse datastore : $resultDatastoreBrowseDS "
write ""
write "---- Network --- "
write ""
write "Assign Network : $resultNetworkAssignNet "
write "Configure : $resultNetworkConfig "
write ""
write "---- Virtual Machine – Configuration ----"
write ""
write "Modify device settings : $resultConfModifyDeviceSet "
write "---- Virtual machine - Interaction --- "
write ""
write "Power On : $resultVMIntPowerOn "
write "Power Off : $resultVMIntPowerOff "
write ""
write "---- Virtual Machine - Inventory ---- "
write ""
write "Register : $resultInvRegister "
write "Unregister : $resultInvUnregister "
write ""
write "---- Virtual Machine - Resource ---- "
write ""
write "Assign virtual machine to resource pool : $resultResAsVMtoRP "
write ""
write "---- Host Configuration --- "
write ""
write "Storage partition configuration : $resultHostStoragePartConfig "
write ""