I peiced this together but am kind of stuck. The code is placing the items in the root instead of the folder it came from ie if it was in a test folder it is placing it directly in the user folder, I want it to create a test folder and put the item in there. After it has copied the items I would like it to zip up the location. At one point I was thinking I could create a txt file then use that to copy the items but then I got lost.
$PCName = Read-Host "Enter Machine Name"
$User = Read-Host "Enter User Name"
$NAS = "\\<nas>\users\$user"
$Dir = get-childitem \\$PCName\C$\users\$User -force -recurse | where {
$_.extension -match "doc|xls|docx|xlsx|pdf|pst|txt|jpg|tif"} | ForEach {
Copy-Item $_.FullName -Destination $NAS -force -ErrorAction:SilentlyContinue
}
#$Dir | ft fullname | out-file C:\Scripts\logs\FileList\$User.txt
$Dir | format-table name# PowerShell script to list the DLL files under the system32 folder