<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://znil.net/index.php?action=history&amp;feed=atom&amp;title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen</id>
	<title>PowerShell Userhome Benutzerordner Rechte neu setzen - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://znil.net/index.php?action=history&amp;feed=atom&amp;title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen"/>
	<link rel="alternate" type="text/html" href="https://znil.net/index.php?title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen&amp;action=history"/>
	<updated>2026-05-05T20:57:51Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in znilwiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://znil.net/index.php?title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen&amp;diff=13670&amp;oldid=prev</id>
		<title>BLinz: /* Lösung */</title>
		<link rel="alternate" type="text/html" href="https://znil.net/index.php?title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen&amp;diff=13670&amp;oldid=prev"/>
		<updated>2023-07-20T11:27:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Lösung&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 20. Juli 2023, 13:27 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l13&quot;&gt;Zeile 13:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 13:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Das Skript muss auf einem System ausgeführt werden auf dem die PowerShell-Erweiterungen für das Active Directory installiert sind,&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Das Skript muss auf einem System ausgeführt werden auf dem die PowerShell-Erweiterungen für das Active Directory installiert sind,&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;das setzen der Rechte funktioniert auch per UNC Pfad.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;das setzen der Rechte funktioniert auch per UNC Pfad.&amp;lt;br&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Ihr müsst &#039;&#039;&#039;&#039;&#039;TESTDOMAIN&#039;&#039;&#039;&#039;&#039; überall anpassen und ggf. die Auswahl der Benutzer und Gruppen welche hinzugefügt werden.&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l39&quot;&gt;Zeile 39:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 40:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace1 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;VORDEFINIERT\Administratoren&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace1 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;VORDEFINIERT\Administratoren&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace1)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace1)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace2 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ALEYMANN&lt;/del&gt;\&quot; + &quot;Domänen-Admins&quot;), &quot;FullControl&quot;, &quot;ContainerInherit,ObjectInherit&quot;, &quot;none&quot;, &quot;Allow&quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace2 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TESTDOMAIN&lt;/ins&gt;\&quot; + &quot;Domänen-Admins&quot;), &quot;FullControl&quot;, &quot;ContainerInherit,ObjectInherit&quot;, &quot;none&quot;, &quot;Allow&quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace2)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace2)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace3 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;SYSTEM&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace3 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;SYSTEM&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l45&quot;&gt;Zeile 45:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 46:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace4 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;ERSTELLER-BESITZER&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;InheritOnly&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace4 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;ERSTELLER-BESITZER&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;InheritOnly&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace4)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace4)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace5 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ALEYMANN&lt;/del&gt;\&quot; + &quot;Administrator&quot;), &quot;FullControl&quot;, &quot;ContainerInherit,ObjectInherit&quot;, &quot;none&quot;, &quot;Allow&quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace5 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TESTDOMAIN&lt;/ins&gt;\&quot; + &quot;Administrator&quot;), &quot;FullControl&quot;, &quot;ContainerInherit,ObjectInherit&quot;, &quot;none&quot;, &quot;Allow&quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace5)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace5)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace6 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ALEYMANN&lt;/del&gt;\&quot; + &quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;DL_AL_Global_Admins&lt;/del&gt;&quot;), &quot;FullControl&quot;, &quot;ContainerInherit,ObjectInherit&quot;, &quot;none&quot;, &quot;Allow&quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_ace6 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TESTDOMAIN&lt;/ins&gt;\&quot; + &quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TESTDOMAIN_Global_Admins&lt;/ins&gt;&quot;), &quot;FullControl&quot;, &quot;ContainerInherit,ObjectInherit&quot;, &quot;none&quot;, &quot;Allow&quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace6)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl.AddAccessRule($o_ace6)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         # Benutzer hinzufügen deren Name zum Ordner passt&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         # Benutzer hinzufügen deren Name zum Ordner passt&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l66&quot;&gt;Zeile 66:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 67:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         # Ändert Besitzer für alle Dateien und Unterordner (aber nicht dem Stammordner)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         # Ändert Besitzer für alle Dateien und Unterordner (aber nicht dem Stammordner)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $myName = $s_folder.Name&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $myName = $s_folder.Name&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         icacls $s_folder.FullName /setowner &quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ALEYMANN&lt;/del&gt;\$myName&quot; /t&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         icacls $s_folder.FullName /setowner &quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;TESTDOMAIN&lt;/ins&gt;\$myName&quot; /t&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         Set-Acl -Path $s_folder.FullName -AclObject $o_acl&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         Set-Acl -Path $s_folder.FullName -AclObject $o_acl&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl = &amp;quot;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;         $o_acl = &amp;quot;&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l78&quot;&gt;Zeile 78:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 79:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Kommentare==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Kommentare==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;comments /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;comments /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>BLinz</name></author>
	</entry>
	<entry>
		<id>https://znil.net/index.php?title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen&amp;diff=13669&amp;oldid=prev</id>
		<title>BLinz: Die Seite wurde neu angelegt: „&lt;u&gt;&#039;&#039;&#039;Changelog:&#039;&#039;&#039;&lt;/u&gt;&lt;br&gt; * 20.07.2023 erste Version ---- ==Problem== Ich habe die Homelaufwerk-Ordner aller Benutzer an einen neuen Ort kopiert (per robocopy).&lt;br&gt; Da die Rechte vorher schon nicht sauber waren habe ich diese extra ohne ACL kopiert (&lt;code&gt;/COPY:DATO&lt;/code&gt;).&lt;br&gt; Nun hatte ich 650 Ordner die hießen wie der Anmeldename der Benutzer (&lt;code&gt;%USERNAME%&lt;/code&gt;), aber ohne Rechte. &lt;br&gt; ---- ==Lösung== Ein Powershellskript welches die Ordnerl…“</title>
		<link rel="alternate" type="text/html" href="https://znil.net/index.php?title=PowerShell_Userhome_Benutzerordner_Rechte_neu_setzen&amp;diff=13669&amp;oldid=prev"/>
		<updated>2023-07-20T11:25:09Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „&amp;lt;u&amp;gt;&amp;#039;&amp;#039;&amp;#039;Changelog:&amp;#039;&amp;#039;&amp;#039;&amp;lt;/u&amp;gt;&amp;lt;br&amp;gt; * 20.07.2023 erste Version ---- ==Problem== Ich habe die Homelaufwerk-Ordner aller Benutzer an einen neuen Ort kopiert (per robocopy).&amp;lt;br&amp;gt; Da die Rechte vorher schon nicht sauber waren habe ich diese extra ohne ACL kopiert (&amp;lt;code&amp;gt;/COPY:DATO&amp;lt;/code&amp;gt;).&amp;lt;br&amp;gt; Nun hatte ich 650 Ordner die hießen wie der Anmeldename der Benutzer (&amp;lt;code&amp;gt;%USERNAME%&amp;lt;/code&amp;gt;), aber ohne Rechte. &amp;lt;br&amp;gt; ---- ==Lösung== Ein Powershellskript welches die Ordnerl…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;u&amp;gt;&amp;#039;&amp;#039;&amp;#039;Changelog:&amp;#039;&amp;#039;&amp;#039;&amp;lt;/u&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
* 20.07.2023 erste Version&lt;br /&gt;
----&lt;br /&gt;
==Problem==&lt;br /&gt;
Ich habe die Homelaufwerk-Ordner aller Benutzer an einen neuen Ort kopiert (per robocopy).&amp;lt;br&amp;gt;&lt;br /&gt;
Da die Rechte vorher schon nicht sauber waren habe ich diese extra ohne ACL kopiert (&amp;lt;code&amp;gt;/COPY:DATO&amp;lt;/code&amp;gt;).&amp;lt;br&amp;gt;&lt;br /&gt;
Nun hatte ich 650 Ordner die hießen wie der Anmeldename der Benutzer (&amp;lt;code&amp;gt;%USERNAME%&amp;lt;/code&amp;gt;), aber ohne Rechte.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
==Lösung==&lt;br /&gt;
Ein Powershellskript welches die Ordnerliste einliest, immer einen passenden Benutzer aus dem Active Directory sucht und die Rechte neu setzt.&amp;lt;br&amp;gt;&lt;br /&gt;
Der Benutzer hat hinterher Vollzugriff und ist Besitzer von allen.&amp;lt;br&amp;gt;&lt;br /&gt;
Das Skript muss auf einem System ausgeführt werden auf dem die PowerShell-Erweiterungen für das Active Directory installiert sind,&amp;lt;br&amp;gt;&lt;br /&gt;
das setzen der Rechte funktioniert auch per UNC Pfad.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;powershell&amp;quot;&amp;gt;&lt;br /&gt;
# Alle Verzeichnisse im Pfad abarbeiten, die AD-Gruppen dazu suchen und die Berechtigungen setzen&lt;br /&gt;
$s_CurrentPath = &amp;quot;\\FILESERVER\D$\Userhome\&amp;quot;&lt;br /&gt;
cls&lt;br /&gt;
$i_Counter = 0&lt;br /&gt;
# Liste der Ordnernamen holen&lt;br /&gt;
$a_ListFolders = Get-ChildItem -Path $s_CurrentPath -Directory -Force -ErrorAction SilentlyContinue | Select-Object Name,FullName&lt;br /&gt;
foreach($s_folder in $a_ListFolders) {&lt;br /&gt;
    $i_Counter = $i_Counter + 1&lt;br /&gt;
    if ( (-not ($s_folder.Name -like &amp;quot;*System Volume Information*&amp;quot;)) -and (-not ($s_folder.Name -like &amp;quot;*RECYCLE.BIN*&amp;quot;)) -and (-not ($s_folder.Name -like &amp;quot;*DfsRoot*&amp;quot;)) ) {&lt;br /&gt;
        $s_GroupSearch1 = $s_folder.Name&lt;br /&gt;
        $s_GroupSearch2 = &amp;quot;Laufwerk-&amp;quot; + $s_folder.Name + &amp;quot;-[A-Z]-*&amp;quot;&lt;br /&gt;
        Write-Host &amp;quot;-----------------------------------------------------------------------------------------------------&amp;quot;&lt;br /&gt;
        Write-Host &amp;quot;Benutzerordner für&amp;quot; $s_folder.FullName&lt;br /&gt;
        # Rechte des Ordners holen&lt;br /&gt;
        $o_acl = Get-Acl -Path $s_folder.FullName&lt;br /&gt;
        # Vererbung deaktivieren&lt;br /&gt;
        $o_acl.SetAccessRuleProtection($true, $false)&lt;br /&gt;
        # vorhandene Rechte entfernen&lt;br /&gt;
        #Write-Host $o_acl.Access&lt;br /&gt;
        $o_acl.Access | ForEach-Object { $o_acl.RemoveAccessRule($_) | Out-Null }&lt;br /&gt;
        #$o_acl.Access | ForEach-Object { $o_acl.RemoveAccessRule($_) | Out-Null }&lt;br /&gt;
        # Administratoren hinzufügen&lt;br /&gt;
        $o_ace1 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;VORDEFINIERT\Administratoren&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
        $o_acl.AddAccessRule($o_ace1)&lt;br /&gt;
        $o_ace2 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&amp;quot;ALEYMANN\&amp;quot; + &amp;quot;Domänen-Admins&amp;quot;), &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
        $o_acl.AddAccessRule($o_ace2)&lt;br /&gt;
        $o_ace3 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;SYSTEM&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
        $o_acl.AddAccessRule($o_ace3)&lt;br /&gt;
        $o_ace4 = New-Object System.Security.Accesscontrol.FileSystemAccessRule (&amp;quot;ERSTELLER-BESITZER&amp;quot;, &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;InheritOnly&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
        $o_acl.AddAccessRule($o_ace4)&lt;br /&gt;
        $o_ace5 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&amp;quot;ALEYMANN\&amp;quot; + &amp;quot;Administrator&amp;quot;), &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
        $o_acl.AddAccessRule($o_ace5)&lt;br /&gt;
        $o_ace6 = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&amp;quot;ALEYMANN\&amp;quot; + &amp;quot;DL_AL_Global_Admins&amp;quot;), &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
        $o_acl.AddAccessRule($o_ace6)&lt;br /&gt;
        # Benutzer hinzufügen deren Name zum Ordner passt&lt;br /&gt;
        # $a_ListDriveGroups = Get-ADGroup -Filter &amp;#039;Name -like $s_GroupSearch1&amp;#039; | Where-Object Name -like $s_GroupSearch2 | Select-Object Name&lt;br /&gt;
        $a_ListDriveGroups = Get-ADUser $s_GroupSearch1 | Select-Object Name&lt;br /&gt;
        if ( $a_ListDriveGroups -eq $null ) {&lt;br /&gt;
            Write-Host $s_folder.Name + &amp;quot; wurde nicht gefunden im Active Directory&amp;quot;&lt;br /&gt;
        } else {&lt;br /&gt;
            foreach($DriveGroup in $a_ListDriveGroups) {&lt;br /&gt;
                Write-Host $DriveGroup.Name&lt;br /&gt;
                $o_aceDriveGroup = New-Object System.Security.Accesscontrol.FileSystemAccessRule ((&amp;quot;ALEYMANN\&amp;quot; + $s_GroupSearch1), &amp;quot;FullControl&amp;quot;, &amp;quot;ContainerInherit,ObjectInherit&amp;quot;, &amp;quot;none&amp;quot;, &amp;quot;Allow&amp;quot;)&lt;br /&gt;
                $o_acl.AddAccessRule($o_aceDriveGroup)&lt;br /&gt;
                # und zum Besitzer machen (klappt aber nur beim Hauptordner)&lt;br /&gt;
                $o_acl.SetOwner([System.Security.Principal.NTAccount] $s_GroupSearch1)&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    &lt;br /&gt;
        # Ändert Besitzer für alle Dateien und Unterordner (aber nicht dem Stammordner)&lt;br /&gt;
        $myName = $s_folder.Name&lt;br /&gt;
        icacls $s_folder.FullName /setowner &amp;quot;ALEYMANN\$myName&amp;quot; /t&lt;br /&gt;
        Set-Acl -Path $s_folder.FullName -AclObject $o_acl&lt;br /&gt;
        $o_acl = &amp;quot;&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
    # zum Testen nur eine bestimmte Anzahl von Benutzern = Durchläufe durchführen&lt;br /&gt;
    if ( $i_Counter -eq 15 ) {&lt;br /&gt;
        # Nächste Zeile auskommentieren um nach 15 Benutzern zu stoppen&lt;br /&gt;
        #break&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
----&lt;br /&gt;
==Kommentare==&lt;br /&gt;
&amp;lt;comments /&amp;gt;&lt;/div&gt;</summary>
		<author><name>BLinz</name></author>
	</entry>
</feed>