PowerShell:带有用户配置文件列表(Get-ChildItem -path \\ $ enk:computername \ c $ \ users \)的外浏览量

发布于 2025-01-27 07:16:13 字数 640 浏览 4 评论 0原文

基本用法问题:

当我运行

Get-ChildItem -path \\$env:COMPUTERNAME\c$\users\ | Out-GridView -Title "Select from User Accounts" -PassThru

全部看起来不错时,我将获得一个不错的弹出对话框,其中一个用户帐户可从每行一个帐户中选择。 和名称(完美,我会在稍后选择名称,然后在那里挑选持久时间


$useraccountsall = Get-ChildItem -path \\$env:COMPUTERNAME\c$\users\
$useraccounts = Out-GridView -InputObject $useraccountsall -PassThru -Title "Select from User Accounts"

字段是模式,持久时期,长度 列,例如: 长度,长度,等级,Syncroot,isReadonly,iSfixedSize,Issyngronized,计数 Syncroot似乎包含用户名列表,也许包含更多信息。

问:如何更改第二个代码以显示像第一个的GridView输出?

Basic usage question:

When I run

Get-ChildItem -path \\$env:COMPUTERNAME\c$\users\ | Out-GridView -Title "Select from User Accounts" -PassThru

all looks good, I get a nice pop-up dialog with user accounts to pick from, one account per row. Fields are Mode, LastWriteTime, Length, and Name (perfect, I'll pick out Name and LastWriteTime later, OK there.)


However, when I make it a variable in between, lisk this...

$useraccountsall = Get-ChildItem -path \\$env:COMPUTERNAME\c$\users\
$useraccounts = Out-GridView -InputObject $useraccountsall -PassThru -Title "Select from User Accounts"

I get one row with many unfamiliar columns, like:
Length, LongLength, Rank, SyncRoot, IsReadOnly, IsFixedSize, IsSynchronized, Count
SyncRoot seems to contain the list of usernames, and maybe more info.

Q: How do I change the second code to show GridView output like the first?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

并安 2025-02-03 07:16:14

谢谢Santiago Squarzon!得到它,跳过-utputObject,只需将其输入即可。

$useraccounts = $useraccountsall | Out-GridView -PassThru -Title "Select from User Accounts"

Thank you Santiago Squarzon! Got it, skip -InputObject, just pipe it in.

$useraccounts = $useraccountsall | Out-GridView -PassThru -Title "Select from User Accounts"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文