Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.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中不再可用_Powershell - Fatal编程技术网

指定的网络名称在powershell中不再可用

指定的网络名称在powershell中不再可用,powershell,Powershell,我有一个文本文件中的共享路径列表。我尝试读取每个路径中的文件和文件夹,并使用powershell脚本导出到csv文件。我有一些0 KB的csv文件。 因此,我尝试使用testpath命令测试这种网络路径的存在性。很少有路径显示它存在,但当我尝试使用Dir\sharepath name列出现有路径的目录时,我出现了类似“指定的网络名称不再可用”的错误,为什么 共享下面的代码 foreach ($dir in (Get-Content $infile)) { $outfilecsv='jerin-

我有一个文本文件中的共享路径列表。我尝试读取每个路径中的文件和文件夹,并使用powershell脚本导出到csv文件。我有一些0 KB的csv文件。 因此,我尝试使用testpath命令测试这种网络路径的存在性。很少有路径显示它存在,但当我尝试使用Dir\sharepath name列出现有路径的目录时,我出现了类似“指定的网络名称不再可用”的错误,为什么

共享下面的代码

foreach ($dir in (Get-Content $infile)) {

$outfilecsv='jerin-Download'+'.csv'

Get-ChildItem -Path $dir -Filter *.* -Recurse | Select-Object 

Name,@{Name="Owner";Expression={(Get-ACL $_.fullname).Owner}},CreationTime,@{Name="FileModifiedDate";Expression={$_.LastWriteTime}},

@{Name="FileAccessedDate";Expression={$_.LastAccessTime}},@{Name="Attributes";Expression=

{$_.Attributes}},@{l='ParentPath';e={Split-Path $_.FullName}},

@{Name="DormantFor(days)";Expression={[int]((Get-Date)-$_.LastWriteTime).TotalDays}},

@{N="FileCategory";E={Get-FileSizeCategory($_)}},

@{Name="Size";Expression={if($_.PSIsContainer -eq $True){(New-Object -com  

Scripting.FileSystemObject).GetFolder( $_.FullName).Size} else {$_.Length}}}|

Export-Csv -Path $outfilecsv -Encoding ascii -NoTypeInformation

}
有人能建议吗

谢谢
Jerin

您需要与他人分享您的代码以获得有用的建议。先生,请查看我的代码中编辑的问题。我没有看到测试路径。你是如何检查路径的?