Hello,
-
Assuming that you want the name of the last vCenter to which you connected, you can use the automatic global variable "DefaultVIServer" to get the name of the vCenter to which you are connected. Access the "Name" property of this object, like:
$global:DefaultVIServer.Name
That do it?