<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Robert&#039;s Blog</title>
	<atom:link href="http://www.robertwmartin.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.robertwmartin.com</link>
	<description>Windows, PowerShell, Exchange &#38; VMware</description>
	<lastBuildDate>Wed, 28 Mar 2012 17:43:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Script: Fix SSL Issue VMware 5</title>
		<link>http://www.robertwmartin.com/?p=363</link>
		<comments>http://www.robertwmartin.com/?p=363#comments</comments>
		<pubDate>Wed, 28 Mar 2012 17:41:58 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[VMware]]></category>
		<category><![CDATA[VMware CLI]]></category>
		<category><![CDATA[HostReconnect]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[VMware SSL]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=363</guid>
		<description><![CDATA[&#8220;vSphere HA cannot be configured on this host because it&#8217;s SSL thumbprint has not been verified. Check that vCenter server is configured to verify SSL thumbprints and that the thumbprint for this host has been verified&#8221; Have you recently upgraded to vSphere 5 and having issues with SSL, I found several articles that have many [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="font-size: medium;">&#8220;vSphere HA cannot be configured on this host because it&#8217;s SSL thumbprint has not been verified. Check that vCenter server is configured to verify SSL thumbprints and that the thumbprint for this host has been verified&#8221;</span></strong></p>
<p>Have you recently upgraded to vSphere 5 and having issues with SSL, I found several articles that have many different ways of doing it. But you will find that the SSL Thumbprints do not get updated in the Database and many articles tell you how to fix it like the following article <a href="http://longwhiteclouds.com/2012/02/04/the-trouble-with-ca-ssl-certificates-and-esxi-5/">http://longwhiteclouds.com/2012/02/04/the-trouble-with-ca-ssl-certificates-and-esxi-5/</a> or <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=2006210">http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=2006210</a></p>
<p>The issue I ran into was I had to run the script HostReconnect.pl after each host and in my environment we have over 60 hosts and it takes some time to run, so I modified the HostReconnect.pl script and attached it below called SingleHostReconnect.pl that will allow you to pass it one host</p>
<p><a href="http://www.robertwmartin.com/wp-content/uploads/2012/03/SingleHostReconnect.txt">SingleHostReconnect</a></p>
<p>You can call the script like this  SingleHostReconnect.pl &#8211;server VC-ServerName &#8211;username VC User &#8211;sourcehost ESXHOST</p>
<pre class="brush: powershell; title: ; notranslate" title="SingleHostReconnect">#!/usr/bin/perl -w
#
# Copyright 2006 VMware, Inc.  All rights reserved.
#

use strict;
use warnings;
use VMware::VIRuntime;

sub WaitForTask($;$)
{
  my $taskMoRef=shift;
  my $LinePrefix=shift;
  if (! defined $LinePrefix)
  {
    $LinePrefix='';
  }
  my $task=Vim::get_view(mo_ref=&gt;$taskMoRef);
  my $message='';
  my $oldmessage=".";

  while ($$task{info}{state}{val} =~ /queued|running/)
  {
    $message=$$task{info}{state}{val};
    if ($$task{info}{state}{val} eq 'queued')
    {
      sleep 1;
    }
    if ($$task{info}{state}{val} eq 'running')
    {
      if (defined($$task{info}{progress}))
      {
        $message=$message." ".$$task{info}{progress}."%";
      }
    }
    if ($$task{info}{description})
    {
      if ($$task{info}{description}{message})
      {
        $message=$message.": ".$$task{info}{description}{message};
      }
    }
    if ($message ne $oldmessage)
    {
      $oldmessage=$message;
      print $LinePrefix.$message."\n";
    }
    #Update the task
    $task=Vim::get_view(mo_ref=&gt;$$task{mo_ref});
  }
  print $LinePrefix.$$task{info}{state}{val};
  if ($$task{info}{state}{val} eq 'error')
  {
    print ": ".$$task{info}{error}{localizedMessage};
  }
  print "\n";
  return $$task{info}{state}{val};
}

my %opts = (
   sourcehost =&gt; {
      type =&gt; "=s",
      help =&gt; "You need to use --sourcehost HOSTNAME",
      required =&gt; 1,
   }, 

);

Opts::add_options(%opts);
Opts::parse();
Opts::validate();
Util::connect();

# get the hosts called with sourcehost
my $host_views = Vim::find_entity_views(view_type =&gt; 'HostSystem', filter =&gt; {name =&gt; Opts::get_option('sourcehost')});

foreach my $host (@$host_views)
{
  print "Reconfiguring $$host{name} $$host{mo_ref}{value}";
  my $sslThumbprint = $$host{summary}{config}{sslThumbprint};
  print " to use SSL Thumbprint: $sslThumbprint:\n";
  my $host_connect_spec = (HostConnectSpec-&gt;new(force=&gt;1, sslThumbprint=&gt;$sslThumbprint));

    WaitForTask $host-&gt;ReconnectHost_Task(cnxSpec=&gt;$host_connect_spec), "  Reconnecting: ";
}
Util::disconnect();
# vim: ts=8 sts=2 sw=2 et</pre>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=363" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=363</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting Lync Address Book Syncing Issue</title>
		<link>http://www.robertwmartin.com/?p=355</link>
		<comments>http://www.robertwmartin.com/?p=355#comments</comments>
		<pubDate>Thu, 22 Mar 2012 16:19:48 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[Lync 2010]]></category>
		<category><![CDATA[Address Book]]></category>
		<category><![CDATA[GPO]]></category>
		<category><![CDATA[Lync]]></category>
		<category><![CDATA[Syncronization Issue]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=355</guid>
		<description><![CDATA[I have been looking for days regarding an issue we saw in our environment regarding a Lync rollout, if your clients are getting the red exclamation point in Lync or if you hover over Lync in the system tray and see the red exclamation mark or the message &#8220;cannot synchronize with the corporate address book [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking for days regarding an issue we saw in our environment regarding a Lync rollout, if your clients are getting the red exclamation point in Lync or if you hover over Lync in the system tray and see the red exclamation mark or the message &#8220;cannot synchronize with the corporate address book this may be because the proxy server setting&#8221; or something to that affect and you have searched all over the web and every article says check you IIS for valid certificate and like me you where confused because the certificate is valid. Here is the problem, it has to do with the internal Microsoft Certificate Authority publishing the CRL (Certificate Revocation List) URL on port 80 but it needs to be on SSL.</p>
<p>Here is a work around:</p>
<p>1. Open Internet Explorer</p>
<p>2. Select the Advanced tab</p>
<p>3. Scroll down to the Security Section, and then <span style="text-decoration: underline;">uncheck: </span>&#8220;Check for server certificate revocation*&#8221;</p>
<p>4. Close IE</p>
<p>5. Exit out of Lync &#8220;You must close it from system tray&#8221;</p>
<p>6. Restart Lync</p>
<p><a href="http://www.robertwmartin.com/wp-content/uploads/2012/03/IESettings.png"><img class="alignnone size-full wp-image-356" title="IESettings" src="http://www.robertwmartin.com/wp-content/uploads/2012/03/IESettings.png" alt="" width="423" height="541" /></a></p>
<p>The problem should now be gone</p>
<p>You can globally make this change using a GPO (Group Policy Object)</p>
<p>1. On domain controller open Group policy management console</p>
<p>2. Under domains right click on domain and select “Create a GPO for this domain and link it here”</p>
<p>3. Give a name and click OK</p>
<p>4. Right click the policy name which you created in Step 3 and click Edit, It will open Group policy management editor</p>
<p>5. Expand policies under Computer Configuration and Click Add/Remove templates on Administrative Templates</p>
<p>6. Add the template which is attached to this post</p>
<p>7. Then expand windows Components and expand Internet explorer</p>
<p>8. Under Internet explorer expand Internet control panel and click on Advanced page</p>
<p>9. On the right pane double click on “Check for server certificate revocation” and disable it</p>
<p>10. Force the policy and run gpupdate /force on the client machines or reboot them</p>
<p><a href="http://www.robertwmartin.com/wp-content/uploads/2012/03/inetres.zip">inetres adm</a></p>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=355" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=355</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Powershell Form: Provision VMs via GUI and set custom values</title>
		<link>http://www.robertwmartin.com/?p=343</link>
		<comments>http://www.robertwmartin.com/?p=343#comments</comments>
		<pubDate>Wed, 21 Mar 2012 21:46:47 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[PCI Security]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VM]]></category>
		<category><![CDATA[VM Templates]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=343</guid>
		<description><![CDATA[If you are like me you are constantly getting requests to build VMs so I developed this form to allow me to quickly provision VMs and set custom values. I hope this helps someone else as it saves me time. ######################################################################## # Code By: Robert Martin # URL: www.robertwmartin.com # Used: PrimalForms ######################################################################## #---------------------------------------------- #region [...]]]></description>
			<content:encoded><![CDATA[<p>If you are like me you are constantly getting requests to build VMs so I developed this form to allow me to quickly provision VMs and set custom values. I hope this helps someone else as it saves me time.</p>
<p><a href="http://www.robertwmartin.com/wp-content/uploads/2012/03/NewVMForm1.png"><img class="alignnone size-full wp-image-349" title="NewVMForm" src="http://www.robertwmartin.com/wp-content/uploads/2012/03/NewVMForm1.png" alt="" width="490" height="427" /></a></p>
<pre class="brush: powershell; title: ; notranslate" title="">########################################################################
# Code By: Robert Martin
# URL: www.robertwmartin.com
# Used: PrimalForms
########################################################################

#----------------------------------------------
#region Application Functions
#----------------------------------------------

function OnApplicationLoad {
	#Note: This function runs before the form is created
	#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
	#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
	#Important: Form controls cannot be accessed in this function
	#TODO: Add snapins and custom code to validate the application load

	return $true #return true for success or false for failure
}

function OnApplicationExit {
	#Note: This function runs after the form is closed
	#TODO: Add custom code to clean up and unload snapins when the application exits

	$script:ExitCode = 0 #Set the exit code for the Packager
}

#endregion

#----------------------------------------------
# Generated Form Function
#----------------------------------------------
function GenerateForm {

	#----------------------------------------------
	#region Import Assemblies
	#----------------------------------------------
	[void][reflection.assembly]::Load("System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
	[void][reflection.assembly]::Load("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	[void][reflection.assembly]::Load("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
	#endregion

	#----------------------------------------------
	#region Generated Form Objects
	#----------------------------------------------
	[System.Windows.Forms.Application]::EnableVisualStyles()
	$form1 = New-Object System.Windows.Forms.Form
	$txtVMName = New-Object System.Windows.Forms.TextBox
	$label11 = New-Object System.Windows.Forms.Label
	$btnClose = New-Object System.Windows.Forms.Button
	$txtPassword = New-Object System.Windows.Forms.TextBox
	$label10 = New-Object System.Windows.Forms.Label
	$txtUsername = New-Object System.Windows.Forms.TextBox
	$label9 = New-Object System.Windows.Forms.Label
	$txtVC = New-Object System.Windows.Forms.TextBox
	$label8 = New-Object System.Windows.Forms.Label
	$btnBuild = New-Object System.Windows.Forms.Button
	$cboGuest = New-Object System.Windows.Forms.ComboBox
	$label7 = New-Object System.Windows.Forms.Label
	$cboNetwork = New-Object System.Windows.Forms.ComboBox
	$label6 = New-Object System.Windows.Forms.Label
	$cboCluster = New-Object System.Windows.Forms.ComboBox
	$label5 = New-Object System.Windows.Forms.Label
	$label4 = New-Object System.Windows.Forms.Label
	$cboMem = New-Object System.Windows.Forms.ComboBox
	$cboCPU = New-Object System.Windows.Forms.ComboBox
	$label3 = New-Object System.Windows.Forms.Label
	$txtPurpose = New-Object System.Windows.Forms.TextBox
	$label2 = New-Object System.Windows.Forms.Label
	$txtOwner = New-Object System.Windows.Forms.TextBox
	$label1 = New-Object System.Windows.Forms.Label
	$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState
	#endregion Generated Form Objects

	#----------------------------------------------
	# User Generated Script
	#----------------------------------------------

	$FormEvent_Load={
		#TODO: Initialize Form Controls here

	}

	$handler_btnClose_Click={
	#TODO: Place custom script here
	$form1.Close()
	}

	$handler_btnBuild_Click={
	#TODO: Place custom script here
	Add-PSSnapIn vmware.vimautomation.core
	Connect-VIServer $txtVC.Text -User $txtUsername.Text -Password $txtPassword.Text
	# --- Variables
	$owner = $txtOwner.Text
	$purpose = $txtPurpose.Text
	$vmname = $txtVMName.Text
	$numcpu = $cboCPU.Text
	$memvalue = $cboMem.Text
	$diskvalue = 37
	$memMB = [int]$memvalue * 1024
	$diskMB = $diskvalue * 1024
	$passedcluster = $cboCluster.Text
	$nn = $cboNetwork.Text
	$guestType = $cboGuest.Text

	switch ($guestType)
	{

		"Red Hat Enterprise Linux 5 (64-bit)"
	  	{
			$gi = "rhel5_64Guest";
	  	}

		"Red Hat Enterprise Linux 5 (32-bit)"
	  	{
	                     $gi = "rhel5Guest";
	  	}
	  	"Red Hat Enterprise Linux 6 (64-bit)"
	  	{
	  		$gi = "rhel6_64Guest"
		}
		"Red Hat Enterprise Linux 6 (32-bit)"
		{
			$gi = "rhel6Guest"
		}
		"Windows Server 2008 R2 (64-bit)"
		{
			$gi = "windows7Server64Guest"
		}
		"Windows Server 2008 (32-bit)"
		{
			$gi = "winLonghornGuest"
		}
		"Windows Server 2008 (64-bit)"
		{
			$gi = "winLonghorn64Guest"
		}
		"Windows Server 2003 (32-bit)"
		{
			$gi = "winNetStandardGuest"
		}
		"Windows Server 2003 (64-bit)"
		{
			$gi = "winNetStandard64Guest"
		}
		"Windows 7 (32-bit)"
		{
			$gi = "windows7Guest"
		}
		"Windows 7 (64-bit)"
		{
			$gi = "windows7_64Guest"
		}
		"Windows XP Professional (32-bit)"
		{
			$gi = "winXPProGuest"
		}
		"Windows XP Professional (64-bit)"
		{
			$gi = "winXPPro64Guest"
		}
		"Windows Server 2003 R2 (32-bit)"
		{
			$gi = "winNetStandardGuest"
		}
		"Windows Server 2003 R2 (64-bit)"
		{
			$gi = "winNetStandard64Guest"
		}
	}
	# This will go out to your Virtual Center and pull the Cluster to put your new VM in
	$ResPol = (Get-ResourcePool | where {$_.Parent.ToString() -eq "$passedcluster"} | Select Id).Id.ToString()
	# This will find the least busiest host
	$NewHost = (Get-Cluster "$passedcluster" | Get-VMHost | Sort $_.CPuUsageMhz -Descending | Select -First 1).Name.ToString()
	# This will find a Datastore with least used space available to the host selected above
	$ds = (Get-VMhost $NewHost | Get-Datastore | Where { ($_.FreespaceMB -gt '1024') -And ($_.Name -notlike "*Templates*") -And ($_.Name -notlike "*local*")  -And ($_.Name -notlike "*ISO*")} | Sort-Object FreeSpaceMB -descending | Select -First 1).Name.ToString()

	# This determines what OS the guest is and if Linux builds it from scratch and if not uses a Template and puts the VM in a Folder called Provisioned VMs
	if  ($guestType -match "Red Hat*")
	{
	#### --- We Build the VM from scratch
	New-VM -name $vmname -VMHost $NewHost -numcpu $numcpu -DiskMB $diskMB -memoryMB $memMB -datastore $ds -guestID $gi -cd -NetworkName "$nn" -Location "ProvisionedVMs"
	}
	ElseIf ($guestType -like "Windows Server 2003 *32-bit*")
	{
	#### --- We Build the VM from Template
	New-VM -Name $vmname -VMHost $NewHost -Template "TEMPLATE - PHX - W2K3 R2 x64 STD" -OSCustomizationSpec "Windows 2003 R2 x64" -datastore $ds -Location "ProvisionedVMs"
	}
	ElseIf ($guestType -like "Windows Server 2003 *64-bit*")
	{
	#### --- We Build the VM from Template
	New-VM -Name $vmname -VMHost $NewHost -Template "TEMPLATE - PHX - W2K3 R2 x32 STD" -OSCustomizationSpec "Windows 2003 R2 x32" -datastore $ds -Location "ProvisionedVMs"
	}
	Else
	{
	#### --- We Build the VM from Template
	New-VM -Name $vmname -VMHost $NewHost -Template "TEMPLATE - PHX - W2K8 R2 STD SP1" -OSCustomizationSpec "Windows 2008 R2" -datastore $ds -Location "ProvisionedVMs"
	}

	# We wait for the VM to be created prior to setting custom values
	Start-Sleep 15

	# ------- setCustomValue -------
	# We have VC Custom Attribues for Owner and Purpose and we set that info here

	$vm = Get-VM $vmname | Get-View
	$vm.setCustomValue("Purpose", $purpose)
	$vm.setCustomValue("Business Owner", $owner)
	$vmConfigSpec  = New-Object VMware.Vim.VirtualMachineConfigSpec
	$vmConfigSpec.annotation = "Owner: $owner`nPurpose: $purpose"
	$vm.ReconfigVM_Task($vmConfigSpec )

	# We set the Memory and CPU here after VM is built
	Get-VM $vmname | Set-VM -MemoryMB $memMB -NumCpu $numcpu -Confirm:$false

	# Here we follow PCI hardening guidelines here and set them
	$SecurityOptions = @{
	    # Security Harding Guideline VMX01
	    "isolation.tools.diskShrink.disable"="true";
	    "isolation.tools.diskWiper.disable"="true";
	    # Security Harding Guideline VMX02
	    "RemoteDisplay.maxConnections"="1"
	    # Security Harding Guideline VMX11
	    "isolation.tools.connectable.disable"="true";
	    "isolation.tools.edit.disable"="true";
	    # Security Harding Guideline VMX12
	    "vmci0.unrestricted"="FALSE";
	    # Security Harding Guideline VMX20
	    "log.keepOld"="10";
	    "log.rotateSize"="100000"
	    # Security Harding Guideline VMX21
	    "tools.setInfo.sizeLimit"="1048576";
	    # Security Harding Guideline VMX30
	    "guest.command.enabled"="FALSE";
	    # Security Harding Guideline VMX31
	    "tools.guestlib.enableHostInfo"="FALSE"
	}

	$SecurityConfigurationSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

	Foreach ($SecurityOption in $SecurityOptions.GetEnumerator()) {
	    $SecurityOptionValue = New-Object VMware.Vim.optionvalue
	    $SecurityOptionValue.Key = $SecurityOption.Key
	    $SecurityOptionValue.Value = $SecurityOption.Value
	    $SecurityConfigurationSpec.extraconfig +=  $SecurityOptionValue
	}
	$VM.ReconfigVM_Task($SecurityConfigurationSpec)
	Write  "$($VM.Name) - changed"

	# In our company we let the Linux team load there OS via scripts so we don't start it
	if  ($guestType -match "Red Hat*")
	{
	}
	Else
	{
	# Otherwise if it is Windows we start the VM and let VMware finish configuring it
	Start-VM -VM $vmname
	}
	}

	#----------------------------------------------
	# Generated Events
	#----------------------------------------------

	$Form_StateCorrection_Load=
	{
		#Correct the initial state of the form to prevent the .Net maximized form issue
		$form1.WindowState = $InitialFormWindowState
	}

	#----------------------------------------------
	#region Generated Form Code
	#----------------------------------------------
	#
	# form1
	#
	$form1.Controls.Add($txtVMName)
	$form1.Controls.Add($label11)
	$form1.Controls.Add($btnClose)
	$form1.Controls.Add($txtPassword)
	$form1.Controls.Add($label10)
	$form1.Controls.Add($txtUsername)
	$form1.Controls.Add($label9)
	$form1.Controls.Add($txtVC)
	$form1.Controls.Add($label8)
	$form1.Controls.Add($btnBuild)
	$form1.Controls.Add($cboGuest)
	$form1.Controls.Add($label7)
	$form1.Controls.Add($cboNetwork)
	$form1.Controls.Add($label6)
	$form1.Controls.Add($cboCluster)
	$form1.Controls.Add($label5)
	$form1.Controls.Add($label4)
	$form1.Controls.Add($cboMem)
	$form1.Controls.Add($cboCPU)
	$form1.Controls.Add($label3)
	$form1.Controls.Add($txtPurpose)
	$form1.Controls.Add($label2)
	$form1.Controls.Add($txtOwner)
	$form1.Controls.Add($label1)
	$form1.ClientSize = New-Object System.Drawing.Size(486,372)
	$form1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$form1.Name = "form1"
	$form1.Text = "New VM Build Form"
	$form1.add_Load($FormEvent_Load)
	#
	# txtVMName
	#
	$txtVMName.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$txtVMName.Location = New-Object System.Drawing.Point(146,337)
	$txtVMName.Name = "txtVMName"
	$txtVMName.Size = New-Object System.Drawing.Size(133,20)
	$txtVMName.TabIndex = 20
	#
	# label11
	#
	$label11.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label11.Location = New-Object System.Drawing.Point(13,337)
	$label11.Name = "label11"
	$label11.Size = New-Object System.Drawing.Size(100,23)
	$label11.TabIndex = 19
	$label11.Text = "VM Name"
	#
	# btnClose
	#
	$btnClose.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$btnClose.Location = New-Object System.Drawing.Point(389,337)
	$btnClose.Name = "btnClose"
	$btnClose.Size = New-Object System.Drawing.Size(75,23)
	$btnClose.TabIndex = 18
	$btnClose.Text = "Close"
	$btnClose.UseVisualStyleBackColor = $True
	$btnClose.add_Click($handler_btnClose_Click)
	#
	# txtPassword
	#
	$txtPassword.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$txtPassword.Location = New-Object System.Drawing.Point(146,310)
	$txtPassword.Name = "txtPassword"
	$txtPassword.PasswordChar = '*'
	$txtPassword.Size = New-Object System.Drawing.Size(133,20)
	$txtPassword.TabIndex = 17
	$txtPassword.UseSystemPasswordChar = $True
	#
	# label10
	#
	$label10.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label10.Location = New-Object System.Drawing.Point(13,310)
	$label10.Name = "label10"
	$label10.Size = New-Object System.Drawing.Size(100,23)
	$label10.TabIndex = 16
	$label10.Text = "Password"
	#
	# txtUsername
	#
	$txtUsername.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$txtUsername.Location = New-Object System.Drawing.Point(146,283)
	$txtUsername.Name = "txtUsername"
	$txtUsername.Size = New-Object System.Drawing.Size(133,20)
	$txtUsername.TabIndex = 15
	#
	# label9
	#
	$label9.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label9.Location = New-Object System.Drawing.Point(13,283)
	$label9.Name = "label9"
	$label9.Size = New-Object System.Drawing.Size(100,23)
	$label9.TabIndex = 14
	$label9.Text = "User"
	#
	# txtVC
	#
	$txtVC.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$txtVC.Location = New-Object System.Drawing.Point(146,256)
	$txtVC.Name = "txtVC"
	$txtVC.Size = New-Object System.Drawing.Size(259,20)
	$txtVC.TabIndex = 13
	$txtVC.Text = "vcenter.domain.local"
	#
	# label8
	#
	$label8.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label8.Location = New-Object System.Drawing.Point(13,256)
	$label8.Name = "label8"
	$label8.Size = New-Object System.Drawing.Size(100,23)
	$label8.TabIndex = 12
	$label8.Text = "Virtual Center"
	#
	# btnBuild
	#
	$btnBuild.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$btnBuild.Location = New-Object System.Drawing.Point(307,337)
	$btnBuild.Name = "btnBuild"
	$btnBuild.Size = New-Object System.Drawing.Size(75,23)
	$btnBuild.TabIndex = 11
	$btnBuild.Text = "Build VM"
	$btnBuild.UseVisualStyleBackColor = $True
	$btnBuild.add_Click($handler_btnBuild_Click)
	#
	# cboGuest
	#
	$cboGuest.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$cboGuest.FormattingEnabled = $True
	[void]$cboGuest.Items.Add("Windows Server 2008 R2 (64-bit)")
	[void]$cboGuest.Items.Add("Windows Server 2008 (32-bit)")
	[void]$cboGuest.Items.Add("Windows Server 2008 (64-bit)")
	[void]$cboGuest.Items.Add("Windows 7 (32-bit)")
	[void]$cboGuest.Items.Add("Windows 7 (64-bit)")
	[void]$cboGuest.Items.Add("Windows Server 2003 R2 (32-bit)")
	[void]$cboGuest.Items.Add("Windows Server 2003 R2 (64-bit)")
	[void]$cboGuest.Items.Add("Windows Server 2003 (32-bit)")
	[void]$cboGuest.Items.Add("Windows Server 2003 (64-bit)")
	[void]$cboGuest.Items.Add("Windows XP Professional (32-bit)")
	[void]$cboGuest.Items.Add("Windows XP Professional (64-bit)")
	[void]$cboGuest.Items.Add("Red Hat Enterprise Linux 6 (32-bit)")
	[void]$cboGuest.Items.Add("Red Hat Enterprise Linux 6 (64-bit)")
	[void]$cboGuest.Items.Add("Red Hat Enterprise Linux 5 (32-bit)")
	[void]$cboGuest.Items.Add("Red Hat Enterprise Linux 5 (64-bit)")
	$cboGuest.Location = New-Object System.Drawing.Point(146,230)
	$cboGuest.Name = "cboGuest"
	$cboGuest.Size = New-Object System.Drawing.Size(296,21)
	$cboGuest.TabIndex = 10
	#
	# label7
	#
	$label7.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label7.Location = New-Object System.Drawing.Point(13,229)
	$label7.Name = "label7"
	$label7.Size = New-Object System.Drawing.Size(100,23)
	$label7.TabIndex = 9
	$label7.Text = "Guest"
	#
	# cboNetwork
	#
	$cboNetwork.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$cboNetwork.FormattingEnabled = $True
	[void]$cboNetwork.Items.Add("Enterprise Network")
	[void]$cboNetwork.Items.Add("Backup Network")
	[void]$cboNetwork.Items.Add("Add More Network here as they are listed in VC")
	$cboNetwork.Location = New-Object System.Drawing.Point(146,202)
	$cboNetwork.Name = "cboNetwork"
	$cboNetwork.Size = New-Object System.Drawing.Size(296,21)
	$cboNetwork.TabIndex = 8
	#
	# label6
	#
	$label6.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label6.Location = New-Object System.Drawing.Point(13,202)
	$label6.Name = "label6"
	$label6.Size = New-Object System.Drawing.Size(100,23)
	$label6.TabIndex = 7
	$label6.Text = "Network"
	#
	# cboCluster
	#
	$cboCluster.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$cboCluster.FormattingEnabled = $True
	[void]$cboCluster.Items.Add("PHX - Dev")
	[void]$cboCluster.Items.Add("PHX - Production")
	[void]$cboCluster.Items.Add("PHX - QA")
	[void]$cboCluster.Items.Add("Add More clusters here as they are listed in VC")
	$cboCluster.Location = New-Object System.Drawing.Point(146,175)
	$cboCluster.Name = "cboCluster"
	$cboCluster.Size = New-Object System.Drawing.Size(296,21)
	$cboCluster.TabIndex = 6
	#
	# label5
	#
	$label5.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label5.Location = New-Object System.Drawing.Point(13,175)
	$label5.Name = "label5"
	$label5.Size = New-Object System.Drawing.Size(100,23)
	$label5.TabIndex = 5
	$label5.Text = "Cluster"
	#
	# label4
	#
	$label4.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label4.Location = New-Object System.Drawing.Point(13,148)
	$label4.Name = "label4"
	$label4.Size = New-Object System.Drawing.Size(100,23)
	$label4.TabIndex = 4
	$label4.Text = "Memory"
	#
	# cboMem
	#
	$cboMem.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$cboMem.FormattingEnabled = $True
	[void]$cboMem.Items.Add("1")
	[void]$cboMem.Items.Add("2")
	[void]$cboMem.Items.Add("3")
	[void]$cboMem.Items.Add("4")
	[void]$cboMem.Items.Add("5")
	[void]$cboMem.Items.Add("6")
	[void]$cboMem.Items.Add("7")
	[void]$cboMem.Items.Add("8")
	$cboMem.Location = New-Object System.Drawing.Point(146,148)
	$cboMem.Name = "cboMem"
	$cboMem.Size = New-Object System.Drawing.Size(121,21)
	$cboMem.TabIndex = 3
	#
	# cboCPU
	#
	$cboCPU.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$cboCPU.FormattingEnabled = $True
	[void]$cboCPU.Items.Add("1")
	[void]$cboCPU.Items.Add("2")
	[void]$cboCPU.Items.Add("3")
	[void]$cboCPU.Items.Add("4")
	[void]$cboCPU.Items.Add("5")
	[void]$cboCPU.Items.Add("6")
	[void]$cboCPU.Items.Add("7")
	[void]$cboCPU.Items.Add("8")
	$cboCPU.Location = New-Object System.Drawing.Point(146,120)
	$cboCPU.Name = "cboCPU"
	$cboCPU.Size = New-Object System.Drawing.Size(121,21)
	$cboCPU.TabIndex = 2
	#
	# label3
	#
	$label3.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label3.Location = New-Object System.Drawing.Point(13,119)
	$label3.Name = "label3"
	$label3.Size = New-Object System.Drawing.Size(100,23)
	$label3.TabIndex = 3
	$label3.Text = "Number of CPUs"
	#
	# txtPurpose
	#
	$txtPurpose.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$txtPurpose.Location = New-Object System.Drawing.Point(146,40)
	$txtPurpose.Multiline = $True
	$txtPurpose.Name = "txtPurpose"
	$txtPurpose.ScrollBars = [System.Windows.Forms.ScrollBars]::Vertical
	$txtPurpose.Size = New-Object System.Drawing.Size(296,69)
	$txtPurpose.TabIndex = 1
	#
	# label2
	#
	$label2.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label2.Location = New-Object System.Drawing.Point(13,40)
	$label2.Name = "label2"
	$label2.Size = New-Object System.Drawing.Size(100,23)
	$label2.TabIndex = 2
	$label2.Text = "Purpose"
	#
	# txtOwner
	#
	$txtOwner.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$txtOwner.Location = New-Object System.Drawing.Point(146,13)
	$txtOwner.Name = "txtOwner"
	$txtOwner.Size = New-Object System.Drawing.Size(296,20)
	$txtOwner.TabIndex = 0
	#
	# label1
	#
	$label1.DataBindings.DefaultDataSourceUpdateMode = [System.Windows.Forms.DataSourceUpdateMode]::OnValidation
	$label1.Location = New-Object System.Drawing.Point(13,13)
	$label1.Name = "label1"
	$label1.Size = New-Object System.Drawing.Size(100,23)
	$label1.TabIndex = 0
	$label1.Text = "Business Owner(s)"
	#endregion Generated Form Code

	#----------------------------------------------

	#Save the initial state of the form
	$InitialFormWindowState = $form1.WindowState
	#Init the OnLoad event to correct the initial state of the form
	$form1.add_Load($Form_StateCorrection_Load)
	#Show the Form
	return $form1.ShowDialog()

} #End Function

#Call OnApplicationLoad to initialize
if(OnApplicationLoad -eq $true)
{
	#Create the form
	GenerateForm | Out-Null
	#Perform cleanup
	OnApplicationExit
}</pre>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=343" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=343</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Script: Pull Diags from Dell EqualLogic Arrays and send email</title>
		<link>http://www.robertwmartin.com/?p=335</link>
		<comments>http://www.robertwmartin.com/?p=335#comments</comments>
		<pubDate>Tue, 20 Mar 2012 21:37:57 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[EqualLogic]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Dell EqualLogic]]></category>
		<category><![CDATA[Diags]]></category>
		<category><![CDATA[NetCMDLets]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=335</guid>
		<description><![CDATA[I recently had to keep pulling diags from my many Dell EqualLogics and zipping them up and sending them to dell support. Here is a script that I wrote that will loop through your arrays and pull diags, download them to your machine, zip them up and email them to whoever you want. I hope [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to keep pulling diags from my many Dell EqualLogics and zipping them up and sending them to dell support. Here is a script that I wrote that will loop through your arrays and pull diags, download them to your machine, zip them up and email them to whoever you want. I hope this helps someone out as it has been invaluable to be lately.</p>
<pre class="brush: powershell; title: ; notranslate" title="">#Create array of EqualLogic Arrays
$EQArrays = @("iSCSI01","iSCSI02","iSCSI03","iSCSI04","iSCSI05","iSCSI06")
$username = "groupusername"
$password = "grouppassword"
$mailserver = "yourmailserver.com"
$to = "user@domain.com"
$from = "dellequallogic@domain.com"
#Loop through all the Arrays
foreach ($EQArray in $EQArrays)
{
# We Telnet to each array and run diag and tell it not to send email and run as batch so it doesn't prompt you for info. Use diag -h for arguments
invoke-Telnet -Server $EQArray -user $username -password $password -command "diag -bn" -ShellPrompt "&gt;" -timeout 1200
write-Host "diag -bn ran on " $EQArray
# I have a directory on my machine for each array so we change to each directory here
CD C:\$EQArray\
# We FTP to the Array and download all the Diag Files
Get-FTP -user $username -password $password -server $EQArray -remotefile *.dgo
write-Host "Copying files for " $EQArray
# We remove the Diag Files once downloaded
remove-ftp -server $EQArray -user $username -password $password -remotefile *.dgo
write-Host "Removing files on " $EQArray
# We Zip up the files into a Zip file so we can easily send it to Dell Support
compress-zip -Input C:\$EQArray\*.dgo -Output C:\$EQArray\$EQArray.zip
write-Host "Zipping files for " $EQArray
# We send email with attachment to whoever you have in To Section above
send-email -server $mailserver -from $from -to $to -subject "DGO Files from $EQArray" -message "Attached are the DGO files from $EQArray" -attachment "C:\$EQArray\$EQArray.zip"
write-Host "Sending email for " $EQArray
# We loop through our local directory and delete all Diag files
get-childitem c:\$EQArray -include *.dgo -recurse | foreach ($_) {remove-item $_.fullname}
write-Host "Removing local files for " $EQArray
# We delete the zip file since we already emails it
Remove-Item c:\$EQArray\$EQArray.zip
write-Host "Removing zip file " $EQArrays
}</pre>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=335" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=335</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script: Automated Deployment of Test VMs</title>
		<link>http://www.robertwmartin.com/?p=327</link>
		<comments>http://www.robertwmartin.com/?p=327#comments</comments>
		<pubDate>Tue, 13 Sep 2011 22:35:56 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Automated Provisioning]]></category>
		<category><![CDATA[New-VM]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=327</guid>
		<description><![CDATA[If you have ever had the need to fire up a number of VMs for load testing or anything like that you know it can be a pain to do it the manual way. Here is a script that will allow you to use a Custom Specification to deploy any number of VMs from a [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever had the need to fire up a number of VMs for load testing or anything like that you know it can be a pain to do it the manual way. Here is a script that will allow you to use a Custom Specification to deploy any number of VMs from a Template</p>
<pre class="brush: powershell; title: ; notranslate" title="">$VMName = "vmt0-"
$VMHost = "esxihost.mydomain.local"
$Template = "vmTemp-"
$Datastore = "LUN05"
$CustomSpec = "WinSpec05"
$numberofvms = 10
$NArray = (1..$numberofvms)
foreach ($item in $NArray )
{
new-vm -Name ($VMName + $item) -vmhost $VMHost -Template $Template -Datastore $Datastore -OSCustomizationSpec $CustomSpec
Get-VM ($VMName + $item) | Start-VM
}</pre>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=327" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=327</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script: Set VM Security Settings per VM Hardening Guideline</title>
		<link>http://www.robertwmartin.com/?p=323</link>
		<comments>http://www.robertwmartin.com/?p=323#comments</comments>
		<pubDate>Tue, 13 Sep 2011 21:34:34 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Hardening]]></category>
		<category><![CDATA[MachineConfigSpec]]></category>
		<category><![CDATA[PCI VMware]]></category>
		<category><![CDATA[POSH]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[vSphere 4.1]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=323</guid>
		<description><![CDATA[If you want to set the security setting for one VM you could do something like this # Script for one VM: Get-VM -Name "VMNAME" &#124; Get-View &#124; foreach { $ConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec $OValue = New-Object VMware.Vim.optionvalue $OValue.Key = "isolation.tools.diskShrink.disable" $OValue.Value = "true" $ConfigSpec.extraconfig += $OValue $task = $_.ReconfigVM_Task($ConfigSpec) Write "$($_.Name) - changed" } [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to set the security setting for one VM you could do something like this</p>
<pre class="brush:powershell"># Script for one VM:
Get-VM -Name "VMNAME" | Get-View | foreach {
    $ConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $OValue = New-Object VMware.Vim.optionvalue
    $OValue.Key = "isolation.tools.diskShrink.disable"
    $OValue.Value = "true"
    $ConfigSpec.extraconfig += $OValue
    $task = $_.ReconfigVM_Task($ConfigSpec)
    Write  "$($_.Name) - changed"
}</pre>
<p>If we wanted to check to see if the setting was changed we could run</p>
<pre class="brush:powershell">Get-VM -Name "VMNAME" | Select @{N="Disk Shrink Disabled";E={
          ($_.ExtensionData.Config.ExtraConfig | `
            where {$_.Key -eq "isolation.tools.diskShrink.disable"}).Value}}</pre>
<p>If you wanted to Change that exact setting for all VMs you could run</p>
<pre class="brush:powershell"># Script for all VMs:
Get-VM | Get-View | foreach {
    $ConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $OValue = New-Object VMware.Vim.optionvalue
    $OValue.Key = "isolation.tools.diskShrink.disable"
    $OValue.Value = "true"
    $ConfigSpec.extraconfig += $OValue
    $task = $_.ReconfigVM_Task($ConfigSpec)
    Write  "$($_.Name) - changed"
}</pre>
<p>If we want to test to see if all VMs got the value changed we could run</p>
<pre class="brush:powershell">Get-VM | Select Name, @{N="Disk Shrink Disabled";E={
          ($_.ExtensionData.Config.ExtraConfig | `
            where {$_.Key -eq "isolation.tools.diskShrink.disable"}).Value}}</pre>
<p>If you are wanting to change many security settings at once you could use something like this</p>
<pre class="brush:shell"># Run all the security settings in one shot

$SecurityOptions = @{
    # Security Harding Guideline VMX01
    "isolation.tools.diskShrink.disable"="true";
    "isolation.tools.diskWiper.disable"="true";
    # Security Harding Guideline VMX02
    "RemoteDisplay.maxConnections"="1"
    # Security Harding Guideline VMX11
    "isolation.tools.connectable.disable"="true";
    "isolation.tools.edit.disable"="true";
    # Security Harding Guideline VMX12
    "vmci0.unrestricted"="FALSE";
    # Security Harding Guideline VMX20
    "log.keepOld"="10";
    "log.rotateSize"="100000"
    # Security Harding Guideline VMX21
    "tools.setInfo.sizeLimit"="1048576";
    # Security Harding Guideline VMX30
    "guest.command.enabled"="FALSE";
    # Security Harding Guideline VMX31
    "tools.guestlib.enableHostInfo"="FALSE"
}

$SecurityConfigurationSpec = New-Object VMware.Vim.VirtualMachineConfigSpec

Foreach ($SecurityOption in $SecurityOptions.GetEnumerator()) {
    $SecurityOptionValue = New-Object VMware.Vim.optionvalue
    $SecurityOptionValue.Key = $SecurityOption.Key
    $SecurityOptionValue.Value = $SecurityOption.Value
    $SecurityConfigurationSpec.extraconfig +=  $SecurityOptionValue
}

# Get all VMs that are not of type Template
$VMs2Update = Get-View -ViewType VirtualMachine -Property Name -Filter @{"Config.Template"="false"}

# Run through the VMs and update the settings and let us know it was done
foreach($VM in $VMs2Update){
    $VM.ReconfigVM_Task($SecurityConfigurationSpec)
    Write  "$($VM.Name) - changed"
}</pre>
<p>These are just some ways of to change VM settings via PowerShell</p>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=323" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=323</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Script: Set a timeout for Tech Support Mode</title>
		<link>http://www.robertwmartin.com/?p=298</link>
		<comments>http://www.robertwmartin.com/?p=298#comments</comments>
		<pubDate>Tue, 13 Sep 2011 20:31:16 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[ESX Host Configuration]]></category>
		<category><![CDATA[Tech Support Mode]]></category>
		<category><![CDATA[UserVars.TSMTimeOut]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=298</guid>
		<description><![CDATA[A timeout can be configured for Tech Support Mode (both local and remote), so that after being enabled, it will automatically be disabled after the configured time. A value of ten minutes is recommended, although the exact value depends upon the needs of your particular environment. If Tech Support Mode is left enabled by accident, [...]]]></description>
			<content:encoded><![CDATA[<p>A timeout can be configured for Tech Support Mode (both local and remote), so that after being enabled, it will automatically be disabled after the configured time. A value of ten minutes is recommended, although the exact value depends upon the needs of your particular environment.</p>
<p>If Tech Support Mode is left enabled by accident, it increases the potential for someone to gain privileged access to the host</p>
<p>Best practice is to set a timeout value but if you have several hosts this can be time consuming. The following script will set all your hosts in Virtual Center to 30 minutes. The value is in seconds</p>
<pre class="brush:powershell">Get-VMHost | Set-VMHostAdvancedConfiguration -Name UserVars.TSMTimeOut -Value 1800</pre>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=298" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=298</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script: Create Local ESXi Datastore and change Advance Settings</title>
		<link>http://www.robertwmartin.com/?p=285</link>
		<comments>http://www.robertwmartin.com/?p=285#comments</comments>
		<pubDate>Mon, 12 Sep 2011 23:13:43 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Get-VMHost]]></category>
		<category><![CDATA[PCI Compliance]]></category>
		<category><![CDATA[Syslog]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=285</guid>
		<description><![CDATA[If you are wanting to follow the ESXi Security Guidelines and setup a local datastore and change your Advance settings for each host to point to the new local datastore and have many hosts like I do your gonna want to automate this. With the help of VMware Labs Onyx I came up with the [...]]]></description>
			<content:encoded><![CDATA[<div>If you are wanting to follow the ESXi Security Guidelines and setup a local datastore and change your</div>
<div>Advance settings for each host to point to the new local datastore and have many hosts like I do your</div>
<div>gonna want to automate this. With the help of VMware Labs Onyx I came up with the following script</div>
<div>that will do just that.</div>
<pre class="brush:powershell">Connect-VIServer VC01
$datacenters = Get-Datacenter
foreach($dc in $datacenters)
{
$hosts = Get-Datacenter | where {$_.Id -eq $dc.Id} | Get-VMHost
foreach($item in $hosts)
{
$StorageInfo = Get-VMHost $item | Select StorageInfo
$value = $StorageInfo.StorageInfo.Id.ToString().substring(32, ($StorageInfo.StorageInfo.Id.ToString().length - 32))
$hostname = $item.Name.ToString().substring(0, $item.Name.ToString().indexof("."))

# ------- Make Directory Using the Local Datastore Name -------
$datacenter = New-Object VMware.Vim.ManagedObjectReference
$datacenter.type = "Datacenter"
$datacenter.value = $dc.Id.substring(11, $dc.Id.Length - 11)

$_this = Get-View -Id 'FileManager-FileManager'
$_this.MakeDirectory("[$hostname.local] syslog", $datacenter, $false)

# ------- Update ESX Host Advance Settings Options -------
$updateValue = New-Object VMware.Vim.OptionValue[] (1)
$updateValue[0] = New-Object VMware.Vim.OptionValue
$updateValue[0].key = "Syslog.Local.DatastorePath"
$updateValue[0].value = "[$hostname.local] /syslog/syslog.log"

$_this = Get-View -Id "OptionManager-EsxHostAdvSettings-$value"
$_this.UpdateOptions($updateValue)
}
}</pre>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=285" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=285</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script: Enable Change Block Tracking on all VMs</title>
		<link>http://www.robertwmartin.com/?p=274</link>
		<comments>http://www.robertwmartin.com/?p=274#comments</comments>
		<pubDate>Wed, 25 May 2011 15:40:08 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[CBT]]></category>
		<category><![CDATA[Change Block Tracking]]></category>
		<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=274</guid>
		<description><![CDATA[If you are in need of changing the Change Block Tracking on many VMs at once you can run this script and it will fix them all, as long as they are running Hardware Version 7, it will also complete the stun‐unstun cycle I want to give credit to the article I read to create [...]]]></description>
			<content:encoded><![CDATA[<div>If you are in need of changing the Change Block Tracking on many VMs at once you can run this script and it will fix them all, as long as they are running Hardware Version 7, it will also complete the stun‐unstun cycle</div>
<p></p>
<div>I want to give credit to the article I read to create this script <a href="http://communities.vmware.com/thread/234784">here</a></div>
<p></p>
<div class="boxed" style="border: 1px solid black; width: 565px; background-color:white; padding:10px">
<span style="color: #5F9EA0; font-weight: bold;">Connect-VIServer</span><span style="color: #000000;"> </span><span style="color: #800000;">VC01</span><span style="color: #000000;"></p>
<p></span><span style="color: #0000FF;">Function</span><span style="color: #000000;"> </span><span style="color: #5F9EA0;">EnableChangeBlockTracking</span><span style="color: #000000;"> {<br />
</span><span style="color: #0000FF;">param</span><span style="color: #000000;">(</span><span style="color: #800080;">$vm</span><span style="color: #000000;">)</p>
<p></span><span style="color: #800080;">$vmView</span><span style="color: #000000;"> </span><span style="color: #FF0000;">=</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-weight: bold;">Get-VM</span><span style="color: #000000;"> </span><span style="color: #800080;">$vm</span><span style="color: #000000;"> | </span><span style="color: #5F9EA0; font-weight: bold;">Get-View</span><span style="color: #000000;"></p>
<p></span><span style="color: #0000FF;">if</span><span style="color: #000000;">(</span><span style="color: #800080;">$vmView</span><span style="color: #000000;">.Config.Version </span><span style="color: #FF0000;">-eq</span><span style="color: #000000;"> </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">vmx-04</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;">)<br />
{<br />
    </span><span style="color: #5F9EA0; font-weight: bold;">Write-Host</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-ForegroundColor</span><span style="color: #000000;"> </span><span style="color: #800000;">Red</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-weight: bold;">`</span><span style="color: #000000;"><br />
    </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">The Virtual Hardware version of this VM does not support Change Block Tracking</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;"><br />
    </span><span style="color: #0000FF;">return</span><span style="color: #000000;"><br />
}</p>
<p></span><span style="color: #800080;">$vmConfigSpec</span><span style="color: #000000;"> </span><span style="color: #FF0000;">=</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-weight: bold;">New-Object</span><span style="color: #000000;"> </span><span style="color: #800000;">VMware.Vim.VirtualMachineConfigSpec</span><span style="color: #000000;"><br />
</span><span style="color: #800080;">$vmConfigSpec</span><span style="color: #000000;">.changeTrackingEnabled </span><span style="color: #FF0000;">=</span><span style="color: #000000;"> </span><span style="color: #800080;">$true</span><span style="color: #000000;"><br />
</span><span style="color: #800080;">$vmView</span><span style="color: #000000;">.ReconfigVM(</span><span style="color: #800080;">$vmConfigSpec</span><span style="color: #000000;">)</p>
<p></span><span style="color: #5F9EA0; font-weight: bold;">sleep</span><span style="color: #000000;"> </span><span style="color: #000000;">3</span><span style="color: #000000;"></p>
<p></span><span style="color: #5F9EA0; font-weight: bold;">Get-VM</span><span style="color: #000000;"> </span><span style="color: #800080;">$vm</span><span style="color: #000000;"> | </span><span style="color: #5F9EA0; font-weight: bold;">New-Snapshot</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-Name</span><span style="color: #000000;"> </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">Temp</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;"> </p>
<p></span><span style="color: #5F9EA0; font-weight: bold;">sleep</span><span style="color: #000000;"> </span><span style="color: #000000;">5</span><span style="color: #000000;"></p>
<p></span><span style="color: #5F9EA0; font-weight: bold;">Get-VM</span><span style="color: #000000;"> </span><span style="color: #800080;">$vm</span><span style="color: #000000;"> | </span><span style="color: #5F9EA0; font-weight: bold;">Get-Snapshot</span><span style="color: #000000;"> | </span><span style="color: #5F9EA0; font-weight: bold;">Where</span><span style="color: #000000;"> {</span><span style="color: #800080;">$_</span><span style="color: #000000;">.Name </span><span style="color: #FF0000;">-eq</span><span style="color: #000000;"> </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">Temp</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;">} | </span><span style="color: #5F9EA0; font-weight: bold;">Remove-Snapshot</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-Confirm</span><span style="color: #000000;">:</span><span style="color: #800080;">$false</span><span style="color: #000000;"></p>
<p>}</p>
<p></span><span style="color: #0000FF;">foreach</span><span style="color: #000000;"> (</span><span style="color: #800080;">$vmcomputer</span><span style="color: #000000;"> </span><span style="color: #0000FF;">in</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-weight: bold;">Get-VM</span><span style="color: #000000;">)<br />
{<br />
    </span><span style="color: #5F9EA0;">EnableChangeBlockTracking</span><span style="color: #000000;"> </span><span style="color: #800080;">$vmcomputer</span><span style="color: #000000;">.Name<br />
}</span>
</div>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=274" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=274</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Script: Change All LUNs not RoundRobin to RoundRobin</title>
		<link>http://www.robertwmartin.com/?p=213</link>
		<comments>http://www.robertwmartin.com/?p=213#comments</comments>
		<pubDate>Fri, 18 Mar 2011 23:05:55 +0000</pubDate>
		<dc:creator>Robert</dc:creator>
				<category><![CDATA[PowerCLI]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[VMware]]></category>
		<category><![CDATA[Multipath]]></category>
		<category><![CDATA[RoundRobin]]></category>

		<guid isPermaLink="false">http://www.robertwmartin.com/?p=213</guid>
		<description><![CDATA[If you are in need of changing the Multipath Policy on many Hosts at once you can run this script and it will fix them all. Connect-VIServer VC01 Get-ScsiLun -VmHost (Get-VMHost &#124; Where { $_.Name -like &#8220;VM*&#8220;} ) -LunType disk &#124; Where { $_.MultipathPolicy -notlike &#8220;roundrobin&#8220;} &#124; Set-ScsiLun -MultipathPolicy &#8220;roundrobin&#8220;]]></description>
			<content:encoded><![CDATA[<p>If you are in need of changing the Multipath Policy on many Hosts at once you can run this script and it will fix them all.</p>
<div class="boxed" style="border: 1px solid black; width: 565px; background-color:white; padding:10px">
<span style="color: #000000;">Connect-VIServer VC01<br />
</span><span style="color: #5F9EA0; font-weight: bold;">Get-ScsiLun</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-VmHost</span><span style="color: #000000;"> (</span><span style="color: #5F9EA0; font-weight: bold;">Get-VMHost</span><span style="color: #000000;"> |  </span><span style="color: #5F9EA0; font-weight: bold;">Where</span><span style="color: #000000;"> { </span><span style="color: #800080;">$_</span><span style="color: #000000;">.Name </span><span style="color: #FF0000;">-like</span><span style="color: #000000;"> </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">VM*</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;">} ) </span><span style="color: #5F9EA0; font-style: italic;">-LunType</span><span style="color: #000000;"> </span><span style="color: #800000;">disk</span><span style="color: #000000;"> | </span><span style="color: #5F9EA0; font-weight: bold;">Where</span><span style="color: #000000;"> { </span><span style="color: #800080;">$_</span><span style="color: #000000;">.MultipathPolicy </span><span style="color: #FF0000;">-notlike</span><span style="color: #000000;"> </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">roundrobin</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;">} |  </span><span style="color: #5F9EA0; font-weight: bold;">Set-ScsiLun</span><span style="color: #000000;"> </span><span style="color: #5F9EA0; font-style: italic;">-MultipathPolicy</span><span style="color: #000000;"> </span><span style="color: #800000;">&#8220;</span><span style="color: #800000;">roundrobin</span><span style="color: #800000;">&#8220;</span><span style="color: #000000;"><br />
</span></div>
 <img src="http://www.robertwmartin.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=213" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.robertwmartin.com/?feed=rss2&#038;p=213</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

