我需要以下脚本的输出一些帮助,因此输出不会显示为省略号(...)。
我尝试插入| Format-Table -Wrap -AutoSize,但似乎无法正确处理。

 clear-host Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue
 $services = new-object system.collections.sortedlist
 $servers = (get-spfarm).servers
 foreach ($server in $servers) {
     foreach($service in $server.serviceinstances)
     {
         if ($service.status = "Online")
         {
             $s = $service.typename
             if ($services.contains($s))
             {
                 $serverlist = $services[$s]
                 $servername = $server.name
                 $services[$s]  = "$serverlist - $servername"
             }
             else
             {
                 $services[$s] = $server.name
             }
         }
     } }
  $services
输出:
Name                            Value
----                           -----
Access Database Service        SE5APP - SE5FE - SE7FE - FAQ3
Application Discovery **and L...** SE5APP - SE5FE - SE7FE - FAQ3
Application Registry Service   SE5APP - SE5FE - SE7FE - FAQ3

最佳答案

Format-List (fl)或 Format-Table -auto (ft -auto)都应该在这里有所帮助。

$services | fl

要么
$services | ft -auto

关于powershell - 将powershell脚本更改为不带省略号的输出(…),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13735275/

10-12 04:00
查看更多