On the off chance someone does not have PowerCLI installed

Handle ToString() error when PCLI is not present

Signed-off-by: Luc Dekens <dekens.luc@gmail.com>
This commit is contained in:
LucD
2019-11-18 13:34:04 +01:00
parent dc74d06a9c
commit c1e181ea11

View File

@@ -89,7 +89,7 @@ function Set-Title
$pcliModule = Get-Module -Name VMware.PowerCLI -ListAvailable |
Sort-Object -Property Version -Descending |
Select-Object -First 1
$pcli = " - PCLI: $($pcliModule.Version.ToString())"
$pcli = " - PCLI: $(if($pcliModule){$pcliModule.Version.ToString()}else{'na'})"
# If git is present and if in a git controlled folder, display repositoryname/current_branch
$gitStr = ''