VMware Cloud Community
halr9000
Commander
Commander
Jump to solution

Call for script ideas

Have any ideas for VI-TK scripts you would like to see written? I need some ideas for a little project I'm working on. Right now I'm going to go troll the Perl toolkit forum. Smiley Wink

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
1 Solution

Accepted Solutions
Schorschi
Expert
Expert
Jump to solution

Hal, ideas for the book?

Itemize the differences between VI/PowerShell scripting when the Get-VMHost context is different? I have already found 1 or 2 examples where depending on if get-viserver is connected to ESX host or VC server things work or are reported slightly different. Remove-VM for example, I documented what I found in the VI Tool Kit forum.

Another idea, is to comment on SCVMM use of powershell versus the VI Tool Kit. Since Microsoft is targeting VC with SCVMM?

View solution in original post

Reply
0 Kudos
31 Replies
LucD
Leadership
Leadership
Jump to solution

Something we are currently looking at:

- create a number of guests based on an external config file (.CSV) that contains: hostname, OS-type, mem & disk-size, vswitch, IP address...

- the guests have to be created from existing templates with customization parameters taken from the file above (hostname, IP address...)

The customization is currently giving us problems (see my set-OSCustomizationSpec & IP address post).

Using Carter's method to make VI SDK calls seems to be the way out.

Mission impossible or feasible ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

halr9000
Commander
Commander
Jump to solution

I'll look into this in detail soon. Some of this may be addressed in the open beta revision. The rest (like this new bug you found) I believe can be handled by the VI SDK or other means. From my research so far things QUICKLY get hairy, at least in my terms, from a sysadmin POV. I imagine some developers may not see it the same way. Smiley Happy

Also FYI, there are a few other ideas on my blog: http://halr9000.com/article/464

Keep the ideas coming. Smiley Happy

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

So my project is public now! I'm working on "[Managing VMWare with Windows PowerShell: TFM®|http://www.sapienpress.com/vmware.asp]". So LucD, some form of your request is going to be a part of my book. I can't promise it'll get done in time for it to be of any use to you personally though, but I'll try.

I'm very excited, this is the first book I've ever tried writing a book. In fact, I don't think I've written anything longer than a few pages before. Smiley Happy

At some point down the road I'll need technical reviewers, I may ask for volunteers then if anybody's interested.

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
JDLangdon
Expert
Expert
Jump to solution

So my project is public now! I'm working on "[Managing VMWare with Windows PowerShell: TFM®|http://www.sapienpress.com/vmware.asp]". So LucD, some form of your request is going to be a part of my book. I can't promise it'll get done in time for it to be of any use to you personally though, but I'll try.

This is one book that will be on my must read list. Smiley Happy

Jason

Reply
0 Kudos
bottledair
Enthusiast
Enthusiast
Jump to solution

Good luck with the book. It something greatly needed. Here are a couple of ideas.

1. Look for unused datastores. If you have setup a small datastores or one to one relationship(vm to datastore) as machines get moved or deleted this can leave a datastores unused. Have a script that will go through the datastores and find any that do not have currently any vm's attached. This allows for quick and easy tracking and recoupe of san space.

2. Look at the datastores and virtual center and find any virtual machine files for machines that may have been removed from inventory but, not deleted.

halr9000
Commander
Commander
Jump to solution

Thanks, both of you. And thanks bottledair for the ideas, much appreciated.

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
dsanders
Expert
Expert
Jump to solution

Something I am beginning to work on, and should be fairly simple, is the ability to schedule the migration of virtual machines. I do not have SAN storage yet so vmotion is not an option. So if I want to move virtual machines off of a host I usually end up having to wake up during our maintenance window (4 - 6 am), power off the machine, migrate, wait and then power up. It is an easy job. I just don't like waking up at 4 am Smiley Happy

Reply
0 Kudos
Chris_S_UK
Expert
Expert
Jump to solution

can't you use a scheduled tasks (or rather 3 tasks - shutdown/move/power on) to do that?

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

You might be able to do some of it, but the tasks which you can schedule in VC are fairly limited. I'm told you can schedule anything by using the SDK, and hence, the VI toolkit. I already have on my todo to see how easy/difficult it will be to schedule arbitrary tasks using powershell.

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
admin
Immortal
Immortal
Jump to solution

There are of course alternatives to the VC scheduler. For example, the Windows scheduler. Sort of depends on your requirements.

Reply
0 Kudos
David_Ank
Enthusiast
Enthusiast
Jump to solution

As you all know its possible to set vm swap files into different datastore.

Therefore, maybe a script that would be able to tell the location of vms files?

Furthermore, maybe if the stores which they located on are NFS or ISCSI.

David

Regards, David
Reply
0 Kudos
erickmiller
Enthusiast
Enthusiast
Jump to solution

This is probably pretty simple to do in PowerShell (now that I've had a little time to play with it), but a list of Folders or Resource Pools (and Sub-Resource Pools) with a respective count of powered on/off and suspended VMs would be nice. Possibly an option to break down the counts by host. Next would be disk utilization (free/used/total space) for these same categories.

I suspect we'll end up capturing a lot of the required information into an SQL Server database and use SQL to provide us with all of this, but it would be interesting to see if it's possible (and easy) to do it in PowerShell.

We run a high-availability hosting company that leases resource pools with the ability for customers to create as many virtual machines as they want within their allocated resources (disk space is the limiting factor). I'm just thinking of quick commands that we could use to find problem areas.

Eric K. Miller, Genesis Hosting Solutions, LLC

- Lease part of our ESX cluster!

Eric K. Miller, Genesis Hosting Solutions, LLC http://www.genesishosting.com/ - Lease part of our ESX cluster!
Reply
0 Kudos
rmontyq
Contributor
Contributor
Jump to solution

Mornin':

I am working on learning PowerShell so I can better manage our VI environment. One of the very first things I am attempting to do is to document VI. Where are all the vm's, what is their configuration info (OS, Memory,# & type of disks), what storage each disk is on, etc, etc. PowerShell & VITK provides much of this as individual scriplets, but I want to provide a daily report on the structure.

My 2 cents! And btw, I bought Windows PowerShell v2.0: TFM (2rd Edition) the other day and so far it is excellent... will plan on adding yours as soon as it is out and would love to preview any chapters, scripts, bring you coffee, whatever, to get a peek at it!

Thanks!

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

Yes, a daily report sounds good. Noted. And BTW, I'm not the author of that TFM book, that's Don Jones, whom I greatly respect. Smiley Happy

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
rmontyq
Contributor
Contributor
Jump to solution

Well, you would feel even better knowing I am now listening to your

podcast (along with TWIT, Security Now and a dozen others...) And I just

notified our Server group that they have had VM in snapshot mode for 3

months 'cause I used your scripty:

$snap = get-vm | get-snapshot

$snap | ft @{l = "VM"; e = {$_.vm.name} },name,created,description

So, Thanks!

Ralph E Montgomery

Sr. Technical Analyst

FirstHealth of the Carolinas

rmontgomery@firsthealth.org

(910) 715-5388

Reply
0 Kudos
danpalacios
Hot Shot
Hot Shot
Jump to solution

It may be a bit late to respond, but here is something I would like to see ..

In a DR scenario, I would like to create blank ESX servers and use a script to create the vswitches - complete with vlans, ip addresses, network names, etc. I am researching this now, but would not mind having someone do the hard work for me Smiley Happy

Reply
0 Kudos
JDLangdon
Expert
Expert
Jump to solution

In a DR scenario, I would like to create blank ESX servers and use a script to create the vswitches - complete with vlans, ip addresses, network names, etc. I am researching this now, but would not mind having someone do the hard work for me Smiley Happy

All of this can be accomplished using standard commands from a kickstart script. I can boot a blank server off the VMware Esx 3.02 CD, point it towards my kickstart script and have a full configured server, including switches - complete with vlans, ip addresses, network names, etc, in about 20 minutes.

Jason

Reply
0 Kudos
rmontyq
Contributor
Contributor
Jump to solution

Same here, including storage. The only thing that is lacking is getting vmotion to auto turn on. I also need to add configuring fail over options.

Ralph E. Montgomery

Sr. Technical Analyst.

FirstHealth of the Carolinas

(910) 715-5388

rmontgomery@firsthealth.org

"Sent via the Blackberry Virtual Office so please excuse my brevity and any misspelthings"

Reply
0 Kudos
Schorschi
Expert
Expert
Jump to solution

Hal, ideas for the book?

Itemize the differences between VI/PowerShell scripting when the Get-VMHost context is different? I have already found 1 or 2 examples where depending on if get-viserver is connected to ESX host or VC server things work or are reported slightly different. Remove-VM for example, I documented what I found in the VI Tool Kit forum.

Another idea, is to comment on SCVMM use of powershell versus the VI Tool Kit. Since Microsoft is targeting VC with SCVMM?

Reply
0 Kudos