我寫了一個腳本,將文件複製到「所有用戶」桌面或「公共桌面」PowerShell的確定遠程計算機OS
但是我們有一個混合環境。有些人使用的是Windows XP和其他人正在使用Windows 7
$SOURCE = "I:\Path\To\Folder\*"
$DESTINATION7 = "c$\Users\Public\Desktop"
$DESTINATIONXP = "c$\Documents and Settings\All Users\Desktop"
$computerlist = Get-Content I:\Path\To\File\computer-list.csv
$results = @()
$filenotthere = @()
$filesremoved = @()
foreach ($computer in $computerlist) {
if((Test-Connection -Cn $computer -BufferSize 16 -Count 1 -ea 0 -quiet))
{
Write-Host "\\$computer\$DESTINATION\"
Copy-Item $SOURCE "\\$computer\$DESTINATION\" -Recurse -force
} else {
$details = @{
Date = get-date
ComputerName = $Computer
Destination = $Destination
}
$results += New-Object PSObject -Property $details
$results | export-csv -Path I:\Path\To\logs\offline.txt -NoTypeInformation -Append
}
}
[I如何確定一個遠程計算機的OS?](http://superuser.com/q/323238/241386) –