1

我正在使用以下脚本根据名称、大小、上次写入时间和版本比较 2 个 DLL 文件。这些文件存储在远程服务器上。我的脚本运行良好,但耗时太长。有没有办法优化我的脚本?

function dll_compare {
    param($path1,$path2) 

    $first = Get-ChildItem -Path $path1 -Filter *.dll
    $second =  Get-ChildItem -Path $path2 -Filter *.dll

    $diff = Compare-Object -ReferenceObject $first -DifferenceObject $second -Property Name, Length, LastWriteTime, VersionInfo -PassThru  | Select Name, Length, LastWriteTime, sideindicator,@{n="VersionInfo";e= { $_.VersionInfo.Productversion }}
    $diff
}
4

0 回答 0