从SharePoint的Powershell导入CSV文件

aston_zh

有没有办法从网站导入CSV并在PowerShell中使用它?使用Import-CsvCmdlet时,出现以下错误:

$FilePath = "http://sharepoint.com/mydocuments/serverlist.csv"
$serverList = Import-Csv $FilePath -Delimiter ";"


Import-Csv : Cannot find drive. A drive with the name 'http' does not exist.
At line:2 char:15
+ $serverList = Import-Csv $FilePath -Delimiter ";"
+               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (http:String) [Import-Csv], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.ImportCsvCommand
拉夫

首先下载CSV:

$FilePath = "http://sharepoint.com/mydocuments/serverlist.csv"
$localPath = "C:\temp\serverlist.csv"
$wc = New-Object System.Net.Webclient
$wc.DownloadFile($FilePath, $localPath)
$serverList = Import-Csv $localPath -Delimiter ";"

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章