我该如何改变:
Search-ADAccount -AccountExpiring -UsersOnly -TimeSpan 14.00:00:00 |
Get-ADUser -Properties Manager,AccountExpirationDate,LastLogonDate,Givenname |
Select-Object Name, Givenname, AccountExpirationDate, LastLogonDate,
SamAccountName, @{Name="Manager";Expression={
$_.Manager | Get-ADUser -Properties emailaddress |
Select-Object -ExpandProperty emailaddress
}}
这样我就可以得到经理的#34;"名字也是?我试着添加:
@{Name="Manager";Expression={
$_.Manager | Get-Aduser -properties GivenName |
Select-Object -ExpandProperty GivenName
}
但脚本提示我输入。我无法弄清楚为什么会这样:
Search-ADAccount -AccountExpiring -UsersOnly -TimeSpan 14.00:00:00 |
Get-ADUser -Properties Manager, AccountExpirationDate, LastLogonDate, Givenname |
Select-Object Name, Givenname, AccountExpirationDate, LastLogonDate,
SamAccountName, @{Name="Manager";Expression={
$_.Manager | Get-Aduser -Properties emailaddress |
Select-Object -ExpandProperty emailaddress
}, @{Name="GivenName";Expression={
$_.Manager | Get-Aduser -Properties GivenName |
Select-Object -ExpandProperty GivenName
}}