VMware Cloud Community
airinaga
Contributor
Contributor

Adding vShield driver to VM's

Hey everyone,

I found this script: Add Vmtools vShield Drivers for Endpoint Protection on ESX VM - Bonus Bits Wiki

  1. $ComputerName = <vm-name>
    $vCenter = <vcenter-hostname>
    Connect-ViServer $vCenter
    Mount-Tools -VM $ComputerName
    $DriveLetter = Get-WmiObject Win32_CDROMDrive -ComputerName $ComputerName | Where-Object {$_.VolumeName -match "VMware Tools"} | Select-Object -ExpandProperty Drive
    $ScriptText = "$DriveLetter\setup64.exe /S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`""
    Invoke-VMScript -VM $ComputerName -ScriptText $ScriptText -ScriptType bat

    When I execute the script, the autoplay box comes up on my VM but the powerCLI script fails. With an error of:

    "Get-WmiObject : The RPC server is unavailable. 0x800706BA"

    Any help is much appreciated.

0 Kudos
12 Replies
airinaga
Contributor
Contributor

$ComputerName = <vm-name>
$vCenter = <vcenter-hostname>
Connect-ViServer $vCenter
Mount-Tools -VM $ComputerName
$ScriptText = "D:\setup64.exe /S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`""
Invoke-VMScript -VM $ComputerName -ScriptText $ScriptText -ScriptType bat

Running this script, there are no errors but the autoplay box just hangs and nothing happens.

0 Kudos
LucD
Leadership
Leadership

Did you already try turning autoplay off before mounting the ISO image ?

You can use an Invoke-VMScript to run this inside the guest.

$path ='HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer'

Set-ItemProperty $path -Name NoDriveTypeAutorun -Type DWord -Value 0xFF


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
airinaga
Contributor
Contributor

It throws a "Requested registry access is not allowed"

Would that be the easiest workaround? I would like to not mess with the registry.

Could you not pass the "/S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`"" parameter with the Update-tools cmdlet?

0 Kudos
LucD
Leadership
Leadership

Just a thought, but if you want to avoid the autoplay (and messing with the registry), why not store the content of the ISO file to a network share.

And then invoke the install from that network share.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
airinaga
Contributor
Contributor

Tried it with the same result..

It is able to execute this script locally and work just fine : "D:\setup64.exe /S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`""

But when run through powerCLI it executes everything just fine but no results.

Is there a reason why this script won't execute properly?

$ComputerName = "VM"

Mount-Tools -VM $ComputerName

$ScriptText = "D:\setup64.exe /S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`""

Invoke-VMScript -VM $ComputerName -ScriptText $ScriptText -ScriptType bat

0 Kudos
LucD
Leadership
Leadership

Does the account you run the script with, have sufficient permissions in the guest OS ?

You can try passing an explicit account on the Invoke-VMScript with the GuestUser/GuestPassword parameters.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
airinaga
Contributor
Contributor

I was able to get the script to work for setup64.exe on my 2008 servers but now when I try to do the same with my 32bit 2003 servers it won't accept "D:\setup32.exe"

Is there a 32bit vmTools mount?

Any ideas how to workaround this?

0 Kudos
airinaga
Contributor
Contributor

I tried to run the script locally:        D:\setup32.exe /S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`""

and it returned "The device is not ready" Windows - No Disk

But, both the 32 and 64 bit ISO is in the same file

0 Kudos
airinaga
Contributor
Contributor

Hey Luc,

Just read your post about 'Will invoke-vmscript work?'

I saw that some people got their 2003 sp2 servers to work... So i'm guessing that if it is a regular 32bit Windows 2003 server (not SP2) will invoke-vmscript not work?

Thanks for all the help so far.

0 Kudos
LucD
Leadership
Leadership

That could be the reason it fails.

Can't you try on another OS, just to make sure the logic works ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
kunaludapi
Expert
Expert

You can use PsExec tool to install drivers remotely on windows servers.

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
0 Kudos
airinaga
Contributor
Contributor

I've tried using PsExec with the following script but still no luck..

$ComputerName = "VM"

Mount-Tools -VM $ComputerName

C:\PSTools\psexec.exe \\VM "D:\setup.exe /S /v `"/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs,WYSE`""

I found out that it was a 2003 SP2 server so Invoke-VMscript should have worked but the only way it works is by doing it manually.

0 Kudos