Check drive HealthStatus on a remote PC

This topic contains 8 replies, has 3 voices, and was last updated by  tmack8080 3 months, 2 weeks ago.

  • Author
    Posts
  • #92967

    Bret
    Participant

    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.

  • #92970

    Jon
    Participant

    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
  • #92973

    Bret
    Participant

    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

  • #92980

    Jon
    Participant

    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
  • #92986

    Bret
    Participant

    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.

  • #92989

    Jon
    Participant
  • #93000

    Bret
    Participant

    Thank you very much. You have been extremely helpful!

  • #93003

    Jon
    Participant

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

  • #93123

    tmack8080
    Participant

You must be logged in to reply to this topic.