title: Powershell determine the remote computer OS
body: <p>I wrote a script to copy files to the "All Users" desktop or "Public Desktop"</p>
  
  <p>However we have a mixed environment. Some people are using Windows XP and other people are using Windows 7.</p>
  
  <pre><code>$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
      }    
  }
  </code></pre>