Dear All,
I am try to run a power shell script on my file server to move old user's file to another place.
I tested below script ,it can run succseful one Windows 8.1 environment .
But it can't run when I copy it to windows server 2008 R2 file server.
I already add feature for Active directory powershell but still can't.
It never show error message,i have no hints to solve.
Would you mind please help?
Import-Module ActiveDirectory $users = Get-Content C:\list\users.txt $oldpath = '\\server\c$\temp' $newpath = '\\server\c$\20150731' $domain = 'domain' foreach ($user in $users) { $folders = Get-ChildItem $oldpath foreach ($folder in $folders) { $acl = Get-Acl $folder.Fullname if ($acl.Owner -eq "$domain\$user") { Robocopy "$($folder.Fullname)" "$newpath\$user" /SEC /MAXLAD:30 /UNILOG+:robocopylog.txt } } }
- Edited by Anthony Tse .L.F 42 minutes ago