Thanks for the reply, I have tried both ways but it always seems to come back with the same error!
It looks like the array is empty but when I look at $sesions it has entries!
Sorry if I am missing something this is all very new to me
#Commands I run
$HVserver=Connect-HVServer -Server........(Server Connection Details)
$hvservices=$HVServer.ExtensionData
$sessions=get-HVlocalsession
$hvservices.session.Session_SendMessages($sessions.id,"Info","PLEASE NOTE")
#Error it produces
You cannot call a method on a null-valued expression.
At line:2 char:1
+ $hvservices.session.Session_SendMessages($sessions.id,"Info","PLEASE ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
#Confirming the array is populated
PS C:\Windows\system32> $sessions
Id NamesData ReferenceData SessionData
-- --------- ------------- -----------
VMware.Hv.SessionId VMware.Hv.SessionNamesData VMware.Hv.SessionLocalReferenceData VMware.Hv.SessionData
VMware.Hv.SessionId VMware.Hv.SessionNamesData VMware.Hv.SessionLocalReferenceData VMware.Hv.SessionData