title: Retrieve Size of User profiles with powershell
body: <p>I'm Trying to retrieve the exact size of the profile in windows machine.</p>
  <p>below is my code and O/P</p>
  <pre><code>$profiles = Get-ChildItem C:\Users | ?{Test-path C:\Users\$_\NTUSER.DAT} | Select -ExpandProperty Name
    foreach($profile in $profiles)
      {
      $largeprofile = Get-ChildItem C:\Users\$profile  -recurse | Measure-Object -Sum length | Select -ExpandProperty Sum
      $largeprofile = [math]::Round(($largeprofile/1MB),2) + &quot;MB&quot;
      if($largeprofile -lt 20){Continue}
      $object = New-Object -TypeName PSObject
      $object | Add-Member -MemberType NoteProperty -Name Name -Value $profile
      $object | Add-Member -MemberType NoteProperty -Name &quot;Size(MB)&quot; -Value $largeprofile
      ($object | fl | Out-String).Trim();Write-Output &quot;`n&quot;
      }
  </code></pre>
  <blockquote>
  <p>O/P</p>
  <p>Name     : admin</p>
  <p>Size(MB) : 34.62</p>
  </blockquote>
  <p>however exact size of the folder is 181MB,powershell is not able to read all the folders and files inside the parent folder, how can I get the exact size which is displayed in a properties of the folder.</p>
  <p>Note : For Folders other than the profile folder o/p is correct.</p>