Showing stopped service of windows

Hi Team,
I am trying to fetch the status of windows update service on multiple remote server but I am getting always stopped but when I login on server and checked service is running. And then I run the script again then it showing running

First time script showing stopped service but when I take a rdp of server and then I run script then output is correct.

Please help the reason on this

Please post the command or script you’re using to check the service on the remote server.

Not sure if I am missing anything but it looks like in your script you are not using Get-service command properly.

get-service -ComputerName "xyz.domain" -Name wuauserv

Also if you need any help I have done similar scripts which might help you out. Check it out in the below link.
https://powershellguru.com/powershell-script-repository