Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 233224

Re: How to prompt for vmhost name?

$
0
0

Add Powershell parameters in the function like this:

Function Get-InstallDate {  Param(    [string][parameter(Mandatory=$true)] $VMHost  )  $thisUUID = (Get-VMHost $VMHost | Get-EsxCli).system.uuid.get()  $decDate = [Convert]::ToInt32($thisUUID.Split("-")[0], 16)  $installDate = [timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($decDate))  [pscustomobject][ordered]@{    Name="$((Get-VMHost $VMHost).Name)"    InstallDate=$installDate  }
}

 

Just running Get-InstallDate will prompt you for the hostname, or you can supply the parameter directly in the command with Get-InstallDate -VMHost myesxi.local.

 


Viewing all articles
Browse latest Browse all 233224

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>