NADUS (Not Another Data Upload Script)

Version 1

    In the environment we are working in, we want our CDROM images to be available from shared storage accessible from any ESX server, but for various reasons (corporate standards mostly, although network utilization and additional protocols on the ESX server were a factor) didn't want to use NFS or SMB.  Also, because this is the first VMware deployment for this organization, the change management organizations don't want to use templates and therefore want to build VM's using the same processes as for their metal servers.  Hence the need for the ISOs.  Finally, we didn't want to have to teach the Configuration Management/Package Deployment people how to use WinSCP to upload ISOs.

     

    So this script:

    • Goes through a Windows folder tree which has been populated with media by our configuration management/deployment folks.

    • Replicates that tree into a VMFS datastore which is implemented on our SAN and published to all our ESX servers.

    • Uploads any file it finds in the windows folder tree to the corresponding folder on the VMFS partition

     

    You will never use this script as written, however there may be useful concepts such as:

    • how to upload files to VMware datastores.  These techniques can be adapted to uploading data to other targets such as the ESX hosts URL

    • how to find the datacenter a store is located in

    • how to use recursion in powershell functions

    • find out where the Datastore psdrive is useful and where it might be tweaked in a future version

    • how to upload to a VC-aware datastore using only your current windows credentials.  Note that if your ESX/ESXi server is not part of a VC environment, you will need valid ESX credentials

     

    This script borrows extensively from the cmdlets Carter Shanklin has uploaded to www.codeplex.com/vitoolkitextensions.  He and I worked together on the upload bit, and we found that the upload function requires as much memory as the largest file being uploaded.  In this case, we want to upload some pretty decent sized ISO's so this wasn't feasible since things break when you run out of memory.  The functions in this script are modified slightly to use a modest fixed amount of memory, however the upload does take significantly longer than the code in the VIToolkitExtensions  (about 10minutes for a 500MB ISO).

     

    This is far from perfect:

    • It doesn't remove anything from the VMFS side

    • The upload speed could be improved, but we haven't had the time to play with that

     

    Please use this at your own risk.  No guarantee it will work.