jconry
Contributor
Contributor

Scripting provisioning of VM's

I'm fairly new at this PowerCLI/PowerShell business, so bare with me.

I'm in the process of creating scripts for the admin guys to provision new vm's from templates as needed. I'm hoping I can get the script to call a text file with a few variables in it, that the admin guys can edit as required. The text file would contain something like:

Virtual machine Name: "Name"

Template: "ie. Win XP Client template, Win 2003 App Server Template, etc"

Network: "Network Connection"

Location: "Folder location"

The problem I'm having is how can I get the New-VM script to call each of the variables in the text file, if it's possible or is there a better way?

0 Kudos
5 Replies
jconry
Contributor
Contributor

All good, after spending the day reading numerous "How to PowerShell guides", I've got it worked out.

Learnt a good deal in the process as well.

Cheers.

0 Kudos
srinivasaddagat
Contributor
Contributor

he jconry..we are in need of similar script, can you provide steps as to how you made it work?

0 Kudos
RobMokkink
Expert
Expert

See my script as an example:

http://communities.vmware.com/docs/DOC-6972

0 Kudos
Humpadilly
Contributor
Contributor

Not sure if you're still interested but here is something I put together in an xls file with some Macros for my personal / work use from some of the examples I found here.

The single file does everything, it creates a log, script and csv file with the list of machines and then executes the script from my documents.

Click on Cell A1, A2 & A3 to see what its executing, and check out the Macros for the full details.

Cheers

Humpa

0 Kudos
jconry
Contributor
Contributor

Here you go.

It's definitely nothing fancy and it's still a work in progress, but it does what I need it to do for now. At the moment I'm working on getting the VM's to join the domain, etc as part of it using the OSCustomizationSpec cmdlet and doing a bit of vb to create a menu object to populate the .csv.

Cheers, Josh.

0 Kudos