PowerCLI

 View Only
  • 1.  Custom Vmware tools Install through Power CLI using switches

    Posted Jan 15, 2014 06:39 PM

    Hi,

    I want to install Vmware Tools on multiple servers where I want to do custom install and remove the VMnext and vmnetx3 driver

    msiexec /i "VMware Tools.msi" ADDLOCAL=ALL

    REMOVE="Hgfs,WYSE,GuestSDK,vmdesched"

    normally we use...Update-Tools –NoReboot which adds some slient switches

    in the same can we add the switch to remove HGFS, or other component of Vmware tools pkg.



  • 2.  RE: Custom Vmware tools Install through Power CLI using switches

    Posted Jan 15, 2014 07:19 PM

    Afaik, you can not.



  • 3.  RE: Custom Vmware tools Install through Power CLI using switches

    Posted Jan 21, 2014 07:38 PM

    You can automate this with the help of SCCM and VBscript, but as LucD said, you can't in PowerCLI :smileysad:

    Copy "windows.iso" image from your ESXi host (in 5.0.0 its "/vmimages/tools-isoimages") to local directory, and extract its contents to "VMware Tools" directory.

    Name following script as "InstallVMwareTools.vbs" -

    ' VMware Tools installation script.

    ' Reference for Unattended Installation of VMware Tools in Windows:

    ' http://communities.vmware.com/servlet/JiveServlet/downloadBody/12413-102-4-13370/VMware%20Tools%20-%20Unattended_Install.pdf

    Option Explicit

    Dim objFSO, objFolder, wshShell, oShellLink, strScriptPath, strLogLocation, strLogFile

    Dim strOptions, strCommandLine, strEXE, strRegKey, blnRemoveThinPrintDriver, strvalue

    Dim strProcessorArchitecture, blnNewInstall, strAllUsersProfile, timevalue

    '********** These are the script variables that can be changed **********

    ' Setting this to false will not remove the Thin Print driver.

    blnRemoveThinPrintDriver = WScript.Arguments.Item(0)

    ' Set the log file location

    strLogLocation = "%SystemDrive%\logs"

    strScriptPath = Left(Wscript.ScriptFullName, (InstrRev(Wscript.ScriptFullName, "\")))

    timevalue = Now

    ' Set the log file name

    strLogFile = "VMwareTools" & "-" & Year(timevalue) & "-" & Month(timevalue) & "-" & Day(timevalue) & "-" & Hour(timevalue) & "-" & Minute(timevalue) & "-" & Second(timevalue) & ".log"

    '************************************************************************

    set WshShell = WScript.CreateObject("WScript.Shell")

    set objFSO = CreateObject("Scripting.FileSystemObject")

    strLogLocation = WshShell.ExpandEnvironmentStrings(strLogLocation)

    ' Create the log file folder

    If NOT objFSO.FolderExists(strLogLocation) Then

      objFSO.CreateFolder(strLogLocation)

    End If

    strProcessorArchitecture = WshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")

    strAllUsersProfile = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")

    ' Building the MSIEXEC command line options

      strOptions = " /S /v " & chr(34) & "ALLUSERS=TRUE ADDLOCAL=Audio,BootCamp,PVSCSI,Sync,VShield,VMXNet,VMXNet3,VSS,MemCtl,Mouse,MouseUsb,Perfmon,SVGA,TrayIcon,VMCI /qn REBOOT=R /L " & chr(34) & strLogLocation & "\" & strLogFile & chr(34)

                                           

    ' Check if ThinPrint should be installed or not

    If blnRemoveThinPrintDriver Then

      strOptions = strOptions & " REMOVE=" & chr(34) & "Hgfs,WYSE,GuestSDK,vmdesched,ThinPrint" & chr(34)

    Else

      strOptions = strOptions & " REMOVE=" & chr(34) & "Hgfs,WYSE,GuestSDK,vmdesched," & chr(34)

    End If

    If strProcessorArchitecture = "x86" Then

      strEXE = "Setup.exe"

    Else

      strEXE = "Setup64.exe"

    End If

    ' Installing VMware Tools with the relevant command line options

    strCommandLine = chr(34) & strScriptPath & "VMware Tools\" & strEXE & chr(34) & strOptions & chr(34)

    ' wscript.echo strCommandLine

    WshShell.Run strCommandLine,1,True

    Set WshShell = Nothing

    set objFSO = Nothing

    WScript.Quit(0)

    Name following command as "InstallVMwareTools.bat"

    @echo off

    REM  "Argument1 = ThinPrint - Exclude/Include::True/False"

    %SystemRoot%\system32\wscript InstallVMwareTools.vbs "False"

    So your Folder Structure should now look like this -

    > VMware Tools

    > InstallVMwareTools.vbs

    > InstallVMwareTools.bat

    Create a list of VMs in a txt file and in SCCM you can create your own package and make them run against the server list.

    This script does both install and update, where required.



  • 4.  RE: Custom Vmware tools Install through Power CLI using switches

    Posted Jan 21, 2014 08:12 PM

    OMG, a VBS script in the PowerCLI community :smileyshocked:



  • 5.  RE: Custom Vmware tools Install through Power CLI using switches

    Posted Jan 22, 2014 04:43 PM

    I prefer VBS over Powershell only when it comes to pre Win2008 servers.

    Otherwise I am a big PowerCLI fan! :smileyblush: