I have 5000 folder under a specific path as /servername/home. I want to rename them by reading the folder names from text file. I tried the below script but it does not work.
Foreach($folder in Get-Content "Z:\rename1.txt") {
Rename-Item -Path "Z:\$folder" -NewName "$folder _old" -Confirm }