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. 
-------------------------------------------------------------------------------------------------
1
2
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   [ + ] Show Comments

Comments

Please log in to comment

Answers

0
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
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share