<?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: PowerShell Toolkit stopped working to create shares and cant figure out why in PowerShell Discussions</title>
    <link>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468040#M55</link>
    <description>&lt;P&gt;Hey Brendan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which version of the PSTK are you using? You can check the version using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Get-NaToolKitVersion&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed in several of your functions you are using the "-HTTPS" parameter with the "Connect-NcController" CmdLet. Please note that this parameter has been deprecated and is no longer a valid parameter for newer builds of the PSTK so the attempt to connect to the cluster would fail as the parameter name is invalid. Valid parameter names are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PS C:\&amp;gt; Get-Help Connect-NcController

NAME
    Connect-NcController

SYNOPSIS
    Connect to a clustered Data ONTAP controller.


SYNTAX
    Connect-NcController [-Name] &amp;lt;String[]&amp;gt; [-Port &amp;lt;UInt16&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-Transient] [-Vserver
    &amp;lt;String&amp;gt;] [-Timeout &amp;lt;Int32&amp;gt;] [-Add] [-ApplicationName &amp;lt;String&amp;gt;] [-SSLVersion &amp;lt;String&amp;gt;] [-InformationAction
    &amp;lt;ActionPreference&amp;gt;] [-InformationVariable &amp;lt;String&amp;gt;] [-PipelineVariable &amp;lt;String&amp;gt;] [&amp;lt;CommonParameters&amp;gt;]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also from a security perspective, I would strongly recommend you don't include user names and passwords&amp;nbsp; in your code. Instead i would recommend using the "Add-NcCredential" to first cache the credentials for your RBAC user that will connect to the cluster and then from within your script use the "Get-NcCredential" to retreive the cached credential and pass the $Credential variable as an input parameter into your Function. Note that the credential can only be decrypted as the user who encrypted it so when you cache the credential you must first open a PowerShell session as your RBAC user to run the "Add-NcCredential" CmdLet and your main script must be run as the RBAC user that encrypted the credentials. Just a suggestion to avoid using user names and passwords in clear text within your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that gives you a few tips towards getting it working. Let me know what the error message is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jul 2026 03:56:30 GMT</pubDate>
    <dc:creator>mbeattie</dc:creator>
    <dc:date>2026-07-07T03:56:30Z</dc:date>
    <item>
      <title>PowerShell Toolkit stopped working to create shares and cant figure out why</title>
      <link>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/467999#M53</link>
      <description>&lt;P&gt;We are running 9.16.1p9 and recently turned off HTTP and HTTPS access to our SVM (recently turned only HTTPS back on) where we host some of our homedrives.&amp;nbsp; This is where the powershell toolkit script is pointed.&amp;nbsp; The SVM has a role that only allows certain behaviors&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;API Access level&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;DEFAULT&lt;/TD&gt;&lt;TD&gt;None&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;version&lt;/TD&gt;&lt;TD&gt;Read-only&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;volume create&lt;/TD&gt;&lt;TD&gt;Read-only&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;volume modify&lt;/TD&gt;&lt;TD&gt;Read-only&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;volume show&lt;/TD&gt;&lt;TD&gt;Read-only&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share access-control create&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share access-control delete&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share access-control modify&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share access-control show&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share create&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share delete&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share modify&lt;/TD&gt;&lt;TD&gt;Read/write&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;vserver cifs share show&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Read/write&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;When we have allowed VSAdmin the script will run but cant tell why the role causes it to fail&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the script itself (sanitized for posting purposes) is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      #F U N C T I O N S&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;     function Get_NetApp1_Folder_Array()&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $Folders = @()&lt;/P&gt;&lt;P&gt;            $Folders = "\NetApp01$\Users"&lt;/P&gt;&lt;P&gt;            Return $Folders&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            Return $Folders&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Get_NetApp2_Folder_Array()&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $Folders = @()&lt;/P&gt;&lt;P&gt;            $Folders = "\netapp01$\Users", "\netapp02$\Users", `&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "\netapp03$\Users"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            Return $Folders&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Get_NetApp3_Folder_Array()&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $Folders = @()&lt;/P&gt;&lt;P&gt;            $Folders = "\netapp01$\Users", "\netapp02$\Users", `&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "\netapp03$\Users", "\netapp04$\Users", `&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "\netapp05$\Users"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            Return $Folders&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; function Get_NetApp4_Folder_Array()&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $Folders = @()&lt;/P&gt;&lt;P&gt;            $Folders = "\netapp01$\Users","\netapp02$\Users", `&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "\netapp03$\Users", "\netapp04$\Users", `&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "\netapp05$\Users", "\netapp06$\Users", `&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; "\netapp07$\Users"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            Return $Folders&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Get_Device_Volumes ($Device)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $User = "DOMAIN\SERVICEACCOUNT"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $Password = "SERVICEACCOUNT-PASSWORD"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $SecurePass = ConvertTo-SecureString -String $Password -AsPlainText -Force&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $Credential = New-Object System.Management.Automation.PSCredential $User, $SecurePass&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $nacontroller = Connect-NcController $Device -HTTPS -Credential $Credential&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$VolumeNameArray = Get-NcVol -Controller $nacontroller&lt;/P&gt;&lt;P&gt;            Return $VolumeNameArray&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Test_For_User_Folder ($FolderPath2Use)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $FolderMessage = Test-Path $FolderPath2Use&lt;/P&gt;&lt;P&gt;            Return $FolderMessage&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Create_User_Folder ($FolderPath2Use)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            Try&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  New-Item -ItemType directory -Path $FolderPath2Use -ea Stop&lt;/P&gt;&lt;P&gt;                  $ReturnMessage = "The folder was created successfully."&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            Catch&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                  $ReturnMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host $ErrorMessage&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            Return $ReturnMessage &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Set_Folder_Permissions_NetApp ($FolderPath2Use, $FQSNUser2Use)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $ACL = Get-ACL $FolderPath2Use &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;# Get the existing security members&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;            $permission = $UserFQDN,"Modify","ContainerInherit,ObjectInherit","None","Allow" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;            $accessRule = new-object System.Security.AccessControl.FileSystemAccessRule $permission&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $acl.SetAccessRule($accessRule)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            Try&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $acl | Set-Acl $FolderPath2Use -ea Stop&lt;/P&gt;&lt;P&gt;                  $ReturnMessage = "Permissions set for user " + $FQSNUser2Use + " on " + $FolderPath2Use&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            Catch&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                  $ReturnMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            Return $ReturnMessage&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      function Share_Folder_NetApp ($Volume2Use, $Share2Use, $Controller2Use)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $ShareMessage = ""&lt;/P&gt;&lt;P&gt;            $FailedToConnect = "False"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;            Try&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;           $User = "DOMAIN\SERVICEACCOUNT"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;           $Password = "SERVICEACCOUNT-PASSWORD"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $SecurePass = ConvertTo-SecureString -String $Password -AsPlainText -Force&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $Credential = New-Object System.Management.Automation.PSCredential $User, $SecurePass&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $Controller = Connect-NcController $Controller2Use -Credential $Credential -Transient:$true -ea Stop&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $FailedToConnect = "False"&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            Catch&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                  $FailedToConnect = "True"&lt;/P&gt;&lt;P&gt;                  $ReturnMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ($FailedToConnect -eq "False")&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;       &amp;nbsp; &amp;nbsp;  Try&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Add-NcCifsShare -name $Share2Use -Path $Volume2Use -Controller $Controller -Comment "Home Share"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;                  Catch&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                        $ShareMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;     Try&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Add-NcCifsShareAcl -Share $Share2Use -UserOrGroup "Authenticated Users" &amp;nbsp;-Permission full_control -Controller $Controller -ea Stop&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;                  Catch&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                        $ShareMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;       &amp;nbsp; &amp;nbsp;  Try&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Set-NcCifsShareAcl -Share $Share2Use -UserOrGroup "Authenticated Users" &amp;nbsp;-Permission full_control -Controller $Controller -ea Stop&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;                  Catch&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                        $ShareMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;       &amp;nbsp; &amp;nbsp;  Try&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                   &amp;nbsp; &amp;nbsp;Remove-NcCifsShareAcl -Share $Share2Use -UserOrGroup "Everyone" -Controller $Controller -ea SilentlyContinue&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;                  Catch&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;                        $ShareMessage = "ERROR " + $ErrorMessage&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $ShareMessage = "Share successfully created"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            Return $ShareMessage&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      function RemoveNTFSPermissions($path, $object, $permission)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $FileSystemRights = [System.Security.AccessControl.FileSystemRights]$permission&lt;/P&gt;&lt;P&gt;            $InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]"ContainerInherit, ObjectInherit"&lt;/P&gt;&lt;P&gt;            $PropagationFlag = [System.Security.AccessControl.PropagationFlags]"None"&lt;/P&gt;&lt;P&gt;            $AccessControlType =[System.Security.AccessControl.AccessControlType]::Allow&lt;/P&gt;&lt;P&gt;            $Account = New-Object System.Security.Principal.NTAccount($object)&lt;/P&gt;&lt;P&gt;            $FileSystemAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($Account, $FileSystemRights, $InheritanceFlag, $PropagationFlag, $AccessControlType)&lt;/P&gt;&lt;P&gt;            $DirectorySecurity = Get-ACL $path&lt;/P&gt;&lt;P&gt;            $DirectorySecurity.RemoveAccessRuleAll($FileSystemAccessRule)&lt;/P&gt;&lt;P&gt;            Try&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Set-ACL $path -AclObject $DirectorySecurity -ErrorAction SilentlyContinue&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Catch&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      function RemoveInheritance($path)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $isProtected = $true&lt;/P&gt;&lt;P&gt;            $preserveInheritance = $true&lt;/P&gt;&lt;P&gt;            $DirectorySecurity = Get-ACL $path&lt;/P&gt;&lt;P&gt;            $DirectorySecurity.SetAccessRuleProtection($isProtected, $preserveInheritance)&lt;/P&gt;&lt;P&gt;            Try&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {         &lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Set-ACL $path -AclObject $DirectorySecurity -ErrorAction SilentlyContinue&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Catch&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $ErrorMessage = $_.Exception.Message&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      #MAIN PROCESSING THREAD&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; #Add values for variables from previous operation&lt;/P&gt;&lt;P&gt;      $HomeDrive = "\\NetApp1\JUser$"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $HomeDrive = $HomeDrive.Trim()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $SplitForUser = $HomeDrive.Replace("\\","")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $SplitForUser = $SplitForUser.Split("\")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $UserName = $SplitForUser[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $UserName = $UserName.Replace("$","")&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $Server = $SplitForUser[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $UserShare = $UserName + "$"&lt;/P&gt;&lt;P&gt;      $UserFQDN = "Domain\" + $UserName &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $NetAppDevice = $Server&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Write-Host $UserName&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; #Check to see if the share already exists&lt;/P&gt;&lt;P&gt;      #$NetAppShareExists = Test_For_User_Folder $HomeDrive&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; $NetAppShareExists = $False&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;      if ($NetAppShareExists -eq $False)&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $bOpStatus = "OK"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $bOpMessage = "Share Good"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ($NetAppDevice -eq "NetApp1")&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $FolderArray = Get_NetApp1_Folder_Array&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            if ($NetAppDevice -eq "NetApp2")&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $FolderArray = Get_NetApp2_Folder_Array&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            if ($NetAppDevice -eq "NetApp3")&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $FolderArray = Get_NetApp3_Folder_Array&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            if ($NetAppDevice -eq "NetApp4")&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $FolderArray = Get_NetApp4_Folder_Array&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            $controller = $NetAppDevice&lt;/P&gt;&lt;P&gt;            $NetAppVolumes = Get_Device_Volumes $controller&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            foreach ($Volume in $NetAppVolumes)&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $Check = "*" + $Volume + "*"&lt;/P&gt;&lt;P&gt;                   &amp;nbsp;&lt;/P&gt;&lt;P&gt;                  foreach ($Folder in $FolderArray)&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        if ($Folder -like $Check)&lt;/P&gt;&lt;P&gt;                        {&lt;/P&gt;&lt;P&gt;                              $TotalSpace = $TotalSpace + $Volume.Available&lt;/P&gt;&lt;P&gt;                              $Volumes += $Volume&lt;/P&gt;&lt;P&gt;                        }&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            $Volumes = $Volumes | sort-object Available -descending&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            foreach ($Folder in $FolderArray)&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $Check = "*" + $Volumes[0] + "*"&lt;/P&gt;&lt;P&gt;                  if ($Folder -like $Check)&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $FolderPath = $Folder + "\"&lt;/P&gt;&lt;P&gt;                        $UseVolume = $Volumes[0]&lt;/P&gt;&lt;P&gt;                        Break&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;            $PhysicalPath = "\\" + $NetAppDevice + $FolderPath + $UserName&lt;/P&gt;&lt;P&gt;            &lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Write-Host $PhysicalPath&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            $FolderTest = Test_For_User_Folder $PhysicalPath&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #Write-Host $PhysicalPath&lt;/P&gt;&lt;P&gt;            $FolderCreateMessage = "" &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;            if ($FolderTest -eq $False)&lt;/P&gt;&lt;P&gt;            { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;                   &amp;nbsp; &amp;nbsp;$FolderCreateMessage = Create_User_Folder $PhysicalPath&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;                                          &lt;/P&gt;&lt;P&gt;            if ($FolderCreateMessage -like '*ERROR*')&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $FolderCreated = "False"&lt;/P&gt;&lt;P&gt;                  $bOpStatus = "Failed"&lt;/P&gt;&lt;P&gt;                  $bOpMessage = "Could not create the user folder."&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;            Else&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $FolderCreated = "True"&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;            if ($FolderCreated -eq "True")&lt;/P&gt;&lt;P&gt;            {&lt;/P&gt;&lt;P&gt;                  $PermissionSetMessage = Set_Folder_Permissions_NetApp $PhysicalPath $UserFQDN&lt;/P&gt;&lt;P&gt;                                           &amp;nbsp;&lt;/P&gt;&lt;P&gt;                  RemoveInheritance $PhysicalPath&lt;/P&gt;&lt;P&gt;                  RemoveNTFSPermissions $PhysicalPath "Authenticated Users" "Modify, ChangePermissions"&lt;/P&gt;&lt;P&gt;                  RemoveNTFSPermissions $PhysicalPath "Users" "Modify, ChangePermissions"&lt;/P&gt;&lt;P&gt;                  RemoveNTFSPermissions $PhysicalPath "Creator Owner" "Modify, ChangePermissions"&lt;/P&gt;&lt;P&gt;                  RemoveNTFSPermissions $PhysicalPath "SYSTEM" "Modify, ChangePermissions"&lt;/P&gt;&lt;P&gt;                                                &lt;/P&gt;&lt;P&gt;                  if ($PermissionSetMessage -like '*ERROR*')&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        #$PermissionSet = "True"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $PermissionSet = "False"&lt;/P&gt;&lt;P&gt;                        $bOpStatus = "Failed"&lt;/P&gt;&lt;P&gt;                        $bOpMessage = "Unable to set folder permissions."&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;                  Else&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $PermissionSet = "True"&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;                                          &lt;/P&gt;&lt;P&gt;                  If ($PermissionSet -eq "True")&lt;/P&gt;&lt;P&gt;                  {&lt;/P&gt;&lt;P&gt;                        $NetAppVolumeSharePath = "/vol/" + $UseVolume + "/Users/" + $UserName&lt;/P&gt;&lt;P&gt;                        $NetAppShare = $UserShare&lt;/P&gt;&lt;P&gt;                        $ShareCreateMessage = Share_Folder_NetApp $NetAppVolumeSharePath $NetAppShare $NetAppDevice&lt;/P&gt;&lt;P&gt;                        if ($ShareCreateMessage -like '*ERROR*')&lt;/P&gt;&lt;P&gt;                        {&lt;/P&gt;&lt;P&gt;                              $ShareSet = "False"&lt;/P&gt;&lt;P&gt;                              $bOpStatus = "Failed"&lt;/P&gt;&lt;P&gt;                              $bOpMessage = "Unable to share the folder."&lt;/P&gt;&lt;P&gt;                        }&lt;/P&gt;&lt;P&gt;                        Else&lt;/P&gt;&lt;P&gt;                        {&lt;/P&gt;&lt;P&gt;                              $ShareSet = "True"&lt;/P&gt;&lt;P&gt;                              $bOpStatus = "Completed"&lt;/P&gt;&lt;P&gt;                              $bOpMessage = "User Share Created."&lt;/P&gt;&lt;P&gt;                        }&lt;/P&gt;&lt;P&gt;                  }&lt;/P&gt;&lt;P&gt;            }&lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;      Else&lt;/P&gt;&lt;P&gt;      {&lt;/P&gt;&lt;P&gt;            $bOpStatus = "Failed"&lt;/P&gt;&lt;P&gt;            $bOpMessage = "User Share Already Exists."      &lt;/P&gt;&lt;P&gt;      }&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;       &amp;nbsp; &amp;nbsp;new-Object pscustomobject -property @{&lt;/P&gt;&lt;P&gt;&amp;nbsp;            &amp;nbsp; &amp;nbsp;StatusMsg = $bOpMessage&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Status = $bOpStatus&lt;/P&gt;&lt;P&gt;       &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help figuring out where we have gone wrong would be amazing.&amp;nbsp; This script has worked for years and since we have started locking down more and more features we are discovering some issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jul 2026 19:59:15 GMT</pubDate>
      <guid>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/467999#M53</guid>
      <dc:creator>JBrendan101</dc:creator>
      <dc:date>2026-07-01T19:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: PowerShell Toolkit stopped working to create shares and cant figure out why</title>
      <link>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468039#M54</link>
      <description>&lt;P&gt;Hey Brendan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's the actual error message you get when running the code? Does your code work with admin privileges (IE is it a problem with your code or the RBAC role you've create)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2026 03:35:05 GMT</pubDate>
      <guid>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468039#M54</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2026-07-07T03:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: PowerShell Toolkit stopped working to create shares and cant figure out why</title>
      <link>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468040#M55</link>
      <description>&lt;P&gt;Hey Brendan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which version of the PSTK are you using? You can check the version using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Get-NaToolKitVersion&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I noticed in several of your functions you are using the "-HTTPS" parameter with the "Connect-NcController" CmdLet. Please note that this parameter has been deprecated and is no longer a valid parameter for newer builds of the PSTK so the attempt to connect to the cluster would fail as the parameter name is invalid. Valid parameter names are:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PS C:\&amp;gt; Get-Help Connect-NcController

NAME
    Connect-NcController

SYNOPSIS
    Connect to a clustered Data ONTAP controller.


SYNTAX
    Connect-NcController [-Name] &amp;lt;String[]&amp;gt; [-Port &amp;lt;UInt16&amp;gt;] [-Credential &amp;lt;PSCredential&amp;gt;] [-Transient] [-Vserver
    &amp;lt;String&amp;gt;] [-Timeout &amp;lt;Int32&amp;gt;] [-Add] [-ApplicationName &amp;lt;String&amp;gt;] [-SSLVersion &amp;lt;String&amp;gt;] [-InformationAction
    &amp;lt;ActionPreference&amp;gt;] [-InformationVariable &amp;lt;String&amp;gt;] [-PipelineVariable &amp;lt;String&amp;gt;] [&amp;lt;CommonParameters&amp;gt;]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also from a security perspective, I would strongly recommend you don't include user names and passwords&amp;nbsp; in your code. Instead i would recommend using the "Add-NcCredential" to first cache the credentials for your RBAC user that will connect to the cluster and then from within your script use the "Get-NcCredential" to retreive the cached credential and pass the $Credential variable as an input parameter into your Function. Note that the credential can only be decrypted as the user who encrypted it so when you cache the credential you must first open a PowerShell session as your RBAC user to run the "Add-NcCredential" CmdLet and your main script must be run as the RBAC user that encrypted the credentials. Just a suggestion to avoid using user names and passwords in clear text within your code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that gives you a few tips towards getting it working. Let me know what the error message is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2026 03:56:30 GMT</pubDate>
      <guid>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468040#M55</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2026-07-07T03:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: PowerShell Toolkit stopped working to create shares and cant figure out why</title>
      <link>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468041#M56</link>
      <description>&lt;P&gt;Hey Brendan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just as an example to improve the security of your script, rather than have user names and passwords within your code and then creating a credential object to connect to the cluster. EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Function Get_Device_Volumes($Device){
   $User            = "DOMAIN\SERVICEACCOUNT"
   $Password        = "SERVICEACCOUNT-PASSWORD"
   $SecurePass      = ConvertTo-SecureString -String $Password -AsPlainText -Force
   $Credential      = New-Object System.Management.Automation.PSCredential $User, $SecurePass
   $nacontroller    = Connect-NcController $Device -HTTPS -Credential $Credential
   $VolumeNameArray = Get-NcVol -Controller $nacontroller
   Return $VolumeNameArray
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can cache the Credential as the user who you will schedule the script to runas. EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$credential = Get-Credential
Add-NcCredential -Name 192.168.100.100 -Credential $credential&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then from within your script you can retrieve the cached credential and pass them as an input parameter into your function. EG:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Param(
   [Parameter(Mandatory = $True, HelpMessage="The Cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory = $True, HelpMessage="The Vserver Name")]
   [String]$Vserver,
   [Parameter(Mandatory = $False, HelpMessage = "The Credentials to authenticate to MySQL")]
   [System.Management.Automation.PSCredential]$Credential
)
#'------------------------------------------------------------------------------
Function GetVolumes{
   Param(
      [Parameter(Mandatory = $True, HelpMessage="The Cluster name or IP Address")]
      [String]$Cluster,
      [Parameter(Mandatory = $True, HelpMessage="The Vserver Name")]
      [String]$Vserver,
      [Parameter(Mandatory = $True, HelpMessage = "The Credentials to authenticate to MySQL")]
      [System.Management.Automation.PSCredential]$Credential
   )
   #'---------------------------------------------------------------------------
   #'Connect to the cluster if not already connected.
   #'---------------------------------------------------------------------------
   If((($global:CurrentNcController).Name -ne $Cluster)){
      Try{
         Connect-NcController -Name $Cluster -Credential $Credential -ErrorAction Stop | Out-Null
         Write-Host $("Connected to cluster ""$Cluster"" as user """ + $Credential.UserName)
      }Catch{
         Write-Warning -Message $("Failed connecting to cluster ""$Cluster"". Error " + $_.Exception.Message)
         Return $Null
      }
   }
   #'---------------------------------------------------------------------------
   #'Enumerate the volumes on the vserver.
   #'---------------------------------------------------------------------------
   Try{
      $volumes = Get-NcVol -Vserver $Vserver -ErrorAction Stop
      Write-Host "Enumerating Volumes on Vserver ""$Vserver"" on Cluster ""$Cluster"""
   }Catch{
      Write-Warning -Message $("Failed enumerating volumes on vserver ""$Vserver"" on cluster ""$Cluster"". Error " +  $_.Exception.Message)
      Return $Null
   }
   Return $volumes
}#'End Function GetVolumes.
#'------------------------------------------------------------------------------
#'Enumerate Cached Credential for the cluster if not provided.
#'------------------------------------------------------------------------------
If(-Not($Credential)){
   Write-Host "Enumerating cached credentials for Cluster ""$Cluster"""
   $Credential = (Get-NcCredential -Name $Cluster).Credential
}
If($Null -eq $Credential){
   Write-Warning -Message "Failed enumerating Credential for Cluster ""$Cluster"""
   Exit
}
#'------------------------------------------------------------------------------
#'Enumerate the vserver volumes. 
#'------------------------------------------------------------------------------
$volumes = GetVolumes -Cluster $Cluster -Vserver $Vserver -Credential $Credential
$volumes&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example Output:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PS C:\Scripts\&amp;gt; .\GetVolumes.ps1 -Cluster 192.168.100.100 -Vserver vserver1
Enumerating cached credentials for Cluster "192.168.100.100"
Enumerating Volumes on Vserver "vserver1" on Cluster "192.168.100.100"

Name                      State       TotalSize  Used  Available Dedupe Aggregate                 Vserver
----                      -----       ---------  ----  --------- ------ ---------                 -------
volume1                   online        10.0 GB           5.0 GB        aggr1                     vserver1
volume2                   online        10.0 GB           8.0 GB        aggr1                     vserver1
volume3                   online        10.0 GB           9.0 GB        aggr1                     vserver1
vserver1_root             online         1.0 GB         961.6 MB        aggr1                     vserver1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that provides a useful example for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Matt&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2026 04:31:51 GMT</pubDate>
      <guid>https://community.netapp.com/t5/PowerShell-Discussions/PowerShell-Toolkit-stopped-working-to-create-shares-and-cant-figure-out-why/m-p/468041#M56</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2026-07-07T04:31:51Z</dc:date>
    </item>
  </channel>
</rss>

