Open msekkappan opened 2 weeks ago
Version 7.4.2 behaves the same.
So you're saying that saving the commands to a .ps1
file and invoking that file from a stand-alone PowerShell session produces this symptom? Or are you executing the file via the PowerShell SDK (e.g. from a C# project)?
Invoking the file in a PowerShell session produces the error. Regards,MalathiSent from my iPhoneOn Apr 29, 2024, at 3:57 PM, Michael Klement @.***> wrote:Re: [PowerShell/PowerShell] No runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property (Issue #21551)So you're saying that saving the commands to a .ps1 file and invoking that file from a stand-alone PowerShell session produces this symptom? Or are you executing the file via the PowerShell SDK (e.g. from a C# project)?—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you authored the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.
Saving these in a ps1 file and invoking in a PS Console throws this error message. If I type these commands individually in the console it does not happen.
The error comes from the display-formatting system, but the error message is usually only seen when PowerShell is hosted in other applications. Also, the error details describe a different error, "Object reference not set to an instance of an object."
Your symptom suggests that execution - and therefore joint formatting - in a single pipeline may trigger the bug, so see if the following makes a difference:
Connect-MicrosoftTeams | Out-Host # force instant, direct-to-display output
$AllTeams = Get-Team -User JXXXXXX@XXXXX.OnMicrosoft.com
$AllTeams
Will try Regards,MalathiSent from my iPhoneOn May 1, 2024, at 1:30 PM, Michael Klement @.> wrote:Re: [PowerShell/PowerShell] No runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property (Issue #21551)The error comes from the display-formatting system, but the error message is usually only seen when PowerShell is hosted in other applications.Also, the error details describe a different error, "Object reference not set to an instance of an object."Your symptom suggests that execution - and therefore joint formatting - in a single pipeline may trigger the bug, so see if the following makes a difference:Connect-MicrosoftTeams | Out-Host # force instant, direct-to-display output $AllTeams = Get-Team -User @. $AllTeams—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you authored the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.
Adding pipeline to the get-team command displayed results along with the same error message “no runspace available message…”Adding pipeline to the connect-MicrosoftTeams had no impact. Regards,MalathiSent from my iPhoneOn May 2, 2024, at 3:59 PM, Malathi @.> wrote:Will try Regards,MalathiSent from my iPhoneOn May 1, 2024, at 1:30 PM, Michael Klement @.> wrote:Re: [PowerShell/PowerShell] No runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property (Issue #21551)The error comes from the display-formatting system, but the error message is usually only seen when PowerShell is hosted in other applications.Also, the error details describe a different error, "Object reference not set to an instance of an object."Your symptom suggests that execution - and therefore joint formatting - in a single pipeline may trigger the bug, so see if the following makes a difference:Connect-MicrosoftTeams | Out-Host # force instant, direct-to-display output $AllTeams = Get-Team -User @.*** $AllTeams—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you authored the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.
Connect-Microsoftteams with an out-host didn’t make any difference. However, adding out-host to get-team command displayed anticipated results plus same error message “No runspace…”Regards,MalathiSent from my iPhoneOn May 2, 2024, at 3:59 PM, Malathi @.> wrote:Will try Regards,MalathiSent from my iPhoneOn May 1, 2024, at 1:30 PM, Michael Klement @.> wrote:Re: [PowerShell/PowerShell] No runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property (Issue #21551)The error comes from the display-formatting system, but the error message is usually only seen when PowerShell is hosted in other applications.Also, the error details describe a different error, "Object reference not set to an instance of an object."Your symptom suggests that execution - and therefore joint formatting - in a single pipeline may trigger the bug, so see if the following makes a difference:Connect-MicrosoftTeams | Out-Host # force instant, direct-to-display output $AllTeams = Get-Team -User @.*** $AllTeams—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you authored the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.
Thanks; personally, I can't be of further assistance, because I don't have access to Microsoft Teams, but I hope someone else can help you narrow this down.
I believe this to be an issue with the MicrosoftTeams module more than PowerShell
Please can you provide which version of the module you are using from Get-Module MicrosoftTeams
as this was missed from your inital repro steps
Tran’s version 6.1.0Regards,MalathiSent from my iPhoneOn May 4, 2024, at 1:08 AM, Ryan Yates @.***> wrote:Re: [PowerShell/PowerShell] No runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property (Issue #21551)I believe this to be an issue with the MicrosoftTeams module more than PowerShellPlease can you provide which version of the module you are using from Get-Module MicrosoftTeams as this was missed from your inital repro steps—Reply to this email directly, view it on GitHub or unsubscribe.You are receiving this email because you authored the thread.Triage notifications on the go with GitHub Mobile for iOS or Android.
Prerequisites
Steps to reproduce
Running these commands in interactive mode works perfectly. However, saving them to a file and running them throws this error.
format-default: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was:
Connect-MicrosoftTeams $AllTeams = Get-Team -User JXXXXXX@XXXXX.OnMicrosoft.com $AllTeams
Expected behavior
Actual behavior
Error details
Environment data
Visuals
No response