使用CTRL + C时,无法从网格窗口复制数据。它只是关闭窗口。 我的代码:
Get-ADUser -Filter * | ForEach-Object -Process {
Add-Member -InputObject $_ -Name TerminalServicesProfilePath -Force -Membertype NoteProperty -Value (([ADSI]"LDAP://$($_.DistinguishedName)").TerminalServicesProfilePath) -PassThru
} | Select-Object -Property SamAccountName, TerminalServicesProfilePath | Out-GridView
答案 0 :(得分:2)
这可能会或可能不会解决您的问题,但是请不要使用Add-Member
(在这种情况下用途有限),请尝试在管道中使用计算所得的属性:
Get-ADUser -Filter * | Select-Object -Property @(
'SamAccountName'
@{
Label = 'TerminalServicesProfilePath'
Expression = { ([adsi]"LDAP://$($_.DistinguishedName)").TerminalServicesProfilePath }
}
) | Out-GridView
如果您是在脚本中使用此功能或类似性质的内容,则问题是使用Wait
上的Out-GridView
开关 not 。 See the documentation here.