I don't think you are experiencing a similar problem.
Your code inside the Guest OS is working, it seems to be the transfer back from the result of the run to the calling station that seems to be experiencing an issue.
This might be a certificate issue on the ESXi node where the VM is running (missing SAN = Subject Alternative Name, more specifically the IP address).
I would suggest opening a new thread.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference