<?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: Powershell – WMI: Working with Shares &#8211; Part 1: Creating a Share with Custom Permissions</title>
	<atom:link href="http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/</link>
	<description></description>
	<lastBuildDate>Fri, 05 Mar 2010 06:03:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joe</title>
		<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/comment-page-1/#comment-3743</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Thu, 04 Mar 2010 19:02:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/#comment-3743</guid>
		<description>Thank you so much for this script.  It saved me a lot of time.</description>
		<content:encoded><![CDATA[<p>Thank you so much for this script.  It saved me a lot of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakob</title>
		<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/comment-page-1/#comment-3702</link>
		<dc:creator>Jakob</dc:creator>
		<pubDate>Thu, 17 Dec 2009 09:23:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/#comment-3702</guid>
		<description>thnx alot!

i havent had time myself to do it, its great to see other helping out!

merry christmas to you all.</description>
		<content:encoded><![CDATA[<p>thnx alot!</p>
<p>i havent had time myself to do it, its great to see other helping out!</p>
<p>merry christmas to you all.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathan Warnken</title>
		<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/comment-page-1/#comment-3701</link>
		<dc:creator>Jonathan Warnken</dc:creator>
		<pubDate>Wed, 16 Dec 2009 20:47:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/#comment-3701</guid>
		<description>Nice work!! 
I added support for setting permissions for Everyone and Authenticated users. Also Updated the New-Share function to address the bug James found.

# //************************************************************************************************************
# // ***** Script Header *****
# //
# // Solution:  Coretech Share Functions
# // File:      NewShareWithPermission.ps1
# // Author:	Jakob Gottlieb Svendsen, Coretech A/S. http://blog.coretech.dk
# // Purpose:
# // New-Share: Creates new Share on local or remote PC, with custom permissions.
# // Required Parameters: FolderPath, ShareName
# //
# // New-ACE: Creates ACE Objects, for use when running New-Share.
# // Required Parameters: Name, Domain
# //
# // New-SecurityDescriptor: used by New-Share to prepare the permissions.
# // Required Parameters: ACEs
#//
# // Usage Examples:
# // New-Share -FolderPath &quot;C:\Temp&quot; -ShareName &quot;Temp&quot; -ACEs $ACE,$ACE2  -Description &quot;Test Description&quot; -Computer &quot;localhost&quot;
# // Sharing of folder C:\Temp, with the Name &quot;Temp&quot;. ACE&#039;s (Permissions) are sent via the -ACEs parameter.
# // Create them with New-ACE and send one  or more, seperated by comma (or create and array and use that)
# //
# // This is the first in a couple of share-administration scripts i am planning to make and release on the blog.
# //
# // Please comment the blog post, if you have any suggestions, questions or feedback.
# // Contact me if you need us to make a custom script (or cause not for free  )
# //
# // CORETECH A/S History:
# // 0.0.1     JGS 30/06/2009  Created initial version.
# //
# // Customer History:
# // 0.0.2	 - Jonathan	Warnken(jon.warnken@gmail.com) 16/12/2009
# //		 - Added logic to all permissions to be set using Everyone and Authenticated Users. These use well known SIDs and are easier to hard code then lookup.
# //		 - Usage Examples:
# //		 - (Everyone) 			 $ACE = New-ACE -Name &quot;Everyone&quot; -Domain &quot;.&quot; -Permission &quot;Read&quot; -Group
# //		 - (Authenticated Users) $ACE = New-ACE -Name &quot;Authenticated Users&quot; -Domain &quot;NT AUTHORITY&quot; -Permission &quot;Read&quot; -Group
# //		 - 
# //		 - Updated New-Share so that -MaxUsers and -Password are optional parameters. The default values are $null.
# //		 - Updated the Main Code examples to use an Array for the Access Control objects
# //
# // ***** End Header *****
# //**************************************************************************************************************
#//----------------------------------------------------------------------------
#//  Procedures
#//----------------------------------------------------------------------------

Function New-SecurityDescriptor (
$ACEs = (throw &quot;Missing one or more Trustees&quot;),
[string] $ComputerName = &quot;.&quot;)
{
	#Create SeCDesc object
	$SecDesc = ([WMIClass] &quot;\\$ComputerName\root\cimv2:Win32_SecurityDescriptor&quot;).CreateInstance()
	#Check if input is an array or not.
	if ($ACEs -is [System.Array])
	{
		#Add Each ACE from the ACE array
		foreach ($ACE in $ACEs )
		{
			$SecDesc.DACL += $ACE.psobject.baseobject
		}
	}
	else
	{
		#Add the ACE
		$SecDesc.DACL =  $ACEs
	}
	#Return the security Descriptor
	return $SecDesc
}

Function New-ACE (
	[string] $Name = (throw &quot;Please provide user/group name for trustee&quot;),
	[string] $Domain = (throw &quot;Please provide Domain name for trustee&quot;),
	[string] $Permission = &quot;Read&quot;,
	[string] $ComputerName = &quot;.&quot;,
	[switch] $Group = $false)
{
	#Create the Trusteee Object
	$Trustee = ([WMIClass] &quot;\\$ComputerName\root\cimv2:Win32_Trustee&quot;).CreateInstance()
	#Check for Special cases Everyone and Authenticated Users)
	switch ($Name.ToUpper()) {
		&quot;EVERYONE&quot; {
		$Trustee.Domain = $Null
		$Trustee.Name = &quot;EVERYONE&quot;
		$Trustee.SID = @(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)	
		}
		&quot;AUTHENTICATED USERS&quot; {
		$Trustee.Domain = &quot;NT AUTHORITY&quot;
		$Trustee.Name = &quot;Authenticated Users&quot;
		$Trustee.SID = @(1, 1, 0, 0, 0, 0, 0, 5, 11, 0, 0, 0)
		}
		default {
		#Search for the user or group, depending on the -Group switch
		if (!$group)
		{ $account = [WMI] &quot;\\$ComputerName\root\cimv2:Win32_Account.Name=&#039;$Name&#039;,Domain=&#039;$Domain&#039;&quot; }
		else
		{ $account = [WMI] &quot;\\$ComputerName\root\cimv2:Win32_Group.Name=&#039;$Name&#039;,Domain=&#039;$Domain&#039;&quot; }
		#Get the SID for the found account.
		$accountSID = [WMI] &quot;\\$ComputerName\root\cimv2:Win32_SID.SID=&#039;$($account.sid)&#039;&quot;
		#Setup Trusteee object
		$Trustee.Domain = $Domain
		$Trustee.Name = $Name
		$Trustee.SID = $accountSID.BinaryRepresentation	
		}
	}
	#Create ACE (Access Control List) object.
	$ACE = ([WMIClass] &quot;\\$ComputerName\root\cimv2:Win32_ACE&quot;).CreateInstance()
	#Select the AccessMask depending on the -Permission parameter
	switch ($Permission)
	{
		&quot;Read&quot; 		 { $ACE.AccessMask = 1179817 }
		&quot;Change&quot;  {	$ACE.AccessMask = 1245631 }
		&quot;Full&quot;		   { $ACE.AccessMask = 2032127 }
		default { throw &quot;$Permission is not a supported permission value. Possible values are &#039;Read&#039;,&#039;Change&#039;,&#039;Full&#039;&quot; }
	}
	#Setup the rest of the ACE.
	$ACE.AceFlags = 3
	$ACE.AceType = 0
	$ACE.Trustee = $Trustee
	#Return the ACE
	return $ACE
}

Function New-Share (
	[string] $FolderPath = (throw &quot;Please provide the share folder path (FolderPath)&quot;),
	[string] $ShareName = (throw &quot;Please provide the Share Name&quot;),
	$ACEs,
	[string] $Description = &quot;&quot;,
	[string] $ComputerName = &quot;.&quot;,
	$MaxUsers = $null,
	$Password = $null)
{
	#Start the Text for the message.
	$text = &quot;$ShareName ($FolderPath): &quot;
	#Package the SecurityDescriptor via the New-SecurityDescriptor Function.
	$SecDesc = New-SecurityDescriptor $ACEs
	#Create the share via WMI, get the return code and create the return message.
	$Share = [WMICLASS] &quot;\\$ComputerName\Root\Cimv2:Win32_Share&quot;
	$result = $Share.Create($FolderPath, $ShareName, 0, $MaxUsers, $Description, $Password, $SecDesc)
	switch ($result.ReturnValue)
	{
		0 {$text += &quot;has been success fully created&quot; }
		2 {$text += &quot;Error 2: Access Denied&quot; }
		8 {$text += &quot;Error 8: Unknown Failure&quot; }
		9 {$text += &quot;Error 9: Invalid Name&quot;}
		10 {$text += &quot;Error 10: Invalid Level&quot; }
		21 {$text += &quot;Error 21: Invalid Parameter&quot; }
		22 {$text += &quot;Error 22 : Duplicate Share&quot;}
		23 {$text += &quot;Error 23: Redirected Path&quot; }
		24 {$text += &quot;Error 24: Unknown Device or Directory&quot; }
		25 {$text += &quot;Error 25: Net Name Not Found&quot; }
	}
	#Create Custom return object and Add results
	$return = New-Object System.Object
	$return &#124; Add-Member -type NoteProperty -name ReturnCode -value $result.ReturnValue
	$return &#124; Add-Member -type NoteProperty -name Message -value $text
	#Return result object
	$return
}

#//----------------------------------------------------------------------------
#//  Main routines
#//----------------------------------------------------------------------------

#Create ACE&#039;s for the securitydescriptor for the share:
#a group ACE, containing Group info, please notice the -Group switch
$ACE = @(New-ACE -Name &quot;Domain Users&quot; -Domain &quot;CORETECH&quot; -Permission &quot;Read&quot; -Group)
$ACE += New-ACE -Name &quot;Authenticated Users&quot; -Domain &quot;NT AUTHORITY&quot; -Permission &quot;Read&quot; -Group
$ACE += New-ACE -Name &quot;everyone&quot; -Domain &quot;.&quot; -Permission &quot;Read&quot; -Group
#a user ACE.
$ACE += New-ACE -Name &quot;CCO&quot; -Domain &quot;CORETECH&quot; -Permission &quot;Full&quot;


#Create the share on the local machine
$result = New-Share -FolderPath &quot;C:\Temp&quot; -ShareName &quot;Temp4&quot;  -ACEs $ACE -Description &quot;Test Description&quot; -Computer &quot;localhost&quot; 

#Output result message from new-share
Write-Output $result.Message

#Check if the share was succesfully created
If ($result.ReturnCode -eq 0)
{
	#Creation was succesfull, put your next code here.
}

#//----------------------------------------------------------------------------
#//  End Script
#//----------------------------------------------------------------------------</description>
		<content:encoded><![CDATA[<p>Nice work!!<br />
I added support for setting permissions for Everyone and Authenticated users. Also Updated the New-Share function to address the bug James found.</p>
<p># //************************************************************************************************************<br />
# // ***** Script Header *****<br />
# //<br />
# // Solution:  Coretech Share Functions<br />
# // File:      NewShareWithPermission.ps1<br />
# // Author:	Jakob Gottlieb Svendsen, Coretech A/S. <a href="http://blog.coretech.dk" rel="nofollow">http://blog.coretech.dk</a><br />
# // Purpose:<br />
# // New-Share: Creates new Share on local or remote PC, with custom permissions.<br />
# // Required Parameters: FolderPath, ShareName<br />
# //<br />
# // New-ACE: Creates ACE Objects, for use when running New-Share.<br />
# // Required Parameters: Name, Domain<br />
# //<br />
# // New-SecurityDescriptor: used by New-Share to prepare the permissions.<br />
# // Required Parameters: ACEs<br />
#//<br />
# // Usage Examples:<br />
# // New-Share -FolderPath &#8220;C:\Temp&#8221; -ShareName &#8220;Temp&#8221; -ACEs $ACE,$ACE2  -Description &#8220;Test Description&#8221; -Computer &#8220;localhost&#8221;<br />
# // Sharing of folder C:\Temp, with the Name &#8220;Temp&#8221;. ACE&#8217;s (Permissions) are sent via the -ACEs parameter.<br />
# // Create them with New-ACE and send one  or more, seperated by comma (or create and array and use that)<br />
# //<br />
# // This is the first in a couple of share-administration scripts i am planning to make and release on the blog.<br />
# //<br />
# // Please comment the blog post, if you have any suggestions, questions or feedback.<br />
# // Contact me if you need us to make a custom script (or cause not for free  )<br />
# //<br />
# // CORETECH A/S History:<br />
# // 0.0.1     JGS 30/06/2009  Created initial version.<br />
# //<br />
# // Customer History:<br />
# // 0.0.2	 &#8211; Jonathan	Warnken(jon.warnken@gmail.com) 16/12/2009<br />
# //		 &#8211; Added logic to all permissions to be set using Everyone and Authenticated Users. These use well known SIDs and are easier to hard code then lookup.<br />
# //		 &#8211; Usage Examples:<br />
# //		 &#8211; (Everyone) 			 $ACE = New-ACE -Name &#8220;Everyone&#8221; -Domain &#8220;.&#8221; -Permission &#8220;Read&#8221; -Group<br />
# //		 &#8211; (Authenticated Users) $ACE = New-ACE -Name &#8220;Authenticated Users&#8221; -Domain &#8220;NT AUTHORITY&#8221; -Permission &#8220;Read&#8221; -Group<br />
# //		 &#8211;<br />
# //		 &#8211; Updated New-Share so that -MaxUsers and -Password are optional parameters. The default values are $null.<br />
# //		 &#8211; Updated the Main Code examples to use an Array for the Access Control objects<br />
# //<br />
# // ***** End Header *****<br />
# //**************************************************************************************************************<br />
#//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
#//  Procedures<br />
#//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>Function New-SecurityDescriptor (<br />
$ACEs = (throw &#8220;Missing one or more Trustees&#8221;),<br />
[string] $ComputerName = &#8220;.&#8221;)<br />
{<br />
	#Create SeCDesc object<br />
	$SecDesc = ([WMIClass] &#8220;\\$ComputerName\root\cimv2:Win32_SecurityDescriptor&#8221;).CreateInstance()<br />
	#Check if input is an array or not.<br />
	if ($ACEs -is [System.Array])<br />
	{<br />
		#Add Each ACE from the ACE array<br />
		foreach ($ACE in $ACEs )<br />
		{<br />
			$SecDesc.DACL += $ACE.psobject.baseobject<br />
		}<br />
	}<br />
	else<br />
	{<br />
		#Add the ACE<br />
		$SecDesc.DACL =  $ACEs<br />
	}<br />
	#Return the security Descriptor<br />
	return $SecDesc<br />
}</p>
<p>Function New-ACE (<br />
	[string] $Name = (throw &#8220;Please provide user/group name for trustee&#8221;),<br />
	[string] $Domain = (throw &#8220;Please provide Domain name for trustee&#8221;),<br />
	[string] $Permission = &#8220;Read&#8221;,<br />
	[string] $ComputerName = &#8220;.&#8221;,<br />
	[switch] $Group = $false)<br />
{<br />
	#Create the Trusteee Object<br />
	$Trustee = ([WMIClass] &#8220;\\$ComputerName\root\cimv2:Win32_Trustee&#8221;).CreateInstance()<br />
	#Check for Special cases Everyone and Authenticated Users)<br />
	switch ($Name.ToUpper()) {<br />
		&#8220;EVERYONE&#8221; {<br />
		$Trustee.Domain = $Null<br />
		$Trustee.Name = &#8220;EVERYONE&#8221;<br />
		$Trustee.SID = @(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0)<br />
		}<br />
		&#8220;AUTHENTICATED USERS&#8221; {<br />
		$Trustee.Domain = &#8220;NT AUTHORITY&#8221;<br />
		$Trustee.Name = &#8220;Authenticated Users&#8221;<br />
		$Trustee.SID = @(1, 1, 0, 0, 0, 0, 0, 5, 11, 0, 0, 0)<br />
		}<br />
		default {<br />
		#Search for the user or group, depending on the -Group switch<br />
		if (!$group)<br />
		{ $account = [WMI] &#8220;\\$ComputerName\root\cimv2:Win32_Account.Name=&#8217;$Name&#8217;,Domain=&#8217;$Domain&#8217;&#8221; }<br />
		else<br />
		{ $account = [WMI] &#8220;\\$ComputerName\root\cimv2:Win32_Group.Name=&#8217;$Name&#8217;,Domain=&#8217;$Domain&#8217;&#8221; }<br />
		#Get the SID for the found account.<br />
		$accountSID = [WMI] &#8220;\\$ComputerName\root\cimv2:Win32_SID.SID=&#8217;$($account.sid)&#8217;&#8221;<br />
		#Setup Trusteee object<br />
		$Trustee.Domain = $Domain<br />
		$Trustee.Name = $Name<br />
		$Trustee.SID = $accountSID.BinaryRepresentation<br />
		}<br />
	}<br />
	#Create ACE (Access Control List) object.<br />
	$ACE = ([WMIClass] &#8220;\\$ComputerName\root\cimv2:Win32_ACE&#8221;).CreateInstance()<br />
	#Select the AccessMask depending on the -Permission parameter<br />
	switch ($Permission)<br />
	{<br />
		&#8220;Read&#8221; 		 { $ACE.AccessMask = 1179817 }<br />
		&#8220;Change&#8221;  {	$ACE.AccessMask = 1245631 }<br />
		&#8220;Full&#8221;		   { $ACE.AccessMask = 2032127 }<br />
		default { throw &#8220;$Permission is not a supported permission value. Possible values are &#8216;Read&#8217;,'Change&#8217;,'Full&#8217;&#8221; }<br />
	}<br />
	#Setup the rest of the ACE.<br />
	$ACE.AceFlags = 3<br />
	$ACE.AceType = 0<br />
	$ACE.Trustee = $Trustee<br />
	#Return the ACE<br />
	return $ACE<br />
}</p>
<p>Function New-Share (<br />
	[string] $FolderPath = (throw &#8220;Please provide the share folder path (FolderPath)&#8221;),<br />
	[string] $ShareName = (throw &#8220;Please provide the Share Name&#8221;),<br />
	$ACEs,<br />
	[string] $Description = &#8220;&#8221;,<br />
	[string] $ComputerName = &#8220;.&#8221;,<br />
	$MaxUsers = $null,<br />
	$Password = $null)<br />
{<br />
	#Start the Text for the message.<br />
	$text = &#8220;$ShareName ($FolderPath): &#8221;<br />
	#Package the SecurityDescriptor via the New-SecurityDescriptor Function.<br />
	$SecDesc = New-SecurityDescriptor $ACEs<br />
	#Create the share via WMI, get the return code and create the return message.<br />
	$Share = [WMICLASS] &#8220;\\$ComputerName\Root\Cimv2:Win32_Share&#8221;<br />
	$result = $Share.Create($FolderPath, $ShareName, 0, $MaxUsers, $Description, $Password, $SecDesc)<br />
	switch ($result.ReturnValue)<br />
	{<br />
		0 {$text += &#8220;has been success fully created&#8221; }<br />
		2 {$text += &#8220;Error 2: Access Denied&#8221; }<br />
		8 {$text += &#8220;Error 8: Unknown Failure&#8221; }<br />
		9 {$text += &#8220;Error 9: Invalid Name&#8221;}<br />
		10 {$text += &#8220;Error 10: Invalid Level&#8221; }<br />
		21 {$text += &#8220;Error 21: Invalid Parameter&#8221; }<br />
		22 {$text += &#8220;Error 22 : Duplicate Share&#8221;}<br />
		23 {$text += &#8220;Error 23: Redirected Path&#8221; }<br />
		24 {$text += &#8220;Error 24: Unknown Device or Directory&#8221; }<br />
		25 {$text += &#8220;Error 25: Net Name Not Found&#8221; }<br />
	}<br />
	#Create Custom return object and Add results<br />
	$return = New-Object System.Object<br />
	$return | Add-Member -type NoteProperty -name ReturnCode -value $result.ReturnValue<br />
	$return | Add-Member -type NoteProperty -name Message -value $text<br />
	#Return result object<br />
	$return<br />
}</p>
<p>#//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
#//  Main routines<br />
#//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>#Create ACE&#8217;s for the securitydescriptor for the share:<br />
#a group ACE, containing Group info, please notice the -Group switch<br />
$ACE = @(New-ACE -Name &#8220;Domain Users&#8221; -Domain &#8220;CORETECH&#8221; -Permission &#8220;Read&#8221; -Group)<br />
$ACE += New-ACE -Name &#8220;Authenticated Users&#8221; -Domain &#8220;NT AUTHORITY&#8221; -Permission &#8220;Read&#8221; -Group<br />
$ACE += New-ACE -Name &#8220;everyone&#8221; -Domain &#8220;.&#8221; -Permission &#8220;Read&#8221; -Group<br />
#a user ACE.<br />
$ACE += New-ACE -Name &#8220;CCO&#8221; -Domain &#8220;CORETECH&#8221; -Permission &#8220;Full&#8221;</p>
<p>#Create the share on the local machine<br />
$result = New-Share -FolderPath &#8220;C:\Temp&#8221; -ShareName &#8220;Temp4&#8243;  -ACEs $ACE -Description &#8220;Test Description&#8221; -Computer &#8220;localhost&#8221; </p>
<p>#Output result message from new-share<br />
Write-Output $result.Message</p>
<p>#Check if the share was succesfully created<br />
If ($result.ReturnCode -eq 0)<br />
{<br />
	#Creation was succesfull, put your next code here.<br />
}</p>
<p>#//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
#//  End Script<br />
#//&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/comment-page-1/#comment-2005</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Tue, 29 Sep 2009 13:28:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/#comment-2005</guid>
		<description>Hello!

Thanks!!! Your script rescued my goal to create a script for sharing folders remote.

But I&#039;ve two problems. 
- How can I change the &quot;user limit&quot; in the creating share from now 1 user to &quot;maximum allowed&quot;?
- How can I grant access to the created share to the &quot;Authenticated Users&quot;?

Maybe you have an idea....

thanks a lot
Tom</description>
		<content:encoded><![CDATA[<p>Hello!</p>
<p>Thanks!!! Your script rescued my goal to create a script for sharing folders remote.</p>
<p>But I&#8217;ve two problems.<br />
- How can I change the &#8220;user limit&#8221; in the creating share from now 1 user to &#8220;maximum allowed&#8221;?<br />
- How can I grant access to the created share to the &#8220;Authenticated Users&#8221;?</p>
<p>Maybe you have an idea&#8230;.</p>
<p>thanks a lot<br />
Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakob</title>
		<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/comment-page-1/#comment-2002</link>
		<dc:creator>Jakob</dc:creator>
		<pubDate>Tue, 22 Sep 2009 08:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/#comment-2002</guid>
		<description>Great to hear that someone is using my script ;-)

and thanks alot for the bug fix!  :)</description>
		<content:encoded><![CDATA[<p>Great to hear that someone is using my script <img src='http://blog.coretech.dk/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>and thanks alot for the bug fix!  <img src='http://blog.coretech.dk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/comment-page-1/#comment-2001</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 21 Sep 2009 21:34:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/#comment-2001</guid>
		<description>Nice script. I had to modify it slightly for my env though.

This line:
$result = $Share.Create($FolderPath, $ShareName, 0, $false , $Description, $false, $SecDesc)

Changed to this:
$result = $Share.Create($FolderPath, $ShareName, 0, $null , $Description, $null, $SecDesc)

The $null&#039;s work better for the optional arguments. Especially argument 4. Maximum users. I found $false was setting it to 0. So nobody could connect to the share.


James</description>
		<content:encoded><![CDATA[<p>Nice script. I had to modify it slightly for my env though.</p>
<p>This line:<br />
$result = $Share.Create($FolderPath, $ShareName, 0, $false , $Description, $false, $SecDesc)</p>
<p>Changed to this:<br />
$result = $Share.Create($FolderPath, $ShareName, 0, $null , $Description, $null, $SecDesc)</p>
<p>The $null&#8217;s work better for the optional arguments. Especially argument 4. Maximum users. I found $false was setting it to 0. So nobody could connect to the share.</p>
<p>James</p>
]]></content:encoded>
	</item>
</channel>
</rss>
