需要帮助脚本,无法添加Export-CSV Cmdlet。 [英] Need Help With script, Cannot add Export-CSV Cmdlet.

查看:87
本文介绍了需要帮助脚本,无法添加Export-CSV Cmdlet。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在尝试将Export-CSV cmdlet添加到此脚本

Hi guys, I am trying to add Export-CSV cmdlet to this script

但这不起作用,

### Get all AD Computers ###
Get-ADComputer -Filter * | select name >> .\file.txt
### This command  clean white spaces / empty lines in the txt file ###
(Get-Content .\file.txt) | Foreach {$_.TrimEnd()} | where {$_ -ne ""} | Set-Content file.txt    
### Get Time and date from computers in the txt file ###
$servers = (Get-Content .\file.txt)
ForEach ($server in $servers) {
    $time = ([WMI]'').ConvertToDateTime((gwmi win32_operatingsystem -computername $server).LocalDateTime)
    $server + '  ' + $time
} | Eport-CSV -Path .\File.csv -NoType


 



Zvi Alikyan

 


Zvi Alikyan

推荐答案

嘿Zvi,

昨晚我刚经历了同样的困境! 这是关于.CSV和powershell的非常有用的帖子。

I just went through this same predicament last night!  Here's a very helpful post about the .CSV and powershell.

http://community.spiceworks.com/scripts/show/3385-array-to-csv

http://community.spiceworks.com/scripts/show/3385-array-to-csv

让我看看我是否可以放在一起(在大约半小时内到这里工作)一个可以做你想做的快速脚本。

Let me see if I can put together (gotta go to work here in about 1/2 hour) a quick script that will do what you want.

BRB

杰夫


这篇关于需要帮助脚本,无法添加Export-CSV Cmdlet。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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