问题标签 [out-gridview]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
powershell - 循环遍历服务器并输出结果以及错误
我编写了一个简单的 PowerShell 脚本来检索服务器的上次启动时间列表并将结果输出到网格视图。结果会立即显示在网格窗口中,但是当服务器没有响应 get 命令时,由于 WMI 未运行或类未注册,结果会短暂暂停。然后它在 PS 中显示错误并移动到下一个服务器。
现在,除非“未响应”服务器显示在结果窗口中,否则结果将无济于事。
PS 窗口中以红色显示的错误类型:
- Get-WmiObject:类未注册(HRESULT 异常:0x80040154 (REGDB_E_CLASSNOTREG))在行:1 字符:12
- Get-WmiObject : RPC 服务器不可用。(来自 HRESULT 的异常:0x800706BA)在 line:1 char:12
编辑:如果服务器响应错误,我如何输出良好的结果以及服务器名称?
powershell - 管道循环到 out-gridview 并在每个循环上清除网格?
我只是想知道是否可以像在控制台中一样清除每个循环上的 Out-Gridview:
不幸的是,这并不能每次都清除 out-gridview:
powershell - Generating hashcodes for specific filetypes only with Powershell
I'm a complete beginner to Powershell and scripting, and have been successfully been using Out-GridView to display some properties of the files I have in my directories using the following:
dir D:\Folder1\$type -Recurse | Select Fullname,Directory,LastWriteTime | out-gridview
where I specifiy the file extension with $type = "*.pdf"
for instance.
I would also like to start comparing files using hashcodes so I have tried this command:
ls | Get-Filehash
However, I would like to have the hashcodes in the output window as a seperate column with out-gridview. Is this possible? I've tried
dir D:\Folder1\$type -Recurse | Select Fullname,Directory,LastWriteTime,Filehash | out-gridview
and
dir D:\Folder1\$type -Recurse | Select Fullname,Directory,LastWriteTime | Get-Filehash | out-gridview
Of course neither of these work.
Does anyone have a way of generating hashcodes for a specific file extension only?
Many thanks in advance!
powershell - Powershell read-host -prompt(如何在控制台中键入外部文件中的值时查找它们)
我有具有以下代码的 PowerShell 控制台脚本(不是 GUI):
但是,在运行脚本时,我想一次输入几个字符并让它在外部文本文件中进行查找以servernames.txt
进行匹配,并且字符越多,结果就越好(理想情况下,我希望能够直接从动态查找)。
目的是便于键入数百个服务器的名称,因为您不需要记住每个名称,因为该servernames.txt
文件将包含整个服务器清单。
我想过Out-GridView
,但不确定这是否适用于控制台脚本。理想情况下不应弹出另一个窗口。
powershell - PowerShell Out-GridView
使用 Out-GridView,如何控制列名是什么?我想要一些对列名有意义的东西,而不是“字符串”——这可能吗?
powershell - Out-Gridview 快速过滤器搜索不允许空格
我正在使用Out-GridView
PowerShell。一切似乎都很好,除了快速过滤器搜索不允许在多个单词之间输入空格之外。不幸的是,这正是其 docs.microsoft 实用程序网站上所宣传的内容:
搜索多个单词。要在表格中搜索多个单词,请键入以空格分隔的单词。Out-GridView 显示包含所有单词的行(逻辑与)。
我尝试使用一些变体(例如标准Get-Process
)加载 Out-GridView,但似乎没有任何效果。有没有人对如何解决它有任何想法?
编辑:我实际上发现这是由于通过 PowerShell 和 PowerShell ISE 运行 Gridview 之间的差异;这个问题只在我通过 ISE 运行时才出现。值得面植。
powershell - 过去只选择字段到 out-gridview
我怎样才能只从一个对象中选择一个字段来显示在 out-gridview 中,但仍然保留整个对象作为结果。
例如,我检索一个对象,它给了我:
在网格视图中,我只想查看名称和 ID。用户选择所需的行后,我希望再次将结果作为相同类型的对象。
当我使用选择对象时,
我得到了结果,但我现在必须再次搜索原始对象以获取该行的其他属性。
有什么更好的方法来做到这一点?
powershell - Powershell CSV 变量到 Out-GridView
这让我发疯了。我想将 CSV 文本保存为字符串variable
-而不是 文件!
然后我想Out-GridView
使用逗号作为列分隔符将该(CSV)文本输出到。
我该怎么做呢?我看起来高高在低,我找不到任何东西 -没有- 关于如何做到这一点,而不先将文本保存到 CSV 文件,然后使用Import-Csv
. 我不想保存文件,我只想在Out-GridView
.
有什么线索吗?
例子: