Juil 162014
 

La m?thode longue consiste ? se connecter sur chaque VM, et a executer ce qui suit :

First thing is to log onto the virtual machine and open up msinfo32 via the run prompt (start > run > msinfo32).
Expand ?Software Environment? and then ?System Drivers?
Within this list you?re looking for vsepflt as shown below:

La m?thode automatis?e :
Pensez ? d?sactiver votre proxy de Internet Explorer (oui, je sais, c’est ?trange, et je n’ai ni le temps, ni l’envie de rentrer dans les d?tails)

$credentials=Get-Credential
$VMStatus=Get-VM | Where-Object { $_.PowerState -eq "PoweredOn" -and $_.Guest.OSFullName -match "WinDows" } | ForEach-Object {
$obj=New-Object PSObject
$obj | add-Member Noteproperty -name Name -value $_.name
#? $obj | add-Member Noteproperty -name vShield -value? (Invoke-VMScript -VM $_.name -ScriptType Bat -ScriptText 'driverquery | find /i "vsepflt"' -GuestCredential $credentials -ErrorAction Continue | Select-Object -ExpandProperty ScriptOutput)
$obj | add-Member Noteproperty -name ToolsVersion -value $_.ToolsVersion
$obj | add-Member Noteproperty -name ToolsVersionStatus -value $_.ToolsVersionStatus
$obj | add-Member Noteproperty -name SnapShotCount -value ($_ | Get-Snapshot | Measure-Object | select -ExpandProperty Count )
$obj | add-Member Noteproperty -name SnapShotInfo -value ($_ | Get-Snapshot | select VM,Created, SizeGB, IsCurrent, Name |Out-String )
$obj
}
$VMStatus | out-gridview

Si vous avez le m?me bug que moi, cad, que le re-enregistrement des adresses IP dans le DNS echoue et que le DNS se retrouve vide : http://support.microsoft.com/default.aspx?scid=kb;EN-US;2520155
Pour mettre a jour de maniere pseudo-automatis?e le parc

$credentials=Get-Credential

Get-VM | Where-Object { $_.PowerState -eq « PoweredOn » -and $_.Guest.OSFullName -match « WinDows » -and ($_ | get-snapshot | Measure-Object | select -ExpandProperty Count ) -eq 0 } | foreach {
Get-VM -name svMGTTST01 | foreach {
# ping to check if VM is pinguable
if (Test-Connection $_.name -ErrorAction SilentlyContinue ) { write-host « Ping to $_ : OK » -foregroundcolor green } else { write-host « Ping to $_ : Failed » -foregroundcolor red }
# Take snapshot
New-Snapshot -vm $_.name -Name « Avant VMWare Tools et vShield » -Description « VM avant execution du script automatique » -Memory:$true -Quiesce:$true -Confirm:$false
# Update tools
$_ | Get-View | foreach { $_.Guest.ToolsVersion }
$_ | Mount-Tools
# Copy BAT file
$DestinationFIle= »\\ »+(($_|get-view).Guest.HostName)+ »\c$\UpdateVMwareToolsManually.cmd »
Copy-Item -Path ‘C:\Users\Moi\Desktop\Scripts\VMwareTOols\UpdateVMwareToolsManually.cmd’ -Destination $DestinationFile
Invoke-VMScript -VM $_.name -ScriptType Bat -ScriptText ‘C:\UpdateVMwareToolsManually.cmd’ -GuestCredential $credentials | Select-Object ScriptOutput
Remove-Item $DestinationFile

# unmount
$_ | Wait-Tools

if ( (get-vm svMGTTST01 | Get-CDDrive ).isoPath.Equals(« [] /usr/lib/vmware/isoimages/windows.iso ») -eq $true ) { write-host « CD still mounted. Problem detected » -foregroundcolor red }

# Not necessary. Correct update unmount CDROM.
# $_ | Dismount-Tools

$_ | Get-View | foreach { $_.Guest.ToolsVersion }

# ping to check if VM is still pinguable
if (Test-Connection $_.name -ErrorAction SilentlyContinue ) { write-host « Ping to $_ : OK » -foregroundcolor green } else { write-host « Ping to $_ : Failed » -foregroundcolor red }

# delete snapshot
$_ | Get-Snapshot -Name « Avant VMWare Tools et vShield » | Remove-Snapshot -Confirm:$true
}

Et le script ? envoyer sur chaque VM:

SETLOCAL ENABLEDELAYEDEXPANSION

REM Usage : perform VMWareTools Assisted update and DNS registration
REM http://support.microsoft.com/default.aspx?scid=kb;EN-US;2520155
(
date /t
time /t

set DriveLetter=unknown
for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do? ( if exist %%a:\VMwareToolsUpgrader.exe if exist %%a:\certified.txt set DriveLetter=%%a)
echo DriveLetter : !DriveLetter!

REM check current version of vShield
driverquery | find /i « vsepflt »

!DriveLetter!:\Setup.exe /S /v « /qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs »
ipconfig /registerdns

REM check new version of vShield
driverquery | find /i « vsepflt »

date /t
time /t
) >> C:\UpdateVMwareToolsManually.log 2>&1

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)