Hello, I’ve been tasked with getting file share info such as name, actual path, and space used in MB or GB. We have two many servers for me to continue to do this manually so I started writing a powershell script but have run into some issues.
I don’t want the default shares hence the {$_.Description -eq “$null”}. It works just fine if there’s only one share, but if there are multiple I get this:
Measure-object : Property "length" cannot be found in any object(s) input
Also… and perhaps obviously… expect this to not be fast. And to possibly fail in any instance where you don’t have permission to read the file. Or when the server just gets tired of sending file data to you and drops the connection. This is something I’d probably write as a workflow, ship to the server via Remoting, and let each server run locally on its own. They’d then ship the results back to you however many hours later.
Oh, you’ll need -Recurse on Get-ChildItem, too, or you’re only going to get the files in the root of the share. Remember, directories don’t have sizes - only files.
Hm, can’t seem to get it working with -File and -Recurse either. We’re running different versions of Windows Server so I don’t think the Powershell is the same across them. I tried Get-ChildItem with -File and it said that wasn’t a parameter. Grr this is getting frustrating, anything besides powershell to do this? haha.