Private/Invoke-NetUse.ps1

function Invoke-NetUse {
    <#
    .SYNOPSIS
        Wrapper around the 'net use' external command for mockability.
    .DESCRIPTION
        Executes 'net use' with the given arguments and returns the output.
        Using a wrapper function allows Pester to mock this in tests,
        since external executables cannot be mocked directly.
    .PARAMETER Arguments
        The arguments to pass to 'net use'. If omitted, runs 'net use' with no arguments (list mode).
    .OUTPUTS
        [string[]] The command output lines.
    #>

    [CmdletBinding()]
    [OutputType([string[]])]
    param(
        [Parameter()]
        [AllowEmptyCollection()]
        [string[]]$Arguments = @()
    )

    if ($Arguments.Count -eq 0) {
        $result = & net use 2>&1
    }
    else {
        $result = & net use @Arguments 2>&1
    }
    return $result
}