简体   繁体   English

如何在 powershell 脚本中获取命令 output?

[英]How to get command output in the powershell script?

I want to wrote a little script that show me all teams in microsoft teams software.我想编写一个小脚本,向我展示 microsoft 团队软件中的所有团队。

Write-host "XXX"
Start-Sleep -Seconds 3
Connect-MicrosoftTeams;
Write-host "XXX"
Get-Team

But after the script runs "get-team" command, it show no result for that command.但是在脚本运行“get-team”命令后,它没有显示该命令的结果。 What am I doing wrong?我究竟做错了什么? What should I do, to get the output of "Get-Team" command showing in powershell window?我该怎么做才能获得 powershell window 中显示的“Get-Team”命令的 output?

Thanks for the help.谢谢您的帮助。

Get-Team cmdlet supports retrieving teams with particular properties/information, including all teams that a specific user belongs to, all teams that have been archived, all teams with a specific display name, or all teams in the organization. Get-Team cmdlet 支持检索具有特定属性/信息的团队,包括特定用户所属的所有团队、已归档的所有团队、具有特定显示名称的所有团队或组织中的所有团队。

Get-Team
   [-User <String>]
   [-Archived <Boolean>]
   [-Visibility <String>]
   [-DisplayName <String>]
   [-MailNickName <String>]
   [-NumberOfThreads <Int32>]
   [<CommonParameters>]

Ref: https://docs.microsoft.com/en-us/powershell/module/teams/get-team?view=teams-ps#examples参考: https://docs.microsoft.com/en-us/powershell/module/teams/get-team?view=teams-ps#examples

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将powershell命令的输出转换为数组 - How to get the output of a powershell command into an array 如何在Powershell脚本中输出被调用命令的所有输出 - How can I output all the output of a called command in Powershell script 无法使用 python 脚本从 powershell 命令获取 output - Unable to get the output from a powershell command using python script 如何在 powershell 脚本中从命令 output 的特定部分创建变量 - How to create a variable from specific part of command output in powershell script 在HTA中输出PowerShell脚本 - Get Output of a PowerShell Script in a HTA 批处理脚本中的powershell命令输出日志记录 - powershell command output logging in batch script 如何在 PowerShell 5.1 中将命令行应用程序输出输出到后台变量? - How to get command line application output to a variable in background in PowerShell 5.1? 如何从PowerShell命令获取输出的第一个单词 - How to get the first word of output from a PowerShell command 如何从 PowerShell 的外部命令输出中获取原始二进制数据? - How to get original binary data from external command output in PowerShell? 如何使用PowerShell将命令提示符的输出转换为变量 - How to get command prompt's output into a variable with PowerShell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM