Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: get-foldersize and user profile files #145

Closed
1 of 5 tasks
jszabo98 opened this issue Feb 12, 2024 · 8 comments
Closed
1 of 5 tasks

[Bug]: get-foldersize and user profile files #145

jszabo98 opened this issue Feb 12, 2024 · 8 comments

Comments

@jszabo98
Copy link

Describe the problem

get-foldersize doesn't seem to return the correct size for user profiles, maybe because of things like symlinks? It is fast though.

Expectation

No response

Additional Information

No response

PowerShell version

4.0

Platform

None

Additional Checks

  • You are using the latest version of this module.
  • You have read this repository's README file.
  • You have read full help and examples for the command you are having problems with.
  • You are running PowerShell in an elevated session.
  • You are running in a traditional PowerShell console or Windows Terminal
@jszabo98 jszabo98 added bug triage new issue that needs review labels Feb 12, 2024
@jdhitsolutions
Copy link
Owner

What version of PowerShell are you using? What path are you querying? Are you including hidden files?

@jszabo98
Copy link
Author

jszabo98 commented Feb 12, 2024

Powershell 5.1. c:\users. Including hidden files.

@jdhitsolutions
Copy link
Owner

You'll probably get access-denied messages for parts of that path, even if running as Admin. I did a test on my profile in Windows PowerShell.

Get-FolderSizeInfo $home -hidden

My total size is actually about 3GB more than what I get when I use Windows Explorer and look at properties. The same test in PowerShell 7 is closer to the results I see in Windows Explorer. This is on a Windows 11 system. Profile folders are tricky due to hidden files and special access permissions.

Although, there might be an issue with symlinks. In Windows PowerShell, the function follows the link and includes the size information, but not in PowerShell 7, which uses a different .NET method.

@jszabo98
Copy link
Author

This suits me, to skip the reparsepoints like the mounted Onedrive ...

$top = ($di.GetDirectories()).Where( { $_.attributes -notmatch 'reparsepoint' })

@jdhitsolutions jdhitsolutions added enhancement and removed pending feedback triage new issue that needs review labels Feb 15, 2024
@jdhitsolutions
Copy link
Owner

Let me see what I can come up with.

@jdhitsolutions
Copy link
Owner

I have a new version for the next release. I am now skipping all reparse points and junctions.

@jdhitsolutions
Copy link
Owner

v2.49.0 has been published to the PowerShell Gallery if you want to update and test.

@jszabo98
Copy link
Author

Looks good. Actually my typical usage is like this, sort of "du | sort -n". It's good for avd, where the disk is slower.

icm comp001 { dir -dir -force C:\programdata\ | Get-FolderSizeInfo.ps1 | sort totalsize } | ft -a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants