A [preinstallation](https://docs.microsoft.com/en-us/windows/msix/desktop/ deploy-preinstalled-apps) kit is available for system integrators and OEMs interested in prepackaging Windows Terminal with a Windows image. More information is available in the [DISMdocumentationonpreinstallatio n](https://docs.microsoft.com/windows-hardware/manufacture/desktop/preinst all-apps-using-dism). Users who do not intend to preinstall Windows Terminal should continueusing the _msixbundle_ distribution.
Bugs fixed in this release:
* We reverted the tab switcher to _off by default_, because we changed your defaults on you so that tab switching was both enabled and _in most-recently-used order_. I'm sorry about that. (#8325) * To turn the switcher back on, in MRU order, add the global setting `"useTabSwitcher": true`. * We'd previously said the default value for `backgroundImageStretch` was `uniformToFill`, but it was actually `fill`. We've updated the code to make it `uniformToFill`. (#8280) * The tab switcher used to occasionally eat custom key bindings and break, but @Don-Vito came through and helped it not do that. Thanks! (#8250)
[PSCustomObject]@{ TAR = $info.tarball_url ZIP = $info.zipball_url AppX = $info.Assets.Browser_Download_url[0] } | Format-List
结果如下:
TAR : https://api.github.com/repos/microsoft/terminal/tarball/v1.4.3243.0
ZIP : https://api.github.com/repos/microsoft/terminal/zipball/v1.4.3243.0
AppX : https://github.com/microsoft/terminal/releases/download/v1.4.3243.0/Microsoft.WindowsT
erminal_1.4.3243.0_8wekyb3d8bbwe.msixbundle
Id : W. Europe Standard Time DisplayName : (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna StandardName : W. Europe Standard Time DaylightName : W. Europe Daylight Time BaseUtcOffset : 01:00:00 SupportsDaylightSavingTime : True
但是,此信息是否正确取决于您的实际配置。当您将笔记本电脑带到其他地方时,不一定会更新您的时区。
找出当前时区的另一种方法是调用公共 Web 服务。根据您当前的互联网连接,它会根据您当前所在的位置返回时区:
ip : 84.183.236.178 hostname : p54b7ecb2.dip0.t-ipconnect.de city : Hannover region : Lower Saxony country : DE loc : 52.3705,9.7332 org : AS3320 Deutsche Telekom AG postal : 30159 timezone : Europe/Berlin readme : https://ipinfo.io/missingauth
ip : 51.107.59.180 city : Zürich region : Zurich country : CH loc : 47.3667,8.5500 org : AS8075 Microsoft Corporation postal : 8001 timezone : Europe/Zurich readme : https://ipinfo.io/missingauth
将此命令与其他命令结合使用,可以找出与您的计算机进行通信的人员。例如,Get-NetTcpConnection 列出了您的网络连接,现在您可以查找谁是您所连接的 IP 地址背后的所有者。
在下面的示例中,Get-NetTcpConnection 返回所有当前活动的 HTTPS 连接(端口443)。远程 IP 被自动解析,因此您可以知道哪个软件正在保持连接,以及该软件正在与谁通信:
# get all connections to port 443 (HTTPS) Get-NetTCPConnection-RemotePort443-State Established | # where there is a remote address Where-Object RemoteAddress | # and resolve IP and Process ID Select-Object-Property$IPOwner, RemoteAddress, OwningProcess, $Process
下面是一个实际示例:让我们转储本地管理员组。您可以按名称或不区分文化的 SID 来访问组:
RemoteAuthority RemoteAddress OwningProcess Process
--------------- ------------- ------------- -------
AS8075 Microsoft Corporation (Amsterdam) 52.114.74.221 14204 C:\Users\tobia\AppData\Local\Microsoft\Teams\current\Teams.exe
AS8075 Microsoft Corporation (Hampden Sydney) 52.114.133.169 13736 C:\Users\tobia\AppData\Local\Microsoft\Teams\current\Teams.exe
AS36459 GitHub, Inc. (Ashburn) 140.82.113.26 21588 C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
AS8068 Microsoft Corporation (Redmond) 13.107.42.12 9432 C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE
AS8075 Microsoft Corporation (Zürich) 51.107.59.180 14484 C:\Program Files\PowerShell\7\pwsh.exe
AS8068 Microsoft Corporation (Redmond) 13.107.42.12 9432 C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE
AS8075 Microsoft Corporation (San Antonio) 52.113.206.137 13736 C:\Users\tobia\AppData\Local\Microsoft\Teams\current\Teams.exe
AS8075 Microsoft Corporation (Paris) 51.103.5.186 12752 C:\Users\tobia\AppData\Local\Microsoft\OneDrive\OneDrive.exe
在上一个技巧中,我们介绍了 Get-NetTCPConnection cmdlet,它是 Windows 系统上网络实用程序 netstat.exe 的更好替代方法,并且通过一些技巧,您甚至可以解析 IP 地址和进程 ID。但是,这会大大降低命令的速度,因为 DNS 查找可能会花费一些时间,尤其是在网络超时的情况下。
$HostName = @{ Name='Host' Expression={ $remoteHost = $_.RemoteAddress try { # try to resolve IP address [Net.Dns]::GetHostEntry($remoteHost).HostName } catch { # if that fails, return IP anyway $remoteHost } } }
# get all connections to port 443 (HTTPS) Get-NetTCPConnection-RemotePort443-State Established | # where there is a remote address Where-Object RemoteAddress | # and resolve IP and Process ID Select-Object-Property$HostName, OwningProcess, $Process
# get all connections to port 443 (HTTPS) Get-NetTCPConnection-RemotePort443-State Established | # where there is a remote address Where-Object RemoteAddress | # start parallel processing here # create a loop that runs with 80 consecutive threads ForEach-Object-ThrottleLimit80-Parallel { # $_ now represents one of the results emitted # by Get-NetTCPConnection $remoteHost = $_.RemoteAddress # DNS resolution occurs now in separate threads # at the same time $hostname = try { # try to resolve IP address [Net.Dns]::GetHostEntry($remoteHost).HostName } catch { # if that fails, return IP anyway $remoteHost } # compose the calculated information into one object [PSCustomObject]@{ HostName = $hostname OwningProcess = $_.OwningProcess Process = (Get-Process-Id$_.OwningProcess -ErrorAction SilentlyContinue).Path } }
如您所见,第二种方法比以前快得多,并且是 PowerShell 7 中新的“并行循环”的好用例。
但是,不利的一面是,该代码现在的兼容性更低,只能在 Windows 系统上运行,并且只能在 PowerShell 7 中运行。在本系列的最后一部分中,我们将展示一个更简单的解决方案,该解决方案可以在所有版本的 PowerShell 上运行。