Updated Script – Start-Recompose.ps1

I will be giving my first VMUG presentation on Thursday, September 26th  at the Wisconsin VMUG meeting in Appleton, WI.  The topic of my presentation will be three scripts that we use in our VMware View environment to automate routine and time consuming tasks.

One of the scripts that I will be including in my presentation is the Start-Recompose script that I posted a few weeks ago.  I’ve made some updates to this script to address a few things that I’ve always wanted to improve with this script.  I’ll be posting about the other two scripts this week.

These improvements are:

  • Getting pool information directly from the View LDAP datastore instead of using the Get-Pool cmdlet
  • Checking for space on the Replica volume before scheduling the Recompose operation
  • Adding email and event logging alerts
  • The ability to recompose just one pool if multiple pools share the same base image.

The updated script will still need to be run from the View Connection Server as it requires the View PowerCLI cmdlets.  The vSphere PowerCLI cmdlets and the Quest AD cmdlets will also need to be available.  A future update will probably remove the need for the Quest cmdlets, but I didn’t feel like reinventing the wheel at the time.

The script can be downloaded from github here.

6 thoughts on “Updated Script – Start-Recompose.ps1

  1. I have a couple errors in View 5.1.

    Get-QADObject : Cannot validate argument on parameter ‘Service’. The argument i
    s null or empty. Supply an argument that is not null or empty and then try the
    command again.
    At C:\Scripts\Start-Recompose.ps1:52 char:32
    + $pools = Get-QADObject -Service <<<< $ConnectionServer -DontUseDefaultInclud
    edProperties -IncludedProperties $arrIncludedProperties -LdapFilter "(&(objectC
    lass=pae-ServerPool)(pae-SVIVmParentVM=*$ParentVM))" | Sort-Object "pae-Display
    Name" | Select-Object Name, "pae-DisplayName", "pae-SVIVmParentVM" , "pae-SVIVm
    Snapshot", "pae-SVIVmSnapshotMOID", "pae-MemberDN", @{Name="pae-SVIVmDatastore"
    ;expression={$_."pae-SVIVmDatastore" -match "replica"}}
    + CategoryInfo : InvalidData: (:) [Get-QADObject], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Quest.ActiveRol
    es.ArsPowerShellSnapIn.Powershell.Cmdlets.GetGenericObjectCmdlet

    Get-Datastore : Cannot validate argument on parameter 'Name'. The argument is n
    ull or empty. Supply an argument that is not null or empty and then try the com
    mand again.
    At C:\Scripts\Start-Recompose.ps1:119 char:35
    + $freespace = (Get-Datastore -Name <<<< $ReplicaDatastore).FreeSpaceGB
    + CategoryInfo : InvalidData: (:) [Get-Datastore], ParameterBindi
    ngValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,VMware.VimAutom
    ation.ViCore.Cmdlets.Commands.GetDatastore

    Send-MailMessage : Cannot validate argument on parameter 'SmtpServer'. The argu
    ment is null or empty. Supply an argument that is not null or empty and then tr
    y the command again.
    At C:\Scripts\Start-Recompose.ps1:26 char:79
    + Send-MailMessage -To $SMTPTo -Body $SMTPBody -Subject $SMTPSubject -SmtpServe
    r <<<< $SMTPServer -From "Notifications_noreply@gbdioc.org" -BodyAsHtml -Prior
    ity High
    + CategoryInfo : InvalidData: (:) [Send-MailMessage], ParameterBi
    ndingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
    Shell.Commands.SendMailMessage

  2. It’s been a while since I’ve looked at the script.

    Do you have the Quest AD Tools installed?
    What was the command string you were using when running the script?

    • The Quest AD tools are from Dell Now. I will try a re-install.

      Command:
      .\Start-Recompose.ps1 -vCenter vcenter.domain.local -View vie
      w.domain.local -ParentVM TrainingVDI

  3. If you pop open the script in a text editor, look for the parameters line. I didn’t document all of the extra parameters when I first published this. I really need to go back and rewrite this.

  4. I got rid of the errors. If you do not mind I will make the changes to the comments (Add needed software) and the script as needws and send it back to you. Thanks,

Comments are closed.