vCenter Powercli Method 'Get-ContentLibrary' error "Permission to perform this operation was denied."
search cancel

vCenter Powercli Method 'Get-ContentLibrary' error "Permission to perform this operation was denied."

book

Article ID: 375588

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

This cmdlet retrieves content libraries and returns a set of content libraries that correspond to the filter criteria defined by the cmdlet parameters.

  • PowerCLI Reference
    • Get-ContentLibrary

      PS C:\> Get-ContentLibrary

https://developer.broadcom.com/powercli/latest/vmware.vimautomation.core/commands/get-contentlibrary

Invoking this method may result with an error if user permissions are not defined.

Environment

vCenter 7.x/8.x

PowerCLI SDK

Cause

A permission denied error occurs when user permissions are not defined in vCenter.

PS C:\Users\Username> get-contentlibrary
Get-ContentLibrary:       Get-ContentLibrary         An error occurred while trying to get content libraries by names: Permission to perform this operation was denied.

Resolution

Apply Content Library permissions to the user.

  • Login to vCenter
  • Select Administration
  • Select Global Permissions
  • Add the User (Search relevant domain) with Role 'Content library administrator (sample)'
  • Check 'Propagate to children'
  • Re-run the PowerCLI method 'Get-ContentLibrary'

Additional Information

Content Library Privileges

https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-security-8-0.html


Content Libraries provide simple and effective management for virtual machine templates and vApps. Content library privileges control who can view or manage different aspects of content libraries.

To assign a permission on a content library, an Administrator must grant the permission to the user as a global permission. Global permissions support assigning privileges across solutions from a global root object.