File System Slideshow

  1. $root = [ADSI]"LDAP://OU=India,OU=Sites,OU=Acct-Users,DC=corp,DC=Test,DC=com" 
  2. $Srchr = new-object System.DirectoryServices.DirectorySearcher($root
  3. $users = $Srchr.findall() 
  4. foreach ($user in $users
  5. $Path = $user.path 
  6. $Details = [ADSI]"$Path" 
  7. $Details.sAMAccountName 
  8. $FName = $Details.sAMAccountName 
  9. $Path = "D:\Public_Folder\$FName" 
  10. New-Item -Path $Path -type directory | Out-Null 
  11. cacls D:\Public_Folder\$Fname /E /R Users 
  12. cacls D:\Public_Folder\$Fname /E /G rri\"$FName":F 
 
Loading...
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.