Posts
Require a minimum version of PowerCLI
A lot of the script that I have been writing rely on new cmdlets or properties in the current release of PowerCLI. Telling people to upgrade before running the scripts has not been enough so I am going to do the smart thing and check that the appropriate version is running.
Here is the code to that I am using to do the validation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 # By default this will check that the running version of PowerCLI is greater # than or equal to the specified version and throw an exception if not.
Posts
VMware vCLI “persistent login”
Here is a short convenience script that will simulate a persistent login to a VMware host system when using the vCLI on Windows. Typically you have to specify a lot of parameters that include login information or a session file. With this method you just run the script and provide the hostname, username, and password for the connection.
After running this script you can run commands like “vicfg-mpath.pl –list” without additional parameters.
Posts
VMware PowerCLI and Get-View filters
I have been confused by how to best use the -filter parameter on Get-View so I decided to dig around a little. The examples that are given always seem to be (semi)exact matches and I wanted to do an OR in my filter. Per the help this did not appear possible, but after some digging I found that it is possible for a single property at least.
The help has this to say about the Filter parameter:
Posts
PowerShell and SRM – Basic Logic
Here is a script that shows how to get access to the environment variables that VMware sets for a command step and perform some basic control flow using them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 # A starter script for examining the VMware environment variables and # performing some logic steps relating to the SRM workflow.
Posts
Using PowerShell in VMware Site Recovery Manager
This is the first post in a series about using PowerShell to automate steps in a VMware Site Recovery Manager (SRM) workflow. I will be posting bits and pieces as I learn more and if everything works the way I would like I will post an overview of my testing and recovery procedure.
To use PowerShell in a Command Step of a recovery plan you will need to do the following:
Posts
VMware SRM – finding VMs in a recovery plan
I am evaluating VMware Site Recovery Manager (SRM) and there are some things that I need to do in testing that I can not do in the base product. I am going to run some PowerShell to reconfigure the VMs and rename them. One of the first roadblocks is finding out which VMs are part of a particular recovery plan. Since the SRM API is limited I went into the database and dug around.
Posts
Sony PRS600 hung (1fskin:/l/string…)
My new PRS600 reader from Sony was hung and I was getting pretty worried. I was using calibre on Linux and unplugged the device without unmounting. I would reset it and it would boot, but come to a blank version of the menu screen with 1fskin:/l/string… showing at the bottom. I tried a hard reset, but the device would not respond.
Here are the steps I did to resolve the issue.
Posts
Maximum vSwitches in vSphere
There appears to be a discrepancy in the VMware documentation regarding the maximum number of vSwitches. The Configuration Maximums document states that the limit is 248. The configuration guide lists the maximum as 127 which is what it was in 3.5. I am not sure if I misunderstand what they mean by “Standard switches per host 248”. If you see the error of my ways let me know.
Here is some code that I used to see how many vSwitches I could put on a host.
Posts
Configure NTP on Multiple Hosts Using PowerShell
A handy script to correct NTP settings on multiple hosts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 #Usage: Get-VMHost | .\ConfigureNtpServer.ps1 BEGIN { $ntpServers = @("ntpserver01","ntpserver02") $hostDateTimeConfig = New-Object Vmware.Vim.HostDateTimeConfig $hostNtpConfig = New-Object VMware.Vim.HostNtpConfig $hostDateTimeConfig.ntpConfig = $hostNtpConfig $hostDateTimeConfig.ntpConfig.server = $ntpServers } PROCESS { $vmHost = $_ $vmHostView = Get-View $vmHost.ID $dateTimeSystem = $vmHostView.ConfigManager.DateTimeSystem $DateTimeSystemRef = Get-View $dateTimeSystem $DateTimeSystemRef.
Posts
Gzip creation in PowerShell – Gzip-FileSimple.ps1
I have a need to compress some of the data I am exporting using PowerShell so I figured why not use PowerShell to do it? I did not want to have a dependency on the Community Extensions even though they have solved this problem already. Luckily in newer versions of .Net there is the System.IO.Compression class.
Here is my code which is based off of the Microsoft example for the class.
Posts
Ohio LinuxFest 2009
If you are anywhere around Ohio and interested in Linux you may want to check out Ohio LinuxFest 2009. It is being held September 25th & 26th in Columbus Ohio.
This will be my first year attending, but I have heard good things about the conference and am looking forward to talking with some other Open Source enthusiasts in the area.
Posts
PyOhio 2009
I just finished attending my first PyOhio and I have to say that I enjoyed it. It was interesting to see so many people involved enough in their interests to spend a weekend talking about code. There were sessions geared to all levels of Python knowledge and a wealth of knowledge to be shared.
I am a Python novice so my ability to hang in on the deeper side discussions was limited, but I came away with much more information and a bunch of areas to dig into deeper.