Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 仅导出为CSV返回字符串长度_Powershell_Export To Csv - Fatal编程技术网

Powershell 仅导出为CSV返回字符串长度

Powershell 仅导出为CSV返回字符串长度,powershell,export-to-csv,Powershell,Export To Csv,我正试图让这个脚本导出到CSV文件,它只列出了字符串长度,而不是我试图拉的电子邮件 Get-ADGroup -filter {name -like 'Security Group'} | Get-ADGroupMember -Recursive | Get-ADUser -Properties Mail | select -ExpandProperty Mail | Export-Csv -NoType MyCSVfile1.csv Export Csv希望接

我正试图让这个脚本导出到CSV文件,它只列出了字符串长度,而不是我试图拉的电子邮件

Get-ADGroup -filter {name -like 'Security Group'} | 
    Get-ADGroupMember -Recursive |
    Get-ADUser -Properties Mail |
    select -ExpandProperty Mail |
    Export-Csv -NoType MyCSVfile1.csv

Export Csv
希望接收一个对象,您给了它一个字符串,因此它在输出文件中为您提供了该字符串的属性(即,
Length

放下
-ExpandProperty
,一切都会好起来的

Get-ADGroup -filter {name -like 'Security Group'} |
    Get-ADGroupMember -Recursive |
    Get-ADUser -Properties Mail |
    Select Mail |
    Export-Csv -NoType MyCSVfile1.csv

Export Csv
希望接收一个对象,您给了它一个字符串,因此它在输出文件中为您提供了该字符串的属性(即,
Length

放下
-ExpandProperty
,一切都会好起来的

Get-ADGroup -filter {name -like 'Security Group'} |
    Get-ADGroupMember -Recursive |
    Get-ADUser -Properties Mail |
    Select Mail |
    Export-Csv -NoType MyCSVfile1.csv

否则,只需将值列表写入一个文件:
…|选择-Expand Mail | Set Content MyCSVfile1.csv
。否则只需将值列表写入一个文件:
。|选择-展开邮件|设置内容MyCSVfile1.csv
。哇,我感觉自己像个傻瓜。非常感谢你!哇,我觉得自己像个傻瓜。非常感谢你!