Automation

 View Only

 How to manually sync Content Library via powershell?

bwadbethke's profile image
bwadbethke posted Nov 07, 2024 01:48 PM

I have a subscriber CL that automatically syncs from the publisher every 4 hours or so. I’m trying to do a manual sync sooner than scheduled (within a script).

Through the vCenter UI, I can right click on the subscriber Content Library and tell it to synchronize. This causes an immediate sync; however, if I try via powercli, I get the error message from Set-ContentLibrary: “Subscribed content library <myContentLibrary> is automatically synchronized and it can't be synchronized manually.”

# Sync the subscribed repo
Write-Host "Syncing subscriber repo"
$CLrepo_sub = Get-ContentLibrary -Name $Content_Library_sub_name -Subscribed
Set-ContentLibrary -SubscribedContentLibrary $CLrepo_sub -Sync

How can I force the subscriber to sync with the publisher?

(see example 2 on https://developer.broadcom.com/powercli/latest/vmware.vimautomation.core/commands/set-contentlibrary)

LucD's profile image
LucD

As an alternative you could try the underlying REST API directly, see content library: update


That seems to be a bug in the cmdlet.
I suggest opening an SR

new_bember's profile image
new_bember
Disable AutoSync
Just disable auto sync option in advanced settings if you really need to sync it manually, or set needed time intervals for auto sync.