سلام دوستان آیا راهی هسا که بشه که NTFS Permissions هایی که برای یک کاربر ست شده را به کاربر دیگری کپی کرد؟
Printable View
سلام دوستان آیا راهی هسا که بشه که NTFS Permissions هایی که برای یک کاربر ست شده را به کاربر دیگری کپی کرد؟
سلام دوست عزیز
از دستور xcopy میتونی استفاده کنی
[QUOTE=m80x08m;463743]سلام دوست عزیز
از دستور xcopy میتونی استفاده کنی[/QUOTE]
ببینید من میخوام کل NTFS Permission هایی که روی فولدرهای گوناگون در جاهای گوناگون شبکه به یک USer دادم رو به USer دیگری هم بدم..قصد کپی کردن فولدره ا رو ندارم..
دوست عزیز منتقل کردن member ship ها رو با استفاده از powershel با این دستور میشه منتقل کرد
[COLOR=green][FONT=Courier New]Script to copy group memberships from a source user to a target user.[/FONT][/COLOR]
[COLOR=blue][FONT=Courier New]Param[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Source[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New], [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New])[/FONT][/COLOR]
[COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Source[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-ne[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Null[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-and[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-eq[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Null[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New])[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]{[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] Read-Host [/FONT][/COLOR][COLOR=#A31515][FONT=Courier New]"Enter logon name of target user"[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]}[/FONT][/COLOR]
[COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Source[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-eq[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Null[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New])[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]{[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Source[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] Read-Host [/FONT][/COLOR][COLOR=#A31515][FONT=Courier New]"Enter logon name of source user"[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] Read-Host [/FONT][/COLOR][COLOR=#A31515][FONT=Courier New]"Enter logon name of target user"[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]}[/FONT][/COLOR]
[COLOR=green][FONT=Courier New]# Retrieve user information, including group memberships.[/FONT][/COLOR]
[COLOR=#FF4500][FONT=Courier New]$SourceUser[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] Get-ADUser [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Source[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-Properties[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] memberOf[/FONT][/COLOR]
[COLOR=#FF4500][FONT=Courier New]$TargetUser[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] Get-ADUser [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-Properties[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] memberOf[/FONT][/COLOR]
[COLOR=green][FONT=Courier New]# Hash table of source user groups.[/FONT][/COLOR]
[COLOR=#FF4500][FONT=Courier New]$List[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] @{}[/FONT][/COLOR]
[COLOR=green][FONT=Courier New]#Enumerate direct group memberships of source user.[/FONT][/COLOR]
[COLOR=blue][FONT=Courier New]ForEach[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$SourceDN[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=blue][FONT=Courier New]In[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$SourceUser[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New].memberOf)[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]{[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Add this group to hash table.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$List[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New].Add([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$SourceDN[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New], [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$True[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New])[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Bind to group object.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$SourceGroup[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]=[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New][[/FONT][/COLOR][COLOR=teal][FONT=Courier New]ADSI[/FONT][/COLOR][COLOR=gray][FONT=Courier New]][/FONT][/COLOR][COLOR=#A31515][FONT=Courier New]"LDAP://$SourceDN"[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Check if target user is already a member of this group.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$SourceGroup[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New].IsMember([/FONT][/COLOR][COLOR=#A31515][FONT=Courier New]"LDAP://"[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]+[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$TargetUser[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New].distinguishedName) [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-eq[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New][/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$False[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New])[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] {[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Add the target user to this group.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] Add-ADGroupMember [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-Identity[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$SourceDN[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-Members[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] }[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]}[/FONT][/COLOR]
[COLOR=green][FONT=Courier New]# Enumerate direct group memberships of target user.[/FONT][/COLOR]
[COLOR=blue][FONT=Courier New]ForEach[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$TargetDN[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=blue][FONT=Courier New]In[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$TargetUser[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New].memberOf)[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]{[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Check if source user is a member of this group.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] ([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$List[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New].ContainsKey([/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$TargetDN[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New]) [/FONT][/COLOR][COLOR=gray][FONT=Courier New]-eq[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$False[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New])[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] {[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Source user not a member of this group.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=green][FONT=Courier New]# Remove target user from this group.[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] Remove-ADGroupMember [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$TargetDN[/FONT][/COLOR][COLOR=#2A2A2A][FONT=Courier New] [/FONT][/COLOR][COLOR=#FF4500][FONT=Courier New]$Target[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New] }[/FONT][/COLOR]
[COLOR=#2A2A2A][FONT=Courier New]}
ولی درباره فولدر چیزی پیدا نکردم
خوشحال میشم اگه چیز جدیدی پیدا کنیم برای این کار
[/FONT][/COLOR]