<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Set Folder Permissions using a PowerShell script</title>
	<atom:link href="http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/</link>
	<description>Windows PowerShell</description>
	<lastBuildDate>Fri, 03 Feb 2012 09:00:55 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jamiet</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-9723</link>
		<dc:creator>Jamiet</dc:creator>
		<pubDate>Tue, 22 Nov 2011 16:35:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-9723</guid>
		<description>Awesomeness. Thank you.

Note that I had to change this:
Where { $_.Attributes -match &quot;d&quot;}

to this:
Where { $_.Attributes -match &quot;Directory&quot;}

because beforehand it was still picking up some files. I did a cursory investigation and I think it was because those files had a Rea*d*only attribute, but that&#039;s only an assumption. Anyway, it works as desired now - thank you very very much.</description>
		<content:encoded><![CDATA[<p>Awesomeness. Thank you.</p>
<p>Note that I had to change this:<br />
Where { $_.Attributes -match &#8220;d&#8221;}</p>
<p>to this:<br />
Where { $_.Attributes -match &#8220;Directory&#8221;}</p>
<p>because beforehand it was still picking up some files. I did a cursory investigation and I think it was because those files had a Rea*d*only attribute, but that&#8217;s only an assumption. Anyway, it works as desired now &#8211; thank you very very much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-4854</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 18 Feb 2011 16:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-4854</guid>
		<description>Great script – but one “typo” that had me in fits until I found it. In your help text, and in your detail text at the top of this page, you list one of your parameters as “-User”. It should read “-Access”. If you run it with the “-User” flag, nothing happens.</description>
		<content:encoded><![CDATA[<p>Great script – but one “typo” that had me in fits until I found it. In your help text, and in your detail text at the top of this page, you list one of your parameters as “-User”. It should read “-Access”. If you run it with the “-User” flag, nothing happens.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jason</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-4816</link>
		<dc:creator>jason</dc:creator>
		<pubDate>Mon, 24 Jan 2011 22:43:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-4816</guid>
		<description>I can get the script to run just fine on a folder that is off the root, but my issue is, I need to make the change to just one folder that is located in the the Program Files. 

I have no control over this application, I just know that I need to give a user permission access to the venders folder. 

Any advice on how to make this work?

Thanks,</description>
		<content:encoded><![CDATA[<p>I can get the script to run just fine on a folder that is off the root, but my issue is, I need to make the change to just one folder that is located in the the Program Files. </p>
<p>I have no control over this application, I just know that I need to give a user permission access to the venders folder. </p>
<p>Any advice on how to make this work?</p>
<p>Thanks,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathon</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-4514</link>
		<dc:creator>Jonathon</dc:creator>
		<pubDate>Sun, 05 Sep 2010 10:32:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-4514</guid>
		<description>Nice script thanks. just a quick one...if i wanted to use a CSV file to provide a list of usernames that would then be created by your script how would i go about this?</description>
		<content:encoded><![CDATA[<p>Nice script thanks. just a quick one&#8230;if i wanted to use a CSV file to provide a list of usernames that would then be created by your script how would i go about this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Munib</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-4441</link>
		<dc:creator>Munib</dc:creator>
		<pubDate>Tue, 10 Aug 2010 13:00:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-4441</guid>
		<description>Hi,

I am new to poweshell scripting, i wanted to set the permissionss of local users/group remotely on some machines.

Just wanted to know whether the remore/target machine requires .net framwork for this script to work.

Thanks...Munib</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am new to poweshell scripting, i wanted to set the permissionss of local users/group remotely on some machines.</p>
<p>Just wanted to know whether the remore/target machine requires .net framwork for this script to work.</p>
<p>Thanks&#8230;Munib</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asrhaf</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-3974</link>
		<dc:creator>Asrhaf</dc:creator>
		<pubDate>Wed, 20 Jan 2010 18:08:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-3974</guid>
		<description>Awesome. It works fine for remote computer too.</description>
		<content:encoded><![CDATA[<p>Awesome. It works fine for remote computer too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wacky Quince</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-3972</link>
		<dc:creator>Wacky Quince</dc:creator>
		<pubDate>Mon, 11 Jan 2010 18:01:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-3972</guid>
		<description>useful script. thank you</description>
		<content:encoded><![CDATA[<p>useful script. thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Resonant Hydrogen</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-3971</link>
		<dc:creator>Resonant Hydrogen</dc:creator>
		<pubDate>Mon, 11 Jan 2010 18:01:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-3971</guid>
		<description>Sweet simple working one buddy !! Thanks !!</description>
		<content:encoded><![CDATA[<p>Sweet simple working one buddy !! Thanks !!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: edthefixer</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-3126</link>
		<dc:creator>edthefixer</dc:creator>
		<pubDate>Fri, 29 May 2009 13:52:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-3126</guid>
		<description>I guess this posting you have in your blog answers my previous question:

http://www.powershell.nu/2009/04/27/part-116-adding-homefolder-through-powershell/

(I found it after I wrote this ....)

Anyway, I am having anissue with your Get-AD.ps1 file ...</description>
		<content:encoded><![CDATA[<p>I guess this posting you have in your blog answers my previous question:</p>
<p><a href="http://www.powershell.nu/2009/04/27/part-116-adding-homefolder-through-powershell/" rel="nofollow">http://www.powershell.nu/2009/04/27/part-116-adding-homefolder-through-powershell/</a></p>
<p>(I found it after I wrote this &#8230;.)</p>
<p>Anyway, I am having anissue with your Get-AD.ps1 file &#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: edthefixer</title>
		<link>http://www.powershell.nu/2009/02/13/set-folder-permissions-using-a-powershell-script/comment-page-1/#comment-3090</link>
		<dc:creator>edthefixer</dc:creator>
		<pubDate>Thu, 28 May 2009 19:46:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.powershell.nu/?p=430#comment-3090</guid>
		<description>Niklas,

I just started working with PowerShell .... I can&#039;t believe i waited this long and kept doing things with VBScript! anyway ..... I tested your script and works nicely, good job.

I have several questions:

a) If i wanted to run the script remotely to create individual folders based on a user&#039;s list the script is reading (I extracted it from AD) to create individual user folders within an existing or non-existing share on a remote server, what would it be the best way? in the past using VBScript this what I have done:

Option Explicit
Dim intRow, objExcel, objSheet, strPathExcel
Dim strHomeFolder, strHome, strUser
Dim objFSO, objShell, intRunError 

strHome = “\\ServerName\ShareName\” 
strPathExcel = &quot;C:\ExcelFile.xlsx&quot; 
intRow = 3 &#039; Row 1 contains headings 
&#039; Open the Excel spreadsheet
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objExcel = CreateObject(&quot;Excel.Application&quot;)
Set objSheet = objExcel.Workbooks.Open(strPathExcel) 
&#039; Create a shell for cmd and CACLS
Set objShell = CreateObject(&quot;Wscript.Shell&quot;) 

&#039; Here is the loop that cycles through the cells
Do Until (objExcel.Cells(intRow,1).Value) = &quot;&quot;
strUser = objExcel.Cells(intRow, 1).Value
Call HomeDir &#039; I decided to use a subroutine
intRow = intRow + 1
Loop
objExcel.Quit &#039; Clears up Excel 

Sub HomeDir()
strHomeFolder = strHome &amp; strUser
If strHomeFolder  &quot;&quot; Then
If Not objFSO.FolderExists(strHomeFolder) Then
On Error Resume Next
objFSO.CreateFolder strHomeFolder
     If Err.Number  0 Then
     On Error GoTo 0
     Wscript.Echo &quot;Cannot create: &quot; &amp; strHomeFolder
 End If
On Error GoTo 0
End If
     If objFSO.FolderExists(strHomeFolder) Then

     &#039; Assign user permission to home folder.
     intRunError = objShell.Run(&quot;%COMSPEC% /c Echo Y&#124; cacls &quot;_
     &amp; strHomeFolder &amp; &quot; /e /c /g Administrators:f &quot;_
     &amp; strUser &amp; &quot;:F&quot;, 2, True)
        If intRunError  0 Then
        Wscript.Echo &quot;Error assigning permissions for user &quot; &amp; strUser &amp; &quot; to home folder &quot; &amp;
strHomeFolder
        End If
    End If
End If
End Sub
objExcel.Quit 
WScript.Quit
 
The previous script works and I do want to emulate the same with your script.

b) is there a better way to do this such as pulling the data directly from AD? using som type of AD query or Wmi calling?</description>
		<content:encoded><![CDATA[<p>Niklas,</p>
<p>I just started working with PowerShell &#8230;. I can&#8217;t believe i waited this long and kept doing things with VBScript! anyway &#8230;.. I tested your script and works nicely, good job.</p>
<p>I have several questions:</p>
<p>a) If i wanted to run the script remotely to create individual folders based on a user&#8217;s list the script is reading (I extracted it from AD) to create individual user folders within an existing or non-existing share on a remote server, what would it be the best way? in the past using VBScript this what I have done:</p>
<p>Option Explicit<br />
Dim intRow, objExcel, objSheet, strPathExcel<br />
Dim strHomeFolder, strHome, strUser<br />
Dim objFSO, objShell, intRunError </p>
<p>strHome = “\\ServerName\ShareName\”<br />
strPathExcel = &#8220;C:\ExcelFile.xlsx&#8221;<br />
intRow = 3 &#8216; Row 1 contains headings<br />
&#8216; Open the Excel spreadsheet<br />
Set objFSO = CreateObject(&#8220;Scripting.FileSystemObject&#8221;)<br />
Set objExcel = CreateObject(&#8220;Excel.Application&#8221;)<br />
Set objSheet = objExcel.Workbooks.Open(strPathExcel)<br />
&#8216; Create a shell for cmd and CACLS<br />
Set objShell = CreateObject(&#8220;Wscript.Shell&#8221;) </p>
<p>&#8216; Here is the loop that cycles through the cells<br />
Do Until (objExcel.Cells(intRow,1).Value) = &#8220;&#8221;<br />
strUser = objExcel.Cells(intRow, 1).Value<br />
Call HomeDir &#8216; I decided to use a subroutine<br />
intRow = intRow + 1<br />
Loop<br />
objExcel.Quit &#8216; Clears up Excel </p>
<p>Sub HomeDir()<br />
strHomeFolder = strHome &amp; strUser<br />
If strHomeFolder  &#8220;&#8221; Then<br />
If Not objFSO.FolderExists(strHomeFolder) Then<br />
On Error Resume Next<br />
objFSO.CreateFolder strHomeFolder<br />
     If Err.Number  0 Then<br />
     On Error GoTo 0<br />
     Wscript.Echo &#8220;Cannot create: &#8221; &amp; strHomeFolder<br />
 End If<br />
On Error GoTo 0<br />
End If<br />
     If objFSO.FolderExists(strHomeFolder) Then</p>
<p>     &#8216; Assign user permission to home folder.<br />
     intRunError = objShell.Run(&#8220;%COMSPEC% /c Echo Y| cacls &#8220;_<br />
     &amp; strHomeFolder &amp; &#8221; /e /c /g Administrators:f &#8220;_<br />
     &amp; strUser &amp; &#8220;:F&#8221;, 2, True)<br />
        If intRunError  0 Then<br />
        Wscript.Echo &#8220;Error assigning permissions for user &#8221; &amp; strUser &amp; &#8221; to home folder &#8221; &amp;<br />
strHomeFolder<br />
        End If<br />
    End If<br />
End If<br />
End Sub<br />
objExcel.Quit<br />
WScript.Quit</p>
<p>The previous script works and I do want to emulate the same with your script.</p>
<p>b) is there a better way to do this such as pulling the data directly from AD? using som type of AD query or Wmi calling?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

