Tag: VMWare



Today, I was working on creating a script that updates some of our Student Information System core files on some workstations, and since my whole environment is based on VMWare View, I had to find a way to get the constantly changing VM numbers to be reported to the script which is supposed to update these files.

My method was to write a PowerShell script using the vSphere PowerCLI tools to get all my VMs and format them to get the total number of powered on VMs in a specific resource pool, as well as which workstations are actually available.

(Since I’m using VMWare View in a non-peristent pool, and having the VMs destroyed after the first log off, it’s hard to keep track what is on, and off, and the sequence of the workstation names is not necessarily always in order. )

Well, the script was simple:

   1:  Add-PSSnapin VMware.VimAutomation.Core
   2:  Connect-VIServer -Server do-vsphere
   3:  Get-ResourcePool "Aeries View Devel" | Get-VM | grep -c -i "AeriesCS-SB-*" \
   4:  | Out-File "\\do-tech\vmlogs$\AeriesVMCount.txt"
   5:  $VMArray = Get-ResourcePool "Aeries View Devel" | Get-VM | grep -i "AeriesCS-SB*" |sort
   6:  
   7:  foreach ($VM in $VMArray)
   8:  {
   9:      $VM = $VM.substring(0, 15)
  10:      $VM = $VM.substring($VM.Length - 3, 3)
  11:      $VM | Out-File -append "\\do-tech\vmlogs$\AeriesVMCount.txt"
  12:  }
 


In opening the results of this file in a KIXtart script, the results were very sporadic, having weird characters, and never returned the expected data. By the way, The ‘Out-File’ in its current form above seems to have the same output effect as a regular DOS redirect command, within the Powershell environment: i.e: $VM > “\\do-tech\vmlogs$\AeriesVMCount.txt”

Since there is no point in listing all the different things I have done, I will tell you exactly what the problem is in this scenario:

Out-File apparently does not, by default output text in ASCII encoding, and therefore, the resulting text is usually un-interpretable by other scripts. In order to fix this, a small modification to the Out-File command would be required, so line 11 would look like this:

$VM | Out-File - append "\\do-tech\vmlogs$\AeriesVMCount.txt" -encoding ASCII

Adding this small addition to the Out-File resolved the problem of incorrect encoding. I spent about 3 hours trying to figure out why my redirection weren’t working until I found the solution. So hopefully this will help someone who is a PowerShell novice like me, who may face the same problem.

  • Share/Bookmark
Print





I felt compelled to create this post on my blog due a recent experience I had with Mimosa Systems: An email-archiving solution that I had the misfortune of getting involved with for my school district.

Before I continue with this account, let me qualify myself, as to not risk the possibility of losing your attention, under the pretext of being “just another disgruntled customer”.

I am an IT professional for 12 years now, and have been specifically involved in system administration, engineering, architecture and design, for most of that period. I have implemented quite a few robust products and infrastructures: i.e: Exchange 2000, 2003, migration from Active Directory to 2000 to 2003, full implementation of VMWare vSphere  4.0, VMWare View 3.5 and 4.0, multiple SANs, Digital Imaging solutions (Viatron), Desktop Management solutions (LANDesk) to name a few. I have done most of those, either on my own, or with the assistance of an implementation company, or working directly with a manufacturer. All this to say that I have had enough experience to know the difference between a professional service, well designed product, efficient implementation, and the polar opposite of the former.

The reason I felt the need to write this review is because I (my school district) has been robbed close to a $100,000 from  Mimosa Systems, with not so much as an apology, ok, not a sincere one at least.

.. continue reading ..

  • Share/Bookmark
Print





I’m in the process of trying to get rid of any thick clients that I currently work on to convert solely to Virtual Machines, and clear out my desk space.
Well, I thought the best way to do this was to move my Precision 690 to the lab, install ESXi on it, and have a my VM on there.

As I tried to add the VM that resides on this ESXi server (which is not part of vCenter), I could not add it as an individual desktop.  I then remembered that I needed to have the View agent installed for this to work. After installing the View Agent, I was hopeful, but alas, the VM still didn’t show up. On Step 3 of adding the machine, it would supposedly give a list of available VMs to add and a find option, but nothing could be found. .. continue reading ..

  • Share/Bookmark
Print



Wordpress Code Snippet by Allan Collins