Author Posts

February 5, 2018 at 1:20 pm

I get tickets daily for drive errors on a remote PC's. 100% of the time it is when someone unplugs their phone from the PC. But I am required to check the PC for any real errors. If I run get-disk on my PC, I have a "healthStatus" heading. It will say healthy/unhealthy. Get-Disk doesn't have a -computername variable associated with it. Nor does Get-PhysicalDisk.
I have played around with Get-WMIObject also, but cant figure out how to get the "HealthStatus" of a remote PC.
I am using computer management to check the drives, but I would like to automate it to the point where I can just enter a PC name and check the drive. Maybe it isn't possible?
Thanks for any input.

February 5, 2018 at 1:30 pm

Assuming you have remoting turned on use invoke-command

If your command is short, I like just using the scriptblock, if it's more advanced I think it's easier to save everything to a ps1 file and run it that way

i.e

Invoke-Command -ComputerName server01 -ScriptBlock {Get-Culture}

or

Invoke-Command -FilePath c:\scripts\test.ps1 -ComputerName Server01

February 5, 2018 at 2:06 pm

OK, I don't have it turned on. Explains why I am not getting this info. It's odd that I cant retrieve a lot on info from remote PC's, but not the drive health. Thank you for your response.

failed with the following error message : The client cannot connect to the destination
specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for
the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following
command on the destination to analyze and configure the WinRM service: "winrm quickconfig". For more information, see the
about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (willows-52:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken

February 5, 2018 at 4:52 pm

So I piped get-member to get-disk and see that it gets its information from

TypeName: Microsoft.Management.Infrastructure.CimInstance#ROOT/Microsoft/Windows/Storage/MSFT_Disk

So if you can get WMI from the remote pc's you can get the same information by doing this:

Get-WmiObject -Namespace "root/microsoft/windows/storage" -Class "msft_disk" | select healthstatus

February 5, 2018 at 5:21 pm

Thank you. That gives me more data than I originally was able to obtain. I receive the following:
healthstatus
————
0

I will need to figure out what "0" means (probably healthy) and figure out what unhealthy would be. 1 maybe.

Thanks again.

February 5, 2018 at 5:33 pm

Thank you very much. You have been extremely helpful!

February 5, 2018 at 5:38 pm

Happy to help! Plus I learned some things in the process.