Link to home
Start Free TrialLog in
Avatar of Mukul Gautam
Mukul Gautam

asked on

How to check Hyper-v core server disk space without loggin into the server

Please share the process to check hyper-v disk space on core server without logged into the server, as one of our Hyper-v core server is connected via VMM but not able to take RDP.
Avatar of Tom Cieslik
Tom Cieslik
Flag of United States of America image

If your server is in same network you are and you're domain admin you can use DIR command for administrative share

in command prompt put:

dir \\servername\c$

or by IP

dir \\xxx.xxx.xxx.xxx\C$
You can use this Get-RemoteComputerDisk PowerShell function
<#
.Synopsis
   Gets Disk Space of the given remote computer name
.DESCRIPTION
   Get-RemoteComputerDisk cmdlet gets the used, free and total space with the drive name.
.EXAMPLE
   Get-RemoteComputerDisk -RemoteComputerName "abc.contoso.com"
   Drive    UsedSpace(in GB)    FreeSpace(in GB)    TotalSpace(in GB)
   C        75                  52                  127
   D        28                  372                 400

.INPUTS
   Inputs to this cmdlet (if any)
.OUTPUTS
   Output from this cmdlet (if any)
.NOTES
   General notes
.COMPONENT
   The component this cmdlet belongs to
.ROLE
   The role this cmdlet belongs to
.FUNCTIONALITY
   The functionality that best describes this cmdlet
#>
function Get-RemoteComputerDisk
{
    
    Param
    (
        $RemoteComputerName
    )

    Begin
    {
        $output="Drive `t UsedSpace(in GB) `t FreeSpace(in GB) `t TotalSpace(in GB) `n"
    }
    Process
    {
        $drives=Get-WmiObject Win32_LogicalDisk -ComputerName $RemoteComputerName

        foreach ($drive in $drives){
            
            $drivename=$drive.DeviceID
            $freespace=[int]($drive.FreeSpace/1GB)
            $totalspace=[int]($drive.Size/1GB)
            $usedspace=$totalspace - $freespace
            $output=$output+$drivename+"`t`t"+$usedspace+"`t`t`t`t`t`t"+$freespace+"`t`t`t`t`t`t"+$totalspace+"`n"
        }
    }
    End
    {
        return $output
    }
}

Open in new window

https://gallery.technet.microsoft.com/PowerShell-Script-to-Get-b6ca4350
We always set the Windows Firewall for Remote Volume Management to ENABLED via Group Policy.

Then, using MMC --> New Snap-In --> Computer --> Another Computer --> SERVER NAME

Open the Disk Management node and the information will be there.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.