Hello all,
here i have an example which shows how to get the desktop content from many computers.
A nice feature here is that it gets the desktops of the signed on users. So you won´t grab unnecessary contents.
$Computers = 'localhost' foreach ($Computer in $Computers){ #Gets the logged on user $User = Get-WmiObject win32_logonsession -ComputerName $Computer -Filter "Logontype = '2' or Logontype='11' or logontype='10'" | foreach {Get-WmiObject win32_loggedonuser -ComputerName $Computer -filter "Dependent = '\\\\.\\root\\cimv2:Win32_LogonSession.LogonId=`"$($_.logonid)`"'" | select Antecedent } | foreach { ($_.antecedent.split('"'))[1] + "\" + ($_.antecedent.split('"'))[3] } | Where-Object{$_ -notlike "*DWM*"} | select -unique #Catches Domain name if ($user -like "*\*") { $user = $user.Split('\')[-1] } $searchPath="\\$Computer\C$\Users\$User\Desktop\" Get-ChildItem -Path $searchPath -Recurse }
This logic can also be modified easily for other purposes.
Have fun with it!
~David