みなさんこんにちは: これは私がやろうとしていることです.... 結果セット(例: listoffailedcomputers.txt)を取得し、結果セット内のすべての項目に対してコピー コマンドを実行します。ロジックは、 failedlistofcomputers.txt内のすべてのコンピューターでコピー コマンドを実行して、最終的に、そのフォルダーがそのリストのすべてのコンピューターにローカルにコピーされるようにすることです。これらすべてのコンピューターでリモート コンソールを使用してこれを行うことができますが、効率的ではありません。ありがとうございました。
これが私がこれまでに書いたコードです........
$failedcomputers = gc c:\listoffailedcomputers.txt
foreach ($failedcomputer in $failedcomputers)
{
$failedcomputer | copy-item \\server\patch\*.* -destination c:\patch\
}
そして、これは私が得ているエラーです......
Copy-Item : The input object cannot be bound to any parameters for the command
either because the command does not take pipeline input or the input and its
properties do not match any of the parameters that take pipeline input.
At copypatchtofailedcomputers.ps
+ $failedcomputer | copy-item <<<< \\server\patch\ -destination c:\patch\
+ CategoryInfo : InvalidArgument: (mycomputername:PSObject) [Copy-
Item], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Command
s.CopyItemCommand
ステートメントで $failedcomputer 変数と copy-item コマンドの間のパイプを削除すると、予期しないトークン エラーが発生します。