Return value from invoke-Command within a scriptblock?

by Feb 15, 2011

Hello, is there a way to return the result
or varibel value from a script block? i trying to get return 
value in $QuotaRConfiguration

Here is the code.

Function Global:FolderGet-ReplicationPartnerQuotaFoldersConfiguration($Configuration) {

    $QuotaRConfiguration = @{"users" = @{"office" = @{};};

                                                "groups"= @{"office" = @{"departments"  = @{}; 

                                                 "teams"        = @{};

                                                 "projects"     = @{};};};};                                                            

    $RPServer            = [string]($Configuration["office"]["employees"]["userrepserv"]); 

    $FolderQuotaPath     = ([string]$Configuration["office"]["employees"]["userreppath"]+"*")

    invoke-Command -ComputerName $RPServer -ScriptBlock {

        param($FolderQuotaPath, $QuotaRConfiguration, $RPServer)     

 

        $quotainfo          = New-Object -com Fsrm.FsrmQuotaManager

        $quotainfo.EnumQuotas($FolderQuotaPath) | foreach-object { 

           $QuotaRConfiguration["users"]["office"][[string]($_.Path)]                   = @{"QuotaPath"      = ([string]($_.Path))                                                                                                                                                       "SourceTemplate" = ([string]($_.SourceTemplateName))};

        }

    } -ArgumentList $FolderQuotaPath, $QuotaRConfiguration, $RPServer

  }                                                             

Return $QuotaRConfiguration;

}