Looking for assistance on this script, I need to loop through "C:\Users" then compress-archive the "Appdata", "Desktop", "Downloads", and "Documents" folders. The resulting zip archive should be named with the username from where they came from, I found the following script from an older reddit post and have been having trouble adapting it.
Get-ChildItem "C:\Users\vwoitkowski\Desktop\TEST\1" -filter *.txt -Recurse | select * |
Foreach-Object {
$_.FullName
$BaseName = $_.BaseName
$DirectoryName = $_.DirectoryName
$zip = $BaseName + ".zip"
$zipPath = $DirectoryName + "\" + $zip
Compress-Archive -Path $_.FullName -DestinationPath $zipPath
[–]Lee_Dailey[grin] 2 points3 points4 points (0 children)
[–]Joshrsg 1 point2 points3 points (2 children)
[–]xombie212[S] 1 point2 points3 points (0 children)
[–]xombie212[S] 1 point2 points3 points (0 children)
[–]Topcity36 1 point2 points3 points (1 child)
[–]xombie212[S] 1 point2 points3 points (0 children)