I am new to PowerShell and have done a few hours of searching and reading but just cant get this.
I have built a script to copy a file from one location to multiple users home directory folder based on a list of users.
However, I would like to have this script work so that it will copy the file to users home directory IF they are a member of an OU.
Here is what I have so far. Any help would be greatly appreciated.
$Source = '\\file-server-02\Public\School Dynamics'$users = Get-Content '\\FCA_FILE_SERVER\Users\FCA-IT\PowerShell\Copy Files\TeacherList.txt'
$SchoolDynamics = 'School Dynamics'
$dbfile = 'School Database Network.mde'
foreach ($i in $users)
{Remove-Item \\FCA_FILE_SERVER\Users\$i\$SchoolDynamics}
Start-Sleep -s 10
foreach ($i in $users)
{Copy-Item $Source -Destination \\FCA_FILE_SERVER\Users\$i -recurse}