Release date: January 3rd 2023
Welcome to my VMware Dynamic Environment Manager series. I recently experienced a complete hardware crash in my old lab, and had to do a complete rebuild. Although this was sad, it gave me the opportunity to do it by scripting this time. As part of the exercise, I wanted to do all the installation from the management server using PowerShell and PowerCLI. This involved recreating the servers and joining them to the domain. Once that was done, I could install the DEM Management Console silently using remote PowerShell, as shown below.
Prerequisites:
- PowerShell Administrative access to the DEM Management Server
First I created the credentials to be used in the script:
$credential = Get-Credential
$credential | Export-CliXml -Path '<path>\hz_admin.xml'
Now that I had the credentials created, I was good to go. (PS: I know I’m no programmer and a lot of this script have the potential for improvement, but, it gets the job done, and that’s good enough for me).
instDemConsole.ps1
# --- Configure PSSession ---
$credential = Import-CliXml -Path "C:\Scripts\Creds\hz_admin_${env:USERNAME}_${env:COMPUTERNAME}.xml"
$DEMSrv = "<fqdn DEM Mgmt Server>"
$session = New-PSSession -ComputerName $DEMSrv -Credential $credential -Authentication CredSSP
# --- Define, Copy, Run Installation and clean up ---
Invoke-Command -Session $session -ScriptBlock {
$installDir = "C:\Install\"
New-Item -Path $installDir -type directory -Force
$msiFile = "<network-path>\VMware Dynamic Environment Manager Enterprise 2209 10.7 x64.msi"
Copy-Item -Path $msiFile -Destination $installDir -Force
$Vendor = "VMware"
$Product = "VMware Dynamic Environment Manager Enterprise"
$Version = "10.7.0"
$PackageName = "VMware Dynamic Environment Manager Enterprise 2209 10.7 x64.msi"
$UnattendedArgs = ' /qn ADDLOCAL="FlexManagementConsole" /l* C:\Install\InstallDEM.log'
Write-Verbose "Starting Installation of $Vendor $Product $Version" -Verbose
(Start-Process $installDir\"$PackageName" -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode
Remove-Item –path $installDir –Recurse -Force
}
Remove-PSSession $session
Official VMware Documentation:
- Unattended Installation of VMware Dynamic Environment Manager
- Installation and Deployment Prerequisites
Disclaimer: Every tips/tricks/posting I have published here, is tried and tested in different it-solutions. It is not guaranteed to work everywhere, but is meant as a tip for other users out there. Remember, Google is your friend and don’t be afraid to steal with pride! Feel free to comment below as needed.