A recent request came through to assist with the post build procedures of a large ESX and vCenter rollout. One task was to remove the manual effort to create and assign the Roles and Permissions within vCenter.
After sifting through my pile of scripts I took to the web and headed straight for Alan Renouf’s website http://www.virtu-al.net/ . As you would expect there was an example originally instigated from a community discussion, the exact page is here, http://www.virtu-al.net/2009/06/15/vsphere-permissions-export-import-part-1/
I extracted the code but couldn’t actually get it going due a syntax error message which I didn’t understand (I admit I’m a novice at scripting). Not wanting to be beaten I took to the web again and posted within the VMware PowerCLI forum, original post here http://communities.vmware.com/thread/280803?tstart=15 . Another scripting guru leapt to save the day, Luc Dekens (his website http://www.lucd.info/ is packed full of useful information too).
Luc’s explanation (in the forum thread) and minor amendment brought the script to life.
I take no credit for the work here but I find the scripts incredibly useful.
Files can be downloaded here: EXPORT IMPORT
(Updated) - Menu selection
Here’s an additional import script that displays a list of options to allow for imports in a multi-vCenter mixed environment.

Import Options
File can be downloaded here IMPORT2

