Hi Guys ,

I hope you are well. I am working on a script that appends a text file on local user profiles but  excludes Admin profiles named "Admin-xxx" and public folder. So far this is what I have but getting no luck. 
ForEach ($user in (Get-ChildItem "C:\Users" -Exclude Public,Admin%)) { Add-Content C:\$user\AppData\Roaming\App\app.txt "Text" }

Any advice will be highly appreciated. Have a nice day.

0 Comments   [ - ] Hide Comments


Please log in to comment

Answer this question or Comment on this question for clarity


Isn't line 2 incorrect, as the path should be C:\users\$user\Appdata\Roaming\...etc
Answered 06/08/2015 by: EdT
Red Belt

Please log in to comment