VMware Cloud Community
StefanSchnell
Enthusiast
Enthusiast

Tip: Find out information about the PowerCLI infrastructure

When an action (script) is created in VMware Aria Automation 8, it is possible to select different execution environments. Each of these execution environments runs in a container. One these execution environments is PowerCLI 12 (PowerShell 7.0). VMware PowerCLI is a set of PowerShell cmdlets to manage and automate the VMware infrastructure. This approach also offers the possibility to use the dotNET, which is underlying of PowerShell. To know which dotNET version comes to use, I tried a few approaches.

 

# Begin-----------------------------------------------------------------

Write-Host "`n>>>Get-Host<<<";
$getHost = Get-Host;
Write-Host "Name: $($getHost.Name)";
Write-Host "PSVersion: $($getHost.Version)";
Write-Host "CurrentCulture: $($getHost.CurrentCulture)";
Write-Host "CurrentUICulture: $($getHost.CurrentUICulture)";

Write-Host "`n>>>PSVersionTable<<<";
foreach ($PSInformation in $PSVersionTable.GetEnumerator()) {
  Write-Host "$($PSInformation.Name) : $($PSInformation.Value)";
}

Write-Host "`n>>>System.Environment.Version<<<";
$version = [System.Environment]::Version;
Write-Host "Common Language Runtime Version: $($version)";

Write-Host "`n>>>OS Release<<<";
$processInfo = New-Object System.Diagnostics.ProcessStartInfo;
$processInfo.FileName = "cat";
$processInfo.RedirectStandardError = $true;
$processInfo.RedirectStandardOutput = $true;
$processInfo.UseShellExecute = $false;
$processInfo.Arguments = "/etc/os-release";
$process = New-Object System.Diagnostics.Process;
$process.StartInfo = $processInfo;
$process.Start() | Out-Null;
$process.WaitForExit();
$stdout = $process.StandardOutput.ReadToEnd();
Write-Host $stdout;

# End-------------------------------------------------------------------

 

  • Get-Host
    The Get-Host cmdlet represents the hosting PowerShell program. In this case it does not provide any interesting information, except perhaps that there is no setting for the culture in the default, which has an effect on the date format, for example.
    StefanSchnell_0-1670139102940.png
  • PSVersionTable
    The automatic variable $PSVersionTable delivers also not any interesting information, except that we see here that we are working with a Photon operating system.
    StefanSchnell_2-1670139194018.png
  • System.Environment.Version
    The System.Environment.Version property of the dotNET delivers information about the using common language runtime (CLR). From this interesting further information can already be derived.
    StefanSchnell_4-1670139312119.png
    Now we know it uses the dotNET Runtime 3.1.3 with C# 8.0 language support.
  • OS Release
    This file contain operating system identification data.

If you plan to add a dotNET type, in the context of PowerCLI, it is very important to know which environment is used. The CLR and language support define our capabilities, so knowing that is very important.

Hope this little look into the dotNET substructure of the PowerCLI was interesting.

Addendum (Last Update 30.01.2024)

With the release 8.12 of Aria Automation offers the Orchestrator new runtime environments. One of these are PowerShell, without PowerCLI.

Aria Automation ReleasePowerShell ReleasePS VersionCLR Version
8.5.1.18666PowerCLI 12 (PowerShell 7.0)7.0.03.1.3
8.9.0.24128PowerCLI 12 (PowerShell 7.1)7.1.55.0.11
8.10.2.27406PowerCLI 12 (PowerShell 7.1)7.1.55.0.11
8.11.0.27829PowerCLI 12 (PowerShell 7.1)7.1.75.0.16
8.12.0.30728PowerCLI 12 (PowerShell 7.1)7.1.75.0.16
8.12.0.30728PowerShell 7.37.3.37.0.3
8.13.1.32340PowerCLI 12 (PowerShell 7.2)7.2.126.0.19
8.13.1.32340PowerShell 7.37.3.67.0.9
8.14.0.33079PowerCLI 12 (PowerShell 7.2)7.2.126.0.19
8.14.0.33079PowerShell 7.37.3.67.0.9
8.14.1.33478PowerCLI 12 (PowerShell 7.2)7.2.166.0.24
8.14.1.33478PowerShell 7.37.3.97.0.13

 


More interesting information at blog.stschnell.de

0 Replies