Hello,
need help with little script, now i work with this (manualy)
$text = Get-Content D:\move.txt
$dir = Get-ChildItem D:\Old
foreach ($item in $text) {
foreach ($folder in $dir) {
if ($folder.name -like $item) {
Move-Item "D:\Old\$item" 'D:\Test'
Write-Host "Folder $item moved successfully"
[array]$totalitems += $item
break
}
}
}
I need a script to seek users in the OU ($user = get-aduser -Filter * -SearchBase "OU=TEST,OU=Lab,DC=corp,DC=firma,DC=cz") then used their sAMAccountName, to move folder with name same as user samaccountname.
example:
samaccountname: test8
folder: D:\Old\test8
Thank you for your response,
Jiri