Difference between revisions of "Silent Install View Agent"

From Michael's Information Zone
Jump to navigation Jump to search
(Created page with "<ref>https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1019862</ref> <ref>https://pubs.vmware.com/view-50/index.jsp?topic=%2Fcom.v...")
 
 
(12 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
<ref>https://pubs.vmware.com/horizon-7-view/index.jsp?topic=%2Fcom.vmware.horizon-view.desktops.doc%2FGUID-3096DA8B-034B-435B-877E-5D2B18672A95.html</ref>
 
<ref>https://pubs.vmware.com/horizon-7-view/index.jsp?topic=%2Fcom.vmware.horizon-view.desktops.doc%2FGUID-3096DA8B-034B-435B-877E-5D2B18672A95.html</ref>
 
<ref>https://pubs.vmware.com/horizon-7-view/index.jsp?topic=%2Fcom.vmware.horizon-view.desktops.doc%2FGUID-1FD90D4D-0C7C-4E9E-B12D-974ABF15E398.html</ref>
 
<ref>https://pubs.vmware.com/horizon-7-view/index.jsp?topic=%2Fcom.vmware.horizon-view.desktops.doc%2FGUID-1FD90D4D-0C7C-4E9E-B12D-974ABF15E398.html</ref>
 +
==Upgrade Horizon Agent==
 +
No easy way to do this. Consultants and the internet state you need to
 +
#Uninstall Agent
 +
#Reboot
 +
#Uninstall VMTools
 +
#Reboot
 +
#Install VMTools
 +
#Reboot
 +
#Install Agent
 +
<br>
 +
<br>
 +
There was one desktop that I was unable to gain access, which made it difficult to remove the software. Found an article <ref>https://community.spiceworks.com/how_to/179-using-a-command-line-to-uninstall-software-on-remote-pcs</ref> that explained how to use wmic to remotely remove software. This is the process I am working on to automate some of this process when using full clones instead of linked clones.
 +
 +
<ref>https://community.spiceworks.com/topic/1077878-powershell-script-to-uninstall-applications-remotely</ref>
 +
 +
===Remove Horizon Agent===
 +
<pre>Invoke-Command -ComputerName testcomputer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Horizon Agent'" | Invoke-Cimmethod -methodname uninstall}</pre>
 +
 +
===Remove VMTools===
 +
*Using CIM instead of WMI
 +
<ref>https://social.technet.microsoft.com/Forums/en-US/8ab6ee89-8ec3-47ea-9307-a504b22ad23f/uninstall-software-remotely-with-powershell?forum=ITCG</ref>
 +
<ref>https://docs.microsoft.com/en-us/windows/desktop/wmisdk/wql-sql-for-wmi</ref>
 +
<pre>Invoke-Command -ComputerName testcomputer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Tools'" | Invoke-Cimmethod -methodname uninstall}</pre>
 +
 +
 +
===VMTools Install Options===
 +
<ref>https://pubs.vmware.com/vsphere-50/index.jsp?topic=%2Fcom.vmware.vmtools.install.doc%2FGUID-CD6ED7DD-E2E2-48BC-A6B0-E0BB81E05FA3.html</ref><ref>https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.vm_admin.doc/GUID-E45C572D-6448-410F-BFA2-F729F2CDA8AC.html#GUID-E45C572D-6448-410F-BFA2-F729F2CDA8AC</ref>
 +
<pre>setup64.exe /s /v"/qn /l*v c:\vtools.log ADDLOCAL=ALL"</pre>
 +
 +
===Agent Install Options===
 +
<ref>https://docs.vmware.com/en/VMware-Horizon-7/7.7/horizon-virtual-desktops/GUID-3096DA8B-034B-435B-877E-5D2B18672A95.html?hWord=N4IghgNiBcIM4EsIFMB2AXABA1d2QkwAsB7AJwQC8TVMwBzNdEAXyA</ref>
 +
<pre>VMware-Horizon-Agent-x86_64-7.7.0-11054235.exe /v" /qn INSTALL_VDISPLAY_DRIVER=1 /l*v c:\H477.log ADDLOCAL=Core,USB,RTAV,ClientDriveRedirection,ScannerRedirection,GEOREDIR,ThinPrint,SmartCard,VmwVaudio,SdoSensor,PerfTracker"</pre>
 +
 +
===Full PS Script===
 +
WIP
 +
<br>
 +
This assumes there is a scheduled task that runs at boot. This task checks for the file "C:\tools_ran.txt", if it does not exist it will create it and install vmtools from a copy of the setup exe.
 +
<pre>
 +
$computers='testcomputer'
 +
$today=date -format yyyyMMdd
 +
 +
foreach ($computer in $computers) {
 +
    if (Invoke-Command -ComputerName $computer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Horizon Agent'"}) {
 +
        echo "Getting uptime for $computer"
 +
        $boottime1=(Get-WmiObject -ComputerName $computer win32_operatingsystem).lastbootuptime
 +
        $boottime2="$boottime1"
 +
        echo "Boot up time for $computer is $boottime1"
 +
        echo "Removing Horizon Agent from $computer"
 +
        Invoke-Command -ComputerName $computer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Horizon Agent'" -erroraction silentlycontinue | Invoke-Cimmethod -methodname uninstall}
 +
        $reboot="y"
 +
    }
 +
    if ("$reboot" -eq "y") {
 +
        while ("$boottime2" -eq "$boottime1") {$boottime2=(Get-WmiObject -ComputerName $computer win32_operatingsystem -erroraction silentlycontinue).lastbootuptime}
 +
        echo "Boot time for $computer is now $boottime2"
 +
    }
 +
   
 +
    echo "Removing VMware Tools from $computer"
 +
    Invoke-Command -ComputerName $computer -ScriptBlock {rm C:\tools_ran.txt; Get-Ciminstance -classname win32_product -filter "name like 'Vmware Tools'" -erroraction silentlycontinue | Invoke-Cimmethod -methodname uninstall -erroraction silentlycontinue} -asjob -erroraction silentlycontinue
 +
    echo "Sleeping for five minutes"
 +
    start-sleep -seconds 300
 +
    $installdate="0000"
 +
    echo "Verifying vmtools is installed"
 +
    while ("$installdate" -ne "$today") {$installdate=Invoke-Command -ComputerName $computer -ScriptBlock {(Get-Ciminstance -classname win32_product -filter "name like 'Vmware Tools'" -erroraction silentlycontinue).installdate} -erroraction silentlycontinue
 +
    }
 +
    echo "Installing Agent on $computer"
 +
    Invoke-Command -ComputerName $computer -ScriptBlock {C:\VMware-Horizon-Agent-x86_64-7.7.0-11054235.exe '/v" /qn INSTALL_VDISPLAY_DRIVER=1 /l*v C:\H477.log ADDLOCAL=Core,USB,RTAV,ClientDriveRedirection,ScannerRedirection,GEOREDIR,ThinPrint,SmartCard,VmwVaudio,SdoSensor,PerfTracker"'}
 +
}
 +
</pre>
 +
 +
<br>
 +
<br>
 +
<br>

Latest revision as of 15:40, 14 February 2019

[1] [2] [3] [4]

Upgrade Horizon Agent

No easy way to do this. Consultants and the internet state you need to

  1. Uninstall Agent
  2. Reboot
  3. Uninstall VMTools
  4. Reboot
  5. Install VMTools
  6. Reboot
  7. Install Agent



There was one desktop that I was unable to gain access, which made it difficult to remove the software. Found an article [5] that explained how to use wmic to remotely remove software. This is the process I am working on to automate some of this process when using full clones instead of linked clones.

[6]

Remove Horizon Agent

Invoke-Command -ComputerName testcomputer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Horizon Agent'" | Invoke-Cimmethod -methodname uninstall}

Remove VMTools

  • Using CIM instead of WMI

[7] [8]

Invoke-Command -ComputerName testcomputer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Tools'" | Invoke-Cimmethod -methodname uninstall}


VMTools Install Options

[9][10]

setup64.exe /s /v"/qn /l*v c:\vtools.log ADDLOCAL=ALL"

Agent Install Options

[11]

VMware-Horizon-Agent-x86_64-7.7.0-11054235.exe /v" /qn INSTALL_VDISPLAY_DRIVER=1 /l*v c:\H477.log ADDLOCAL=Core,USB,RTAV,ClientDriveRedirection,ScannerRedirection,GEOREDIR,ThinPrint,SmartCard,VmwVaudio,SdoSensor,PerfTracker"

Full PS Script

WIP
This assumes there is a scheduled task that runs at boot. This task checks for the file "C:\tools_ran.txt", if it does not exist it will create it and install vmtools from a copy of the setup exe.

$computers='testcomputer'
$today=date -format yyyyMMdd

foreach ($computer in $computers) {
    if (Invoke-Command -ComputerName $computer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Horizon Agent'"}) {
        echo "Getting uptime for $computer"
        $boottime1=(Get-WmiObject -ComputerName $computer win32_operatingsystem).lastbootuptime
        $boottime2="$boottime1"
        echo "Boot up time for $computer is $boottime1"
        echo "Removing Horizon Agent from $computer"
        Invoke-Command -ComputerName $computer -ScriptBlock {Get-Ciminstance -classname win32_product -filter "name like 'Vmware Horizon Agent'" -erroraction silentlycontinue | Invoke-Cimmethod -methodname uninstall}
        $reboot="y"
    }
    if ("$reboot" -eq "y") {
        while ("$boottime2" -eq "$boottime1") {$boottime2=(Get-WmiObject -ComputerName $computer win32_operatingsystem -erroraction silentlycontinue).lastbootuptime}
        echo "Boot time for $computer is now $boottime2"
    }
    
    echo "Removing VMware Tools from $computer"
    Invoke-Command -ComputerName $computer -ScriptBlock {rm C:\tools_ran.txt; Get-Ciminstance -classname win32_product -filter "name like 'Vmware Tools'" -erroraction silentlycontinue | Invoke-Cimmethod -methodname uninstall -erroraction silentlycontinue} -asjob -erroraction silentlycontinue
    echo "Sleeping for five minutes"
    start-sleep -seconds 300
    $installdate="0000"
    echo "Verifying vmtools is installed"
    while ("$installdate" -ne "$today") {$installdate=Invoke-Command -ComputerName $computer -ScriptBlock {(Get-Ciminstance -classname win32_product -filter "name like 'Vmware Tools'" -erroraction silentlycontinue).installdate} -erroraction silentlycontinue
    }
    echo "Installing Agent on $computer"
    Invoke-Command -ComputerName $computer -ScriptBlock {C:\VMware-Horizon-Agent-x86_64-7.7.0-11054235.exe '/v" /qn INSTALL_VDISPLAY_DRIVER=1 /l*v C:\H477.log ADDLOCAL=Core,USB,RTAV,ClientDriveRedirection,ScannerRedirection,GEOREDIR,ThinPrint,SmartCard,VmwVaudio,SdoSensor,PerfTracker"'}
}