<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: VB.net developer looking to manage CIFS shares via a console app in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436164#M6531</link>
    <description>&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of modifying an ACL for an existing share using the REST API&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;$Credential = Get-Credential -Credential "admin"
$Cluster    = "cluster1.testlab.local"
$Vserver    = "vserver1"
$share      = "share1"
$group      = "Authenticated Users"
$type       = "windows"
$permission = "change"
$auth       = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
$headers = @{
   "Authorization" = "Basic $auth"
   "Accept"        = "application/json"
   "Content-Type"  = "application/json"
}
$uri = "https://$cluster/api/svm/svms?name=$vserver"
$result = Invoke-RestMethod -Method Get -Uri $uri -Headers $headers

$uuid   = $result.records.uuid
$uri    = "https://$cluster/api/protocols/cifs/shares/$uuid/$share/acls/$group/$type"
$body   = @{"permission" = "$permission"} | ConvertTo-Json
$result = Invoke-RestMethod -Method Patch -Uri $uri -Body $body -Headers $headers&lt;/LI-CODE&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 01:18:49 GMT</pubDate>
    <dc:creator>mbeattie</dc:creator>
    <dc:date>2022-06-24T01:18:49Z</dc:date>
    <item>
      <title>VB.net developer looking to manage CIFS shares via a console app</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436102#M6527</link>
      <description>&lt;P&gt;As a VB.net developer I need to be able to manage remote SMB\CIFS shares on a Netapp array. All I want to do initially is set an existing share that contains a single ACE of Authenticated Users with Full access, to Read Only.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All of the microsoft objects and methods can manage ACLs in the sub folders of the share, but the&amp;nbsp; main share seems off limits since it exists on the Netapp array.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to manage these shares using .net framework? Is there an API that I can install that will allow me to code the solution in Visual Studio and ideally in VB.net?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 09:59:22 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436102#M6527</guid>
      <dc:creator>Runnindave</dc:creator>
      <dc:date>2025-06-04T09:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net developer looking to manage CIFS shares via a console app</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436135#M6528</link>
      <description>&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can set the ACL of the share during provisioning using the REST API&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://library.netapp.com/ecmdocs/ECMLP2876964/html/index.html#/NAS/cifs_share_create" target="_blank"&gt;https://library.netapp.com/ecmdocs/ECMLP2876964/html/index.html#/NAS/cifs_share_create&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which version of ONTAP are you using? If you are using an older version you can use the NMSDK.&lt;/P&gt;&lt;P&gt;The ZAPI you are looking for is "cifs-share-access-control-modify". The XML syntax is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;netapp  xmlns="http://www.netapp.com/filer/admin" version="1.0"&amp;gt;
  &amp;lt;cifs-share-access-control-modify&amp;gt;
    &amp;lt;permission&amp;gt;&amp;lt;/permission&amp;gt;
    &amp;lt;share&amp;gt;&amp;lt;/share&amp;gt;
    &amp;lt;user-group-type&amp;gt;&amp;lt;/user-group-type&amp;gt;
    &amp;lt;user-or-group&amp;gt;&amp;lt;/user-or-group&amp;gt;
    &amp;lt;winsid&amp;gt;&amp;lt;/winsid&amp;gt;
  &amp;lt;/cifs-share-access-control-modify&amp;gt;
&amp;lt;/netapp&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a C# example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;using System;
using System.Text;
using System.Collections.Generic;
using NetApp.Manage;

namespace NetApp.NMSDK.Example
{
  class ApiClient 
  {
	 static void Main(string[] args)
	 {
		 try
		 {
			NaServer s = new NaServer("cluster1.testlab.local", 1 , 0);
			s.ServerType = NaServer.SERVER_TYPE.FILER;
			s.TransportType = NaServer.TRANSPORT_TYPE.HTTPS;
			s.Port = 443;
			s.Style = NaServer.AUTH_STYLE.LOGIN_PASSWORD;
			s.SetAdminUser("admin", "&amp;lt;password&amp;gt;");


			NaElement api = new NaElement("cifs-share-access-control-modify");
			api.AddNewChild("permission","&amp;lt;permission&amp;gt;");
			api.AddNewChild("share","&amp;lt;share&amp;gt;");
			api.AddNewChild("user-group-type","&amp;lt;user-group-type&amp;gt;");
			api.AddNewChild("user-or-group","&amp;lt;user-or-group&amp;gt;");
			api.AddNewChild("winsid","&amp;lt;winsid&amp;gt;");

			NaElement xo = s.InvokeElem(api);
			Console.WriteLine(xo.ToPrettyString(""));


		}
		catch (NaAuthException e)
		{
			Console.Error.WriteLine("Authorization Failed: " + e.Message);
		}
		catch (NaApiFailedException e)
		{
			Console.Error.WriteLine("API FAILED: " + e.Message);
		}
		 catch (Exception e)
		{
			Console.Error.WriteLine(e.Message);
		}
	 }
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does that help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 04:39:19 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436135#M6528</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2022-06-23T04:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net developer looking to manage CIFS shares via a console app</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436152#M6529</link>
      <description>&lt;P&gt;Thanks Matt for the reply...&lt;/P&gt;&lt;P&gt;One thing you said makes me a little worried.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"You can set the ACL of the share &lt;STRONG&gt;during provisioning&lt;/STRONG&gt; using the REST API"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am I not able to modify the existing ACL on an already provisioned share?&lt;/P&gt;&lt;P&gt;Im using the Ontap 9.8.0 with Powershell currently.&amp;nbsp; No problem creating the share and setting the Authenticated users to Modify, the problem now is setting the existing share to READ.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have any examples of using the REST API to modify existing shares?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 13:23:32 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436152#M6529</guid>
      <dc:creator>Runnindave</dc:creator>
      <dc:date>2022-06-23T13:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net developer looking to manage CIFS shares via a console app</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436162#M6530</link>
      <description>&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can modify the CIFS Share ACL using this PowerShell cmdlet:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;PS C:\&amp;gt; get-help Set-NcCifsShareAcl

NAME
    Set-NcCifsShareAcl

SYNOPSIS
    Set the permissions for a user or group on a defined CIFS share.


SYNTAX
    Set-NcCifsShareAcl [-Share] &amp;lt;String&amp;gt; [-UserOrGroup] &amp;lt;String&amp;gt; [-Permission] &amp;lt;String&amp;gt; [-UserGroupType &amp;lt;String&amp;gt;] [-Winsid &amp;lt;String&amp;gt;] [-VserverContext &amp;lt;String&amp;gt;] [-Controller &amp;lt;NcController[]&amp;gt;] [-InformationAction
    &amp;lt;ActionPreference&amp;gt;] [-InformationVariable &amp;lt;String&amp;gt;] [-PipelineVariable &amp;lt;String&amp;gt;] [-ZapiRetryCount &amp;lt;Int32&amp;gt;] [&amp;lt;CommonParameters&amp;gt;]


DESCRIPTION
    Set the permissions for a user or group on a defined CIFS share.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;There is also an equivalent REST API for modifying the CIFS share ACL available from ONTAP 9.6:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/protocols/cifs/shares/{svm.uuid}/{share}/acls/{user_or_group}/{type}&lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://library.netapp.com/ecmdocs/ECMLP2876964/html/index.html#/NAS/cifs_share_acl_modify" target="_blank"&gt;https://library.netapp.com/ecmdocs/ECMLP2876964/html/index.html#/NAS/cifs_share_acl_modify&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The links to the previous ZAPI's were only if you were running an old version of ONTAP prior to 9.6&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 23:12:13 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436162#M6530</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2022-06-23T23:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net developer looking to manage CIFS shares via a console app</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436164#M6531</link>
      <description>&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of modifying an ACL for an existing share using the REST API&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;$Credential = Get-Credential -Credential "admin"
$Cluster    = "cluster1.testlab.local"
$Vserver    = "vserver1"
$share      = "share1"
$group      = "Authenticated Users"
$type       = "windows"
$permission = "change"
$auth       = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($Credential.UserName + ':' + $Credential.GetNetworkCredential().Password))
$headers = @{
   "Authorization" = "Basic $auth"
   "Accept"        = "application/json"
   "Content-Type"  = "application/json"
}
$uri = "https://$cluster/api/svm/svms?name=$vserver"
$result = Invoke-RestMethod -Method Get -Uri $uri -Headers $headers

$uuid   = $result.records.uuid
$uri    = "https://$cluster/api/protocols/cifs/shares/$uuid/$share/acls/$group/$type"
$body   = @{"permission" = "$permission"} | ConvertTo-Json
$result = Invoke-RestMethod -Method Patch -Uri $uri -Body $body -Headers $headers&lt;/LI-CODE&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 01:18:49 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436164#M6531</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2022-06-24T01:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: VB.net developer looking to manage CIFS shares via a console app</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436183#M6532</link>
      <description>&lt;P&gt;I was able to modify the Authenticated Users ACE to READ using the powershell example. One thing that was a problem is the group that I entered was "Authenticated users" and it would not apply the Set command. However, when I changed the group param to NT Authority\Authenticated Users the ACE was modified to READ.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just in case someone hits a wall like this,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your assistance with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 13:06:57 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/VB-net-developer-looking-to-manage-CIFS-shares-via-a-console-app/m-p/436183#M6532</guid>
      <dc:creator>Runnindave</dc:creator>
      <dc:date>2022-06-24T13:06:57Z</dc:date>
    </item>
  </channel>
</rss>

