如何查看 Windows Server 2016 中所有 PowerShell 会话的命令历史记录? [英] How can I see the command history across all PowerShell sessions in Windows Server 2016?

查看:213
本文介绍了如何查看 Windows Server 2016 中所有 PowerShell 会话的命令历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以查看 Windows Server 2016 中所有会话的完整历史记录?

Where can you view the full history from all sessions in Windows Server 2016?

以下 PowerShell 命令仅包含来自当前会话的命令:

The following PowerShell command only includes the commands from the current session:

Get-History

推荐答案

在 PowerShell 中输入以下命令:

In PowerShell enter the following command:

(Get-PSReadlineOption).HistorySavePath

这为您提供了保存所有历史记录的路径.然后在文本编辑器中打开路径.

This gives you the path where all of the history is saved. Then open the path in a text editor.

尝试 cat (Get-PSReadlineOption).HistorySavePath 在 PowerShell 中列出历史记录.

Try cat (Get-PSReadlineOption).HistorySavePath to list the history in PowerShell.

这篇关于如何查看 Windows Server 2016 中所有 PowerShell 会话的命令历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆