API query filesystem

Product: PowerShell Universal
Version: 2.4.1
MSI Install
Service running as service account

Hi @adam

Can a API query a filesystem? If i have a simple API like:

New-PSUEndpoint -Url "/api/v1/Test" -Endpoint {
    Get-ACL "c:\"
} -ErrorAction SilentlyContinue

In PSU 2.4.1 this errors with ‘Invoke-RestMethod: The response ended prematurely.’
In PSU 2.2.1 this is the response:

If i use Get-AdUser, or other commands that are not querying the file system they work fine…


This is likely due to serialization failing.

I’d suggest only returning data that you require.

New-PSUEndpoint -Url “/api/v1/Test” -Endpoint {
Get-ACL “c:” | Select-Object FullName
} -ErrorAction SilentlyContinue

Of course! Thanks!!