/build/static/layout/Breadcrumb_cap_w.png

Powershell script to append a text file on local user profiles

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

Answers (1)

Posted by: EdT 8 years ago
Red Belt
0
Isn't line 2 incorrect, as the path should be C:\users\$user\Appdata\Roaming\...etc
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ