导出为CSV仅返回字符串长度 [英] Export to CSV only returning string length

查看:132
本文介绍了导出为CSV仅返回字符串长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将该脚本导出到CSV文件,它仅列出字符串长度,而不列出我尝试提取的电子邮件.

I'm trying to get this script to export to a CSV file, it only lists the string length and not the emails i am trying to pull.

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).

Export-Csv expects to receive an object, you've given it a string so it's giving you the properties of that string in the output file (that is, Length).

拖放-ExpandProperty会没事的.

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

这篇关于导出为CSV仅返回字符串长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆