Posts
Get-VmDiskPersistenceReport
As part of our auditing process I need validate guest disk persistence settings. Here is a simple snippet to get the needed data.
1 2 3 4 Get-VM | ForEach-Object { $vmname = $_.Name $_.HardDisks | Select-Object @{Name="VM"; Expression={$vmname}}, Filename, Persistence }
Posts
Free PowerShell eBook
As reported on the PowerShell Team blog.
Free PowerShell V1 Book From the Makers of PowerShell Plushttp://blogs.msdn.com/powershell/archive/2009/07/17/free-powershell-v1-book-from-the-makers-of-powershell-plus.aspx
Posts
Get-PreviousWeekdayDate
I am fleshing out my automated monitoring/reporting system and I wanted to include some performance data exports. As part of this I always wanted my weekly exports to start on a certain day of the week no matter when the script was run. I also needed to make sure that I received a weeks worth of data.
To help out I wrote this function:
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 # Find the date of a previous weekday.
Posts
Report on HA Isolation Response
1 2 3 4 5 6 7 8 9 10 $desiredResponse = "DoNothing" foreach ($cluster in Get-Cluster) { $result = $cluster | Select-Object Name, HAIsolationResponse, @{Name="DesiredResponse"; Expression={$desiredResponse}} if (!$cluster.HAEnabled) { $result.HAIsolationResponse = "HaNotConfigured" } $result }
Posts
LoadVMs-FromFile
I was using the VMware VI Toolkit for Windows for a change and I needed to load VMs from a CSV and my typical stream oriented way of doing this was very inefficient over the WAN (or LAN really). There are many ways of making Get-VM operations faster, but for this change I decided to use the standard Get-VM cmdlet with an array of computer names instead of doing them one by one.
Posts
VMFS creation error: Unable to read partition information from this disk.
When trying to add a VMFS volume in the VIC I received the message “Unable to read partition information from this disk.” I did not have an option to overwrite any data and could not continue. The SAN administrator said that the disk was presented the exact same way that another working LUN was.
At the console I figured out which device it was (esxcfg-vmhbadevs) and tested to see if I could read the partition table.
Posts
Alternative solution to deployment issues when change Service Console IP
Host IP in vpxa.cfg retains old value after changing service console IP.
The VMware solution is:
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006768
The problem is that I did not want to lose my host’s historical information. An alternative to removing and re-adding the host is to stop the Virtual Center service and update the VPX_HOST table in the Virtual Center database to contain the correct IP for the server(s). When you start the service back up it will update the hosts configuration (vpxa.
Posts
VMware vSphere and Enterprise Plus
So here are the new editions.
Hmm. My current Enterprise licenses will not give me the all of the feature of the new version. There are a lot of angry blog posts out there on this new policy. I do not know if I would consider myself angry, but I am disappointed and more than a little confused.
I understand that as new products come out (* Manager) I will be expected to pay extra for them.
Posts
VMware Converter p2v fails at 2%
My p2v was sticking at 2% and eventually failing. Nothing was apparently wrong and a p2v worked yesterday to the same cluster.
Looking at the logs I ran across a message that led me to this forum post. This was our problem too. We had two NICs in a team – one was ok, but the other one had a duplex mismatch. A quick change of active NICs and the p2v worked just fine.
Posts
Secure Credential Storage
I have added some code to my Scripts/Programs page for securely storing credentials to disk to be used by scripts at a later time.
I explored the VI Credential cmdlets and I was not 100% happy with them so I decided to implement my own version that uses the Microsoft DPAPI for encryption. Make sure to look at the README as it covers usage and current limitations.
I wrote these for use in some automated VMware monitoring I am doing, but there is no reason they have to be used with the VI Toolkit.
Posts
Issue with Read-Host PowerShell 2 CTP3
When using Read-Host with the AsSecureString paramater in PS2 CTP3 the prompt text does not appear. Here is a wrapper function that simulates the basic behavior. This does not implement all of the other parameters of Read-Host as I only needed it for the base case.
1 2 3 4 5 6 7 8 9 # PowerShell v1 Read-Host "blah" -AsSecureString blah: **** System.Security.SecureString # Powershell v2 CTP3 Read-Host "blah" -AsSecureString **** System.
Posts
My Favorite Scripting Editors
Notepad++
I use Notepad++ for quick editing jobs because it is a very capable editor and it has a quick load time. Works on a thumb drive.
Komodo Edit (Komodo IDE)
I use Komodo Edit a lot when I am working with Python, Perl, VBScript, JScript, or XML files. It works on my Linux system as well which is a great bonus. I like this editor because it more of a development environment and gives me a lot of flexibility in configuration and custom tools.