title: Powershell showing disk space details of inaccessible drives
body: <p>I tried to retrieve the disk space details of a remote server A from another server B and used the below PowerShell command:</p>
  
  <pre><code>Get-WmiObject -Class Win32_LogicalDisk -ComputerName aa.bb.cc.dd -filter "DriveType=3" | Select DeviceID,@{Name="Size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}},@{Name="FreeSpace(GB)";Expression={"{0:N3}" -f($_.freespace/1gb)}}
  </code></pre>
  
  <p>The output is as follows:</p>
  
  <pre><code>DeviceID                   Size(GB)                   FreeSpace(GB)            
  --------                   --------                   -------------            
  C:                         59.9                       17.080                   
  D:                         20.0                       0.875                    
  F:                         100.0                      81.865
  </code></pre>
  
  <p>In server A, Drive D is inaccessible. I can't see the drive space details in My computer. I checked the drive space details in Disk Management of server A and found that the above values are correct.</p>
  
  <p>Again I went to server A and ran the following command in its own PowerShell window:</p>
  
  <pre><code>Get-WmiObject -Class Win32_LogicalDisk -filter "DriveType=3" | Select DeviceID,@{Name="Size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}},@{Name="FreeSpace(GB)";Expression={"{0:N3}" -f($_.freespace/1gb)}} | out-file ./local.txt
  </code></pre>
  
  <p>Now I got the following output:</p>
  
  <pre><code>DeviceID                   Size(GB)                   FreeSpace(GB)            
  --------                   --------                   -------------            
  C:                         59.9                       17.080                   
  D:                         0.0                        0.000                    
  F:                         100.0                      81.864 
  </code></pre>
  
  <p>Actually the commands are almost similar. The only difference is that if we try to get the space details of a remote machine, then we need to add the parameter -ComputerName and the remote machine name.</p>
  
  <p>My question is, why is PowerShell showing two different results when I running the command remotely and locally.</p>
  
  <p>The value that it is showing is actually correct.
  I've a list of other servers and use this command within a script to find the disk space details of them. Tomorrow, if another drive becomes inaccessible in one of the servers, this command won't help me find it as it would retrieve its details also.</p>