Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. run remote against a list of computers to clean all computers in the list
  3. file.txt contents:
  4. pcname1
  5. pcname2
  6. pcname3
  7. #>
  8. $computerList = "\\path\to\file.txt"
  9. $workstations = (get-content $computerList)
  10. #rename profile folder
  11. foreach ($computer in $workstations){
  12.     write-output "-working on $computer"
  13.     $folders = get-childitem "\\$computer\c$\users"
  14.         foreach ($folder in $folders){
  15.             $currentLoc = $folder.fullname
  16.             write-output "-- working in $currentLoc on $computer"
  17.             if (test-path \\$computer\c$\users\$folder\Appdata\Roaming\Imagenow){
  18.                
  19.                 rename-item -path "\\$computer\c$\users\$folder\Appdata\Roaming\Imagenow" -newname  "\\$computer\c$\users\$folder\Appdata\Roaming\Imagenow67"
  20.             }
  21.         }
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement