Is there a way to find out the uptime for the Linux based Vms through powershell script. I am able to find the uptime for windows based VMs but I am unable to find uptime for the Linux based VMs.
Your best bet would probably be to run the uptime command remotely via SSH. If you don't have a powershell ssh client, you can install Posh SSH pretty easily.
With Posh SSH you can accomplish your objective by runnning:
New-SSHSession -ComputerName "example.com" -Credential (Get-Credential) Invoke-SSHCommand -Index 0 -Command "uptime"
You can add '-KeyFile' on the New-SSHSession command if you want to use an RSA key.
The Get-SSHSession command will give you the index number above, but if you only have one connection open it should always be 0.