ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
35 stars 2 forks source link

Send-PSUEvent Not Implemented Exception #3810

Open adamdriscoll opened 4 hours ago

adamdriscoll commented 4 hours ago

Version

5.0.6

Severity

Low

Environment

msi

Steps to Reproduce

This cmdlet was never updated to the new gRPC cmdlet style and still uses the old format but the HTTP method is not implemented. This results in the cmdlet failing if called externally or if the -AppToken or -ComputerName are specified.

Expected behavior

Successful events

Actual behavior

Not Implemennted exception

Additional Environment data

No response

Screenshots/Animations

No response

zoe2276 commented 3 hours ago

RE: The comments in #3615

This was actually attempted both in an external environment AND within a PSU script, first with Connect-PSUServer and second with the -AppToken and ComputerName flags. It occurs no matter how I attempt to access the cmdlet or its alias.

External environment: image Within PSU:

$Connections = (Get-PSUEventHubConnection).Where({ $null -eq $_.Disconnected })
foreach ($Connection in $Connections) {
    Write-Debug "$($Connection | ConvertTo-Json)"
    try {
        $Case = Send-PSUEvent -ComputerName $Global_IISRoot -AppToken $Secret:TKN_MDM_SVC -Hub EH_MDM -ConnectionId $Connection.ConnectionId -Data @{
            Contents = Get-Content "Scripts\PowerShellScripts\Apps\PAR\MDM Device Manager\Get-Case.ps1" -Raw
            Parameters = @{
                MatchQuota = 4
            }
        }

        [void]($Cases.Add($Case))
    } catch {
        throw $_
    }
}
Write-Debug "Cases: $($Cases | ConvertTo-Json)"

Output:

[Verbose] Some gRPC errors about HTTP/2
[Verbose] [9/20/2024 11:27:52 AM] Setting headers for gRPC.
[Debug] [9/20/2024 11:27:53 AM] {
  "Id": 4,
  "UserName": null,
  "RemoteIpAddress": "0.0.0.0", // Obfuscated
  "RemoteComputer": null,
  "EventHub": "EH_MDM",
  "Computer": "Server", // Obfuscated
  "Connected": "2024-09-20T15:44:33.7039567",
  "Disconnected": null,
  "ConnectionId": "GUID" // Obfuscated
}
[Error] [9/20/2024 11:27:53 AM] The method or operation is not implemented.