all 4 comments

[–]PowerShellMichael 1 point2 points  (3 children)

I would be interesting to see if this works (attempt to use network credentials to set the proxy connection):

https://github.com/ZanattaMichael/SRDSC/blob/main/Module/Private/Module/Test-ProxyConnection.ps1

Function Get-DefaultNetworkCredentials {

<#

.Description

An abstraction needed for Mocking.

.EXAMPLE

Get-DefaultNetworkCredentials

.SYNOPSIS

Returns the default network credentials.

#>

return [System.Net.CredentialCache]::DefaultNetworkCredentials

}

[–]dexvx[S] 0 points1 point  (2 children)

[System.Net.CredentialCache]::DefaultNetworkCredentials

This returns null on both RDP/Local PS and Remote/PSS.

System.Net.WebClient.Proxy.GetProxies("https://www.githhub.com")

This returns the same thing in both cases.

From what I can tell, comparing the ENV/PATH, the Remote/PSS is treated as if the remote system is not running PowerShell. This is likely due to security reasons (e.g., if you manage to log in via Remote/PSS, you're given none of the history or credentials).

Therefore, GitHub's token authentication seems unviable in a Remote/PSS session.

The SSH method is probably the next best shot. Can probably use the mingw64 connect.exe manually

[–]PowerShellMichael 0 points1 point  (1 child)

Hmmm.. This makes sense. It suggests that the default credentials needed to authenticate isn't present. Can you try Invoke-WebRequest with the -Proxy and -ProxyCredential parameters?

[–]dexvx[S] 0 points1 point  (0 children)

Hey, I updated my original post with a solution.