prasanna22kumar
Contributor
Contributor

required powercli script for Mass update of VMtools manually

Hi Lucd ,

Kindly help me out with powercli script for Mass update of VMtools manually from Shared folder.

Scenario:- Store the VMtools.exe (VMware-tools-11.2.6-17901274-x86_64.exe) from shared folder and Update the same via script in multiple VM's.

Below is the script I'm trying..no go with it.

#Variables
$computername = Get-Content c:\temp\servers.txt
$sourcefile = "c:\temp\VMware-tools-11.2.6-17901274-x86_64.exe"
#This section will install the software
foreach ($computer in $computername)
{
$destinationFolder = "\\$computer\C$\Temp"
#It will copy $sourcefile to the $destinationfolder. If the Folder does not exist it will create it.

if (!(Test-Path -path $destinationFolder))
{
New-Item $destinationFolder -Type Directory
}
Copy-Item -Path $sourcefile -Destination $destinationFolder
Invoke-Command -ComputerName $computer -ScriptBlock {Start-Process 'c:\temp\VMware-tools-11.2.6-17901274-x86_64.exe'}
}

Kindly assist me ...Thanks in advance.

Regards,
Kumar

Reply
0 Kudos