Trying to create a table via Powershell

Hi Guys, I do have bunch of target folders that I’m trying to check them regularly via PS script;

Z:\RootFolder\AAAA0001\Apps.…
Z:\RootFolder\BBBB0001\Apps.…
Z:\RootFolder\CCC00001\Apps.…
Z:\RootFolder\DDDD0001\Apps.…
goes on

I wanna make get an output something like this

Ref AppFolderSize(GB)
AAAA0001 3GB
BBBB0001 2GB
CCCC0001 5GB
DDDD0001 8GB
etc.

Has someone done this?

Michael, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE”, in the “Visual” view you can use the format template “Preformatted”. You can go back edit your post and fix the formatting - you don’t have to create a new one.
Thanks in advance.

This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.

What have you tried so far? We expect you to make an own attempt to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.

That’s such a basic question that I wonder why you even spend the effort to create an account in a forum and ask a question. You could have find a solution by google-ing in a matter of seconds.

What I’ve don so far is just draft codes, couldn’t figure out how to do it really,

 

$companies = “Z:\RootFolder”
$folders = Get-ChildItem -Path $companies -Exclude Backup,Robocopy -Directory -Name -Force -ErrorAction SilentlyContinue

foreach {
Write-Host $_.Name

}

| ForEach-Object {ls “$companies$_.Name\Apps”}

-Process {{dir $_Name} {“{0:N2} GB” -f (gci $_Name -Recurse | measure Length -s).sum / 1Gb)}}

{“{0:N2} GB” -f ((gci “$companies$_Name\Apps” -Recurse | measure Length -s).sum / 1Gb)}

| ForEach-Object -Process {“{0:N2} GB” -f ((gci $_Name -Recurse | measure Length -s).sum / 1Gb)}

$companies = “Z:\RootFolder”
“{0:N2} GB” -f ((gci “$companies\BBBB0001\Apps” -Recurse | measure Length -s).sum / 1Gb)

“{0:N2} GB” -f ((gci -Recurse | measure Length -s).sum / 1Gb)

I had described how you should format code. Please go back and fix your code formatting. Please do not create a new post - change your existing one.

If your code results in errors you should post them as well, please.