Migrating a vSphere Content Library

VMWare doesn’t have an option to migrate or copy a Content Library to a new one. I’ve seen other work arounds that involve subscribing and copying files, etc. But I wanted something a bit more straightforward.

I was surprised when I couldn’t find a script online that involved exporting the content from an existing library and then importing into a new one. There were some scripts that did the import, but not export.

Instead of spending a lot of manually downloading everything, I created a script that will export ISOs and OVFs from an existing Content Library. It puts them on a designated local directory and when complete, it uploads them to your new Content Library. Simple enough.

Anyways, I created a GitHub repo and put the script out there.

You can find it here: Migrate VMWare vSphere Content Library

Update: I found that you will want to specify the -ItemType in lowercase (‘ovf’ or ‘iso’). It will upload and show up in the main CL view if you use uppercase… but will not show up when attempting to use them browsing from a host or VM.

Batch and Powershell sleep commands

Sometimes when creating a script, you may need the script to wait or sleep for a certain period of time.

Batch Scripts:

If you search the interwebs, you will find a lot of workarounds that involve pinging a network address for a certain number of times. While this gets the job done, it isn’t necessarily the most straightforward way.

Luckily, there is another command that allows you to specify a wait time in seconds. This command is called timeout, which is something you are probably familiar with if you have kids. It does exactly what it sounds like, it sits there and waits for the number of seconds you specify. Or if you want the Microsoft definition: This utility accepts a timeout parameter to wait for the specified time period (in seconds) or until any key is pressed. It also accepts a parameter to ignore the key press.

According to Microsoft, the command applies To: Windows 7, Windows 8, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Vista, Windows XP.

So I am curious why this isn’t more widely used.


Although you can use the same command with PowerShell, you may want to take advantage of a new command called Start-Sleep. The Start-Sleep cmdlet suspends the activity in a script or session for the specified period of time. You can use it for many tasks, such as waiting for an operation to complete or pausing before repeating an operation.

Find more on these commands here: