Script not working as a function

This code works just fine but when I put it into a function it returns nothing.

$folders = Get-ChildItem -Path c:\users -Directory -Depth 1

$Report = @()
Foreach ($folder in $Folders) {

$Acl = Get-Acl -Path $Folder.FullName
foreach ($Access in $acl.Access)
{
$report += [PSCustomObject] @{'FolderName'=$Folder.FullName;
'ADGroup or User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited
} 
}
}

$report

The same code just put into a function and it returns nothing.

function get-folderpermissions{

$folders = Get-ChildItem -Path c:\users -Directory -Depth 1

$Report = @()
Foreach ($folder in $Folders) {

$Acl = Get-Acl -Path $Folder.FullName
foreach ($Access in $acl.Access)
{
$report += [PSCustomObject] @{'FolderName'=$Folder.FullName;
'ADGroup or User'=$Access.IdentityReference;'Permissions'=$Access.FileSystemRights;'Inherited'=$Access.IsInherited
} 
}
}

}

$report

 

You need to output the $report within the function.

Something like this:

function get-folderpermissions{

$folders = Get-ChildItem -Path c:\users -Directory -Depth 1

$Report = @()
Foreach ($folder in $Folders) {

$Acl = Get-Acl -Path $Folder.FullName
foreach ($Access in $acl.Access)
{
$report += [PSCustomObject] @{‘FolderName’=$Folder.FullName;
‘ADGroup or User’=$Access.IdentityReference;‘Permissions’=$Access.FileSystemRights;‘Inherited’=$Access.IsInherited
}
}
}
$report
}

Dang, that was an easy one.