PowerShellASP is an ASP-like template language for Web Applications; templates contain a mixture of markup (HTML, XML or whatever you want to generate) and inline PowerShell code. At runtime, templates/pages are fully translated to PowerShell code and executed as a single unit inside a PowerShell pipeline, with the results sent to the client browser.
Tuesday, July 15. 2008
PowerShell ASP
Create Disaster Recovery Hard Drive
Justin Grote created this script out of a motivation of laziness. Since VM's proliferate so fast, most backup and disaster recovery solutions are a pain in the ass because you have to manually add and remove virtual machines to their backup processes. What if there was a way to automatically add and remove VM's to a backup solution simply because of where they are located in Virtualcenter? What if he had an automated DR solution to removable USB hard drives for my smaller clients that was FREE?
Hence this script. This script dynamically backs up all VM's in a particular Virtualcenter folder using VCB, and drops them out to a USB hard drive for disaster recovery purposes. If I don't want a VM backed up anymore, he simply takes it out of that folder.
Note that this also leverages the new networked method of VCB, so YOU DO NOT NEED A SAN AND DIRECT ACCESS TO THE LUNs.
The script is also flexible enough so that if you do have the SAN VCB configuration, you can do LAN-free backups with this method too.
Note that the query here is just an example. Any way you can return a list of VM's, you can give it to the backup-vm cmdlet.
Monday, July 14. 2008
PowerShell on the move
Last week Carter Shanklin over at the VI PowerShell blog published an article about managing storage paths with PowerShell. I must admit that I was impressed by it. Based on Carter‘s script I created a nice little demo showing all the info you can retrieve from your ESX servers.
get-VIServer -Server 192.168.178.200 -User root -Password vmware
$MyHost = get-vmhost esx35.ntpro.local
$HostView = Get-View $MyHost.ID
$HostView.Summary.Hardware.Vendor
$HostView.Runtime.InMaintenanceMode
$HostView.Hardware.MemorySize
Name Port
---- ----
192.168.178.200 443
Hewlett-Packard
False
1065287680
Monday, July 7. 2008
VI Toolkit (Very) Unofficial Extensions
Carter Shanklin published a document containing a download link to the VI Toolkit (for Windows) (Very) Unofficial Extensions. Among these extension are Cmdlet’s for SVMotion-VM, Get-DatastoreFiles and Register-VM.
Cmdlet SVMotion-VM
Cmdlet Get-DatastoreFiles
Cmdlet Register-VM
Sunday, June 15. 2008
Mike Laverick released the PowerShell Mini-Whitepaper
Mike Laverick released another RTFM white paper. This one helps you to get up and running with VMware’s new PowerShell Toolkit – without having to learn any Powershell code!
I was initially put of using the various SDKs, Perl Toolkits and PowerShell Tookits – although I’m pretty good with the CLI of an ESX host and write useful “shell? (.sh) scripts – I wouldn’t say I was a VBS guru or C# guru. Then I discovered PowerGUI. PowerGUI puts a graphical shell around Microsoft PowerShell. It’s a bit like the old style “macro? recorders you used to get in spreadsheet or a word processor. You click about making changes – and this creates the code you need. Sure if you want to really fancy things like loops and error control you then need higher level knowledge – but this really great for poor little admins like me who’s eyes glaze over once some talks about object, properties, attributes and methods.
Tuesday, June 3. 2008
Using the VI Toolkit to add ESX to VC
Carter Shanklin over at the VI PowerShell Blog created another great Excel sheet with an integrated PowerShell script. If an ESX host you want to manage doesn't appear in VirtualCenter, you need to add it. This is a bit tricker than reconnecting since there's no inventory in VirtualCenter to tell you the IP addresses of all the hosts you use, and you also need to know a host's password in order to add it. This is another case where entering things in a spreadsheet can really speed things up. He made just such a spreadsheet, and here's a video of him using it.
Attaching lots of VMware ESX hosts to VMware VirtualCenter. from Carter Shanklin on Vimeo.
Monday, May 26. 2008
Creating lots of virtual machines at once
Carter Shanklin created a nice video how to create lots of virtual machines at once.
Creating lots of virtual machines at once. from Carter Shanklin on Vimeo.
If you're like me you get bored with clicking through Wizard interfaces after about the 5th time or so. On the other hand scripting is a lot more powerful, but at the same time requires you to learn programming languages and APIs, not exactly a lot of fun. Whenever I'm staring at a 12-step wizard I always wish there was a way I could convert it to a spreadsheet input view that would let me fill in a bunch of them at once and then automatically run through everything for me. That's the motivation for this spreadsheet . Basically it lets you enter an entire table of values, but takes care of all the scripting for you. Using the spreadsheet is very simple, but as always you will need to havei nstalled the VI Toolkit (for Windows) on your computer.
Saturday, May 3. 2008
Managing VMware with PowerShell FAQ
Pablo over at VMware just wanted to let us know that they have just published a document to help you get started when using the VI Toolkit for Windows. This document contains frequently asked questions about managing VMware with PowerShell. This document is a wiki page, so if you have contributions or corrections, feel free to make them by editing the document directly.
Saturday, April 19. 2008
Announcing "Programming and Managing VMware Infrastructure" by O'Reilly
Andrew Kutz, the man behind viplugins.com is busy writing a new book. This book will be the definitive guide for systems administrators and developers eager to make use of the VI and CIM SDKs. The book shows their use with several popular languages, including the VI Perl Toolkit and VI Toolkit (for Windows) as well as C#, Java, and Python. Advanced topics, such as creating client plugins and communicating with VMware through its web service, are also covered.
Friday, March 28. 2008
NetCmdlets V2.0 - BETA
NetCmdlets V2 is packed full of exciting new features including PowerShell Server (formerly PowerShell Remoting), Parameter Sets, Object Pipelining, and new Cmdlets for SSH Enabled Remoting and Amazon Web Services (S3) Integration. The /n software NetCmdlets extend the features of Microsoft Windows PowerShell with a broad range of network management and messaging capabilities. The current release contains more than 30 Cmdlets providing access to network and host protocols such as SNMP, LDAP, DNS, Syslog, HTTP, WebDav, FTP, SMTP, POP, IMAP, Rexec/RShell, Telnet, and more.