Я создал скрипт powershell для поиска mp3-файлов на моей рабочей станции. Это успешно на моей рабочей станции, как я могу запустить это на моей сети из 80 рабочих станций?

$strComputers = Get-Content -Path "C:\ARM\computernames.txt"
[bool]$firstOutput = $true
foreach($strComputer in $strComputers)
{
$colFiles = Get-Wmiobject -namespace "root\CIMV2" `
-computername $strComputer `
-Query "Select * from CIM_DataFile `
Where Extension = 'mp3'"
foreach ($objFile in $colFiles)
{
if($objFile.FileName -ne $null)
{
$filepath = $objFile.Drive + $objFile.Path + $objFile.FileName + "." `
+ $objFile.Extension;
$query = "ASSOCIATORS OF {Win32_LogicalFileSecuritySetting='" `
+ $filepath `
+ "'} WHERE AssocClass=Win32_LogicalFileOwner ResultRole=Owner"

$colOwners = Get-Wmiobject -namespace "root\CIMV2" `
-computername $strComputer `
-Query $query
$objOwner = $colOwners[0]
$user = $objOwner.ReferencedDomainName + "\" + $objOwner.AccountName
$output = $strComputer + "," + $filepath + "," + $user + "," + $objFile.FileSize/1KB + "," + $objFile.LastModified
if($firstOutput)
{
Write-output $output | Out-File -Encoding ascii -filepath "C:\ARM\pstdetails.csv"
$firstOutput = $false
}
else
{
Write-output $output | Out-File -Encoding ascii -filepath "C:\ARM\pstdetails.csv" -append
}
}
}
}

0