<?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: WFA error message when creating new command in Active IQ Unified Manager Discussions</title>
    <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136005#M24665</link>
    <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I debugged the code for you, looks like i'd missed quotes around the command in code i'd previously posted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#'------------------------------------------------------------------------------
#'Enumerate the UNIX user mapping for the server.
#'------------------------------------------------------------------------------
[String]$command = Get-NcNameMappingUnixUser -Name $UnixServer -VserverContext $VServerName -ErrorAction Stop&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is example output of how i tested it externally to WFA in my lab using a powershell script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PS C:\&amp;gt; cd C:\Scripts\PowerShell\Projects\WFA\SetUserMapping
PS C:\Scripts\PowerShell\Projects\WFA\SetUserMapping&amp;gt; &lt;STRONG&gt;.\SetUserMapping.ps1 -Cluster cluster1 -VserverName vserver2 -UnixServer LINUX01&lt;/STRONG&gt;
Enumerated WFA installation Path from Registry key "hklm:\system\currentcontrolset\services\na_wfa_srv" as "C:\Program Files\NetApp\WFA"
Loading WFA profile
Executed Command: &lt;EM&gt;&lt;STRONG&gt;Connect-NcController -Name cluster1 -HTTPS -Credential $credentials -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Connected to cluster "cluster1"
Executed Command: &lt;EM&gt;&lt;STRONG&gt;Get-NcNameMappingUnixUser -Name LINUX01$ -VserverContext vserver2 -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Enumerated UNIX user mapping for server "LINUX01$" on vserver "vserver2"
Executed Command: &lt;EM&gt;&lt;STRONG&gt;Get-NcNameMappingUnixUser -Name L* -VserverContext vserver2 -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Enumerated UNIX user mapping for server "L*" on vserver "vserver2"

UserName             UserId GroupId Vserver                   FullName
--------             ------ ------- -------                   --------
LINUX01$              10000   65534 vserver2
Executed Command: &lt;EM&gt;&lt;STRONG&gt;New-NcNameMappingUnixUser -Name LINUX01$ -UserId 10000 -GroupId 65534 -VserverContext vserver2 -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Created user mapping for server "LINUX01$" UserID "10000" GroupID "65534" on vserver "vserver2"

PS C:\Scripts\PowerShell\Projects\WFA\SetUserMapping&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested it a few times just to make sure it increments the UserID for the host by incrementing 10K + 1. Works fine. Here is the source code for the above script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Param(
   [Parameter(Mandatory=$True, HelpMessage="The Cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory=$True, HelpMessage="The vserver name")]
   [String]$VserverName,
   [Parameter(Mandatory=$True, HelpMessage="The Unix server name to be created")]
   [String]$UnixServer
)
#'------------------------------------------------------------------------------
Function Get-WFALogger{
   Param(
      [Switch]$Info,
      [Switch]$Error,
      [Switch]$Warn,
      [String]$Message
   )
   If($Info){
      Write-Host $Message -foregroundColor green
   }
   If($Warn){
      Write-Host $Message -ForegroundColor yellow
   }
   If($Error){
      Write-Host $Message -ForegroundColor red
   }
}
#'------------------------------------------------------------------------------
Function Connect-WfaCluster{
   Param(
      [Parameter(Mandatory=$True, HelpMessage="The Cluster name or IP Address")]
      [String]$Node,
      [Parameter(Mandatory=$False, HelpMessage="The vserver name")]
      [String]$Vserver
   )
   $credentials = Get-Credential -Credential admin
   If($Vserver){
      [String]$command = "Connect-NcController -Name $Node -HTTPS -Credential `$credentials -Vserver $Vserver -ErrorAction Stop"
   }Else{
      [String]$command = "Connect-NcController -Name $Node -HTTPS -Credential `$credentials -ErrorAction Stop"
   }
   Try{
      Invoke-Expression -Command $command -ErrorAction Stop | Out-Null
      Get-WFALogger -Info -Message "Executed Command`: $command"
      If($Vserver){
         Get-WFALogger -Info -Message "Connected to cluster ""$Node"" vserver ""$Vserver"""
      }Else{
         Get-WFALogger -Info -Message "Connected to cluster ""$Node"""
      }
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      If($Vserver){
         Throw "Failed connecting to cluster ""$Node"" vserver ""$Vserver"""
      }Else{
         Throw "Failed connecting to cluster ""$Node"""
      }
   }
}
#'------------------------------------------------------------------------------
#'Initialization Section   
#'------------------------------------------------------------------------------
[String]$scriptPath     = Split-Path($MyInvocation.MyCommand.Path)
[String]$scriptSpec     = $MyInvocation.MyCommand.Definition
[String]$scriptBaseName = (Get-Item $scriptSpec).BaseName
[String]$scriptName     = (Get-Item $scriptSpec).Name
#'------------------------------------------------------------------------------
#'Enumerate the WFA install path from the registry
#'------------------------------------------------------------------------------
[String]$registryPath = "hklm:\system\currentcontrolset\services\na_wfa_srv";
Try{
   [System.Object]$result  = Get-ItemProperty -Path $registryPath -ErrorAction Stop
   [String]$wfaExeSpec     = $result.ImagePath.Split("/")[0].Trim() -Replace("""", "")
   [String]$wfaServicePath = $wfaExeSpec.SubString(0, $wfaExeSpec.LastIndexOf("\"))
   [String]$installPath    = $wfaServicePath.SubString(0, $wfaServicePath.LastIndexOf("\"))
   [Bool]$wfaInstalled     = $False
   If($installPath -ne $Null){
      [Bool]$wfaInstalled = $True
      Get-WFALogger -Info -Message "Enumerated WFA installation Path from Registry key ""$registryPath"" as ""$installPath"""
   }
}Catch{
   Get-WFALogger -Info -Message "WFA is not installed. Importing DataONTAP PowerShell module"
}
#'------------------------------------------------------------------------------
Try{
   If($wfaInstalled){
      Set-Location "$installPath\PoSH\"
      Get-WFALogger -Info -Message "Loading WFA profile"
      . '.\profile.ps1'
   }Else{
      Import-Module DataONTAP -ErrorAction Stop
   }
}Catch{
   If($wfaInstalled){
      Throw "Failed loading WFA profile ""$installPath\PoSH\profile.ps1"""
   }Else{
      Throw "Failed importing DataONTAP PowerShell module"
   }
}
Set-Location $scriptPath
#'------------------------------------------------------------------------------
#'Connect to the cluster
#'------------------------------------------------------------------------------
Connect-WFACluster $Cluster
#'------------------------------------------------------------------------------
#'Ensure the UNIX server ends with a '$' character.
#'------------------------------------------------------------------------------
If(-Not($UnixServer.EndsWith("`$"))){
   [String]$UnixServer = $($UnixServer.ToUpper() + "`$")
}
#'------------------------------------------------------------------------------
#'Enumerate the UNIX user mapping for the server.
#'------------------------------------------------------------------------------
[String]$command = "Get-NcNameMappingUnixUser -Name $UnixServer -VserverContext $VServerName -ErrorAction Stop"
Try{
   $result = Invoke-Expression -Command $command -ErrorAction Stop
   Get-WFALogger -Info -Message "Executed Command`: $command"
   Get-WFALogger -Info -Message "Enumerated UNIX user mapping for server ""$UnixServer"" on vserver ""$VserverName"""
}Catch{
   Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Throw "Failed enumerating UNIX user mapping for server ""$UnixServer"" on vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
#'Ensure the UNIX user mapping is created.
#'------------------------------------------------------------------------------
If($result.UserName -eq $UnixServer){
   Get-WFALogger -Info -Message "Unix account for server ""$UnixServer"" on ""$VserverName"" already exists"
}Else{
   [String]$command = "Get-NcNameMappingUnixUser -Name L`* -VserverContext $VServerName -ErrorAction Stop"
   Try{
      $result = Invoke-Expression -Command $command -ErrorAction Stop
      Get-WFALogger -Info -Message "Executed Command`: $command"
      Get-WFALogger -Info -Message "Enumerated UNIX user mapping for server ""L`*"" on vserver ""$VserverName"""
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      Throw "Failed enumerating UNIX user mapping for server ""L`*"" on vserver ""$VserverName"""
   }
   #'---------------------------------------------------------------------------
   #'Set the UNIX user mapping UID to 10000 if it doesn't exist otherwise increment.
   #'---------------------------------------------------------------------------
   If($result -eq $Null){
      [Int]$NextUID = 10000
   }Else{
      $UserIDs = $result.UserId
      $UserIDs = $UserIDs | Measure -Maximum
      If($UserIDs.Maximum -lt 10000){
         [Int]$NextUID = 10000
      }Else{
         [Int]$NextUID = $($UserIDs.Maximum + 1)
      }
   }
   [Int]$GroupID    = 65534
   [String]$command = "New-NcNameMappingUnixUser -Name $UnixServer -UserId $NextUID -GroupId $GroupID -VserverContext $VServerName -ErrorAction Stop"
   #'---------------------------------------------------------------------------
   #'Create the UNIX user mapping.
   #'---------------------------------------------------------------------------
   Try{
      Invoke-Expression -Command $command -ErrorAction Stop
      Get-WFALogger -Info -Message "Executed Command`: $command"
      Get-WFALogger -Info -Message "Created user mapping for server ""$UnixServer"" UserID ""$NextUID"" GroupID ""$GroupID"" on vserver ""$VserverName"""
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      Throw "Failed creating UNIX user mapping for server ""$UnixServer"" UserID ""$NextUID"" GroupID ""$GroupID"" on vserver ""$VserverName"""
   }
}
#'------------------------------------------------------------------------------&lt;/PRE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 00:03:34 GMT</pubDate>
    <dc:creator>mbeattie</dc:creator>
    <dc:date>2017-11-15T00:03:34Z</dc:date>
    <item>
      <title>WFA error message when creating new command</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/135974#M24653</link>
      <description>&lt;P&gt;I am trying to create a simple Powershell command in WFA to create a Unix user (this is my first attempt at creating my own command, so please bear with me).&amp;nbsp; I have created a Powershell script that runs fine from Powershell (minus the WFALogger commands), but when I copy the same script into a WFA command and run a test against it, I get the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;13:57:29.844 INFO&amp;nbsp; [Create Unix User] ### Command 'Create Unix User' in 'POWER_SHELL' ###&lt;BR /&gt;13:57:31.766 INFO&amp;nbsp; [Create Unix User] Using cached cluster connection&lt;BR /&gt;13:57:32.094 ERROR&amp;nbsp; [Create Unix User] Cannot bind argument to parameter 'FilterScript' because it is null.&lt;BR /&gt;13:57:32.219 ERROR&amp;nbsp; [Create Unix User] Failed executing command. Exception: Cannot bind argument to parameter 'FilterScript' because it is null.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The script checks for an existing account.&amp;nbsp; If one exists, it errors out.&amp;nbsp; If none exists, it sets the UID to 10000.&amp;nbsp; If a different account already exists, it increments to the the previous UID + 1:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;param (
  [parameter(Mandatory=$true, HelpMessage="Cluster address")]
  [string]$Cluster,
  
  [parameter(Mandatory=$true, HelpMessage="Storage Virtual Machine name")]
  [string]$VserverName,
  
  [parameter(Mandatory=$true, HelpMessage="Name of the Unix server to be created")]
  [string]$UnixServer
)

# connect to cluster
Connect-WFACluster $Cluster

$UnixServer = $UnixServer.ToUpper() + "$"

$FindServer = Get-NcNameMappingUnixUser -Name $UnixServer -VserverContext $VServerName

if ($FindServer.UserName -eq $UnixServer)
{
   Get-WFALogger -Info -message $("Unix account for server '" + $UnixServer + "' on Storage Virtual Machine '" + $VserverName + "' already exists'")
}

else
{
    $UnixAccounts = Get-NcNameMappingUnixUser -Name L* -VserverContext $VServerName
    if ($UnixAccounts -eq $NULL)
    {
        [int]$NextUID = 10000
    }
    else
    {         $UserIDs = $UnixAccounts.UserId
        $UserIDs = $UserIDs | measure -Maximum
        if ($UserIDs.Maximum -lt 10000)
        {
            [int]$NextUID = 10000
        }
        else
        { 
            [int]$NextUID = $UserIDs.Maximum + 1
        }
    }

#    Get-WFALogger -Info -message $("Creating Unix account for server '" + $UnixServer + "' on Storage Virtual Machine '" + $VserverName + "'")
    $expression = "New-NcNameMappingUnixUser -Name $UnixServer -UserId $NextUID -GroupId 65534 -VserverContext $VServerName"
    Invoke-Expression -ErrorAction Stop $expression
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any idea what I'm doing wrong?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 14:22:02 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/135974#M24653</guid>
      <dc:creator>Jim_Robertson</dc:creator>
      <dc:date>2025-06-04T14:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: WFA error message when creating new command</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/135981#M24656</link>
      <description>&lt;P&gt;Hi Jim_Robertson,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please remove the last single quote in Get-WFALoggers. The single quote is not matching&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Get-WFALogger -Info -message $("Unix account for server '" + $UnixServer + "' on Storage Virtual Machine '" + $VserverName + "' already exists'")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sundar&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 05:23:53 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/135981#M24656</guid>
      <dc:creator>sundarea</dc:creator>
      <dc:date>2017-11-14T05:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: WFA error message when creating new command</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/135982#M24657</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When coding WFA commands it can be useful when testing to troubleshoot your code externally to WFA. Check this out:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A title="http://www.wfaguy.com/2017/08/debug-wfa-in-your-powershell-editor.html" href="http://www.wfaguy.com/2017/08/debug-wfa-in-your-powershell-editor.html" target="_blank"&gt;http://www.wfaguy.com/2017/08/debug-wfa-in-your-powershell-editor.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a useful technique to help determine if it's a WFA problem or PowerShell coding issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking at your code, here a few "general" suggestions (which i certainly wish were more consistently adopted for WFA Certified Content)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create commands as strings then invoke the commands as expressions. This ensures you can log the command which is useful for troubleshooting (and change control)&lt;/LI&gt;&lt;LI&gt;Use comments in code within blocks (It will help you when you revisit your code or someone else has to read what you've written)&lt;/LI&gt;&lt;LI&gt;Always use error checking (try\catch) whenever executing any command&lt;/LI&gt;&lt;LI&gt;Always implement logging and error logging to ensure you capture the error message for troubleshooting.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;With that said, here is an updated version of you code (Note I haven't tested it) but you'll get the idea.&lt;/P&gt;&lt;P&gt;Please let me know if you have any questions&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: If you run this, download the logs then do a '&lt;EM&gt;&lt;STRONG&gt;find /i "Executed Command" *.log | clip&lt;/STRONG&gt;&lt;/EM&gt;" and paste it into notepad...an easy method to provide a run sheet for your RFC.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&lt;PRE&gt;Param(
   [Parameter(Mandatory=$True, HelpMessage="The Cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory=$True, HelpMessage="The vserver name")]
   [String]$VserverName,
   [Parameter(Mandatory=$True, HelpMessage="The Unix server name to be created")]
   [String]$UnixServer
)
#'------------------------------------------------------------------------------
#'Connect to the cluster
#'------------------------------------------------------------------------------
Connect-WFACluster $Cluster
#'------------------------------------------------------------------------------
#'Ensure the UNIX server ends with a '$' character.
#'------------------------------------------------------------------------------
If(-Not($UnixServer.EndsWith("`$"))){
   [String]$UnixServer = $($UnixServer.ToUpper() + "`$")
}
#'------------------------------------------------------------------------------
#'Enumerate the UNIX user mapping for the server.
#'------------------------------------------------------------------------------
[String]$command = Get-NcNameMappingUnixUser -Name $UnixServer -VserverContext $VServerName -ErrorAction Stop
Try{
   $result = Invoke-Expression -Command $command -ErrorAction Stop
   Get-WFALogger -Info -Message "Executed Command`: $command"
   Get-WFALogger -Info -Message "Enumerated UNIX user mapping for server ""$UnixServer"" on vserver ""$VserverName"""
}Catch{
   Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Throw "Failed enumerating UNIX user mapping for server ""$UnixServer"" on vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
#'Ensure the UNIX user mapping is created.
#'------------------------------------------------------------------------------
If($result.UserName -eq $UnixServer){
   Get-WFALogger -Info -Message "Unix account for server ""$UnixServer"" on ""$VserverName"" already exists"
}Else{
   [String]$command = "Get-NcNameMappingUnixUser -Name L`* -VserverContext $VServerName -ErrorAction Stop"
   Try{
      $result = Invoke-Expression -Command $command -ErrorAction Stop
      Get-WFALogger -Info -Message "Executed Command`: $command"
      Get-WFALogger -Info -Message "Enumerated UNIX user mapping for server ""L`*"" on vserver ""$VserverName"""
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      Throw "Failed enumerating UNIX user mapping for server ""L`*"" on vserver ""$VserverName"""
   }
   #'---------------------------------------------------------------------------
   #'Set the UNIX user mapping UID to 10000 if it doesn't exist otherwise increment.
   #'---------------------------------------------------------------------------
   If($result -eq $Null){
      [Int]$NextUID = 10000
   }Else{ &lt;BR /&gt;      $UserIDs = $result.UserId
      $UserIDs = $UserIDs | Measure -Maximum
      If($UserIDs.Maximum -lt 10000){
         [Int]$NextUID = 10000
      }Else{
         [Int]$NextUID = $($UserIDs.Maximum + 1)
      }
   }
   [Int]$GroupID    = 65534
   [String]$command = "New-NcNameMappingUnixUser -Name $UnixServer -UserId $NextUID -GroupId $GroupID -VserverContext $VServerName -ErrorAction Stop"
   #'---------------------------------------------------------------------------
   #'Create the UNIX user mapping.
   #'---------------------------------------------------------------------------
   Try{
      Invoke-Expression -Command $command -ErrorAction Stop
      Get-WFALogger -Info -Message "Executed Command`: $command"
      Get-WFALogger -Info -Message "Created user mapping for server ""$UnixServer"" UserID ""$NextUID"" GroupID ""$GroupID"" on vserver ""$VserverName"""
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      Throw "Failed creating UNIX user mapping for server ""$UnixServer"" UserID ""$NextUID"" GroupID ""$GroupID"" on vserver ""$VserverName"""
   }
}
#'------------------------------------------------------------------------------&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 08:50:02 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/135982#M24657</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2017-11-14T08:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: WFA error message when creating new command</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136000#M24662</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/11183"&gt;@sundarea&lt;/a&gt;, I tried just commenting out the entire WFALogger line, and I'm still getting the same error message, so I don't think that's it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/2305"&gt;@mbeattie&lt;/a&gt;, thank you very much for the detailed response!&amp;nbsp; I did try your code, but when I run a test from WFA, I am getting different errors.&amp;nbsp; But, hopefully you can teach me how to fish here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; I am familiar with the WFA Guy Blog.&amp;nbsp; I attended&amp;nbsp;one of&amp;nbsp;his&amp;nbsp;session at Insight in Las Vegas last month, and it was fantastic.&amp;nbsp; I have been trying to get time to go through more of the blog, but have been struggling with this instead.&lt;BR /&gt;&lt;BR /&gt;I did attempt to do the WFA debugging as indicated in the blog, but I'm getting&amp;nbsp;a ton of errors that don't make any sense to me.&amp;nbsp; I actually left a reply on his blog a few days ago, but if you're familiar with how it works, maybe you can help (and help others in the process!).&lt;BR /&gt;&lt;BR /&gt;This is what I posted on the blog:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;I tried to run this, and I'm getting errors just trying to run the ".\profile.ps1". Any idea what I'm doing wrong? I have WFA installed to my E: drive, but the profile script seems to account for that.

It spits out a ton of errors, but they are all similar to this:
Import-Module : The following error occurred while loading the extended type data file: , E:\Program Files\NetApp\WFA\PoSH\Modules\DataONTAP\DataONTAP.Type.ps1xml(1376) : Error in type "DataONTAP.Types.Iscsi.IscsiPortalListEntryInfo": The "Type" node must have "Members", "TypeConverters", or "TypeAdapters".

E:\Program Files\NetApp\WFA\PoSH\Modules\DataONTAP\DataONTAP.Type.ps1xml(1367) : Error in type "DataONTAP.PowerShell.SDK.Cmdlets.HyperV.MbrPartition": The "Type" node must have "Members", "TypeConverters", or "TypeAdapters".&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks for all your help!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 19:02:03 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136000#M24662</guid>
      <dc:creator>Jim_Robertson</dc:creator>
      <dc:date>2017-11-14T19:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: WFA error message when creating new command</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136005#M24665</link>
      <description>&lt;P&gt;Hi Jim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I debugged the code for you, looks like i'd missed quotes around the command in code i'd previously posted:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#'------------------------------------------------------------------------------
#'Enumerate the UNIX user mapping for the server.
#'------------------------------------------------------------------------------
[String]$command = Get-NcNameMappingUnixUser -Name $UnixServer -VserverContext $VServerName -ErrorAction Stop&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is example output of how i tested it externally to WFA in my lab using a powershell script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;PS C:\&amp;gt; cd C:\Scripts\PowerShell\Projects\WFA\SetUserMapping
PS C:\Scripts\PowerShell\Projects\WFA\SetUserMapping&amp;gt; &lt;STRONG&gt;.\SetUserMapping.ps1 -Cluster cluster1 -VserverName vserver2 -UnixServer LINUX01&lt;/STRONG&gt;
Enumerated WFA installation Path from Registry key "hklm:\system\currentcontrolset\services\na_wfa_srv" as "C:\Program Files\NetApp\WFA"
Loading WFA profile
Executed Command: &lt;EM&gt;&lt;STRONG&gt;Connect-NcController -Name cluster1 -HTTPS -Credential $credentials -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Connected to cluster "cluster1"
Executed Command: &lt;EM&gt;&lt;STRONG&gt;Get-NcNameMappingUnixUser -Name LINUX01$ -VserverContext vserver2 -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Enumerated UNIX user mapping for server "LINUX01$" on vserver "vserver2"
Executed Command: &lt;EM&gt;&lt;STRONG&gt;Get-NcNameMappingUnixUser -Name L* -VserverContext vserver2 -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Enumerated UNIX user mapping for server "L*" on vserver "vserver2"

UserName             UserId GroupId Vserver                   FullName
--------             ------ ------- -------                   --------
LINUX01$              10000   65534 vserver2
Executed Command: &lt;EM&gt;&lt;STRONG&gt;New-NcNameMappingUnixUser -Name LINUX01$ -UserId 10000 -GroupId 65534 -VserverContext vserver2 -ErrorAction Stop&lt;/STRONG&gt;&lt;/EM&gt;
Created user mapping for server "LINUX01$" UserID "10000" GroupID "65534" on vserver "vserver2"

PS C:\Scripts\PowerShell\Projects\WFA\SetUserMapping&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tested it a few times just to make sure it increments the UserID for the host by incrementing 10K + 1. Works fine. Here is the source code for the above script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Param(
   [Parameter(Mandatory=$True, HelpMessage="The Cluster name or IP Address")]
   [String]$Cluster,
   [Parameter(Mandatory=$True, HelpMessage="The vserver name")]
   [String]$VserverName,
   [Parameter(Mandatory=$True, HelpMessage="The Unix server name to be created")]
   [String]$UnixServer
)
#'------------------------------------------------------------------------------
Function Get-WFALogger{
   Param(
      [Switch]$Info,
      [Switch]$Error,
      [Switch]$Warn,
      [String]$Message
   )
   If($Info){
      Write-Host $Message -foregroundColor green
   }
   If($Warn){
      Write-Host $Message -ForegroundColor yellow
   }
   If($Error){
      Write-Host $Message -ForegroundColor red
   }
}
#'------------------------------------------------------------------------------
Function Connect-WfaCluster{
   Param(
      [Parameter(Mandatory=$True, HelpMessage="The Cluster name or IP Address")]
      [String]$Node,
      [Parameter(Mandatory=$False, HelpMessage="The vserver name")]
      [String]$Vserver
   )
   $credentials = Get-Credential -Credential admin
   If($Vserver){
      [String]$command = "Connect-NcController -Name $Node -HTTPS -Credential `$credentials -Vserver $Vserver -ErrorAction Stop"
   }Else{
      [String]$command = "Connect-NcController -Name $Node -HTTPS -Credential `$credentials -ErrorAction Stop"
   }
   Try{
      Invoke-Expression -Command $command -ErrorAction Stop | Out-Null
      Get-WFALogger -Info -Message "Executed Command`: $command"
      If($Vserver){
         Get-WFALogger -Info -Message "Connected to cluster ""$Node"" vserver ""$Vserver"""
      }Else{
         Get-WFALogger -Info -Message "Connected to cluster ""$Node"""
      }
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      If($Vserver){
         Throw "Failed connecting to cluster ""$Node"" vserver ""$Vserver"""
      }Else{
         Throw "Failed connecting to cluster ""$Node"""
      }
   }
}
#'------------------------------------------------------------------------------
#'Initialization Section   
#'------------------------------------------------------------------------------
[String]$scriptPath     = Split-Path($MyInvocation.MyCommand.Path)
[String]$scriptSpec     = $MyInvocation.MyCommand.Definition
[String]$scriptBaseName = (Get-Item $scriptSpec).BaseName
[String]$scriptName     = (Get-Item $scriptSpec).Name
#'------------------------------------------------------------------------------
#'Enumerate the WFA install path from the registry
#'------------------------------------------------------------------------------
[String]$registryPath = "hklm:\system\currentcontrolset\services\na_wfa_srv";
Try{
   [System.Object]$result  = Get-ItemProperty -Path $registryPath -ErrorAction Stop
   [String]$wfaExeSpec     = $result.ImagePath.Split("/")[0].Trim() -Replace("""", "")
   [String]$wfaServicePath = $wfaExeSpec.SubString(0, $wfaExeSpec.LastIndexOf("\"))
   [String]$installPath    = $wfaServicePath.SubString(0, $wfaServicePath.LastIndexOf("\"))
   [Bool]$wfaInstalled     = $False
   If($installPath -ne $Null){
      [Bool]$wfaInstalled = $True
      Get-WFALogger -Info -Message "Enumerated WFA installation Path from Registry key ""$registryPath"" as ""$installPath"""
   }
}Catch{
   Get-WFALogger -Info -Message "WFA is not installed. Importing DataONTAP PowerShell module"
}
#'------------------------------------------------------------------------------
Try{
   If($wfaInstalled){
      Set-Location "$installPath\PoSH\"
      Get-WFALogger -Info -Message "Loading WFA profile"
      . '.\profile.ps1'
   }Else{
      Import-Module DataONTAP -ErrorAction Stop
   }
}Catch{
   If($wfaInstalled){
      Throw "Failed loading WFA profile ""$installPath\PoSH\profile.ps1"""
   }Else{
      Throw "Failed importing DataONTAP PowerShell module"
   }
}
Set-Location $scriptPath
#'------------------------------------------------------------------------------
#'Connect to the cluster
#'------------------------------------------------------------------------------
Connect-WFACluster $Cluster
#'------------------------------------------------------------------------------
#'Ensure the UNIX server ends with a '$' character.
#'------------------------------------------------------------------------------
If(-Not($UnixServer.EndsWith("`$"))){
   [String]$UnixServer = $($UnixServer.ToUpper() + "`$")
}
#'------------------------------------------------------------------------------
#'Enumerate the UNIX user mapping for the server.
#'------------------------------------------------------------------------------
[String]$command = "Get-NcNameMappingUnixUser -Name $UnixServer -VserverContext $VServerName -ErrorAction Stop"
Try{
   $result = Invoke-Expression -Command $command -ErrorAction Stop
   Get-WFALogger -Info -Message "Executed Command`: $command"
   Get-WFALogger -Info -Message "Enumerated UNIX user mapping for server ""$UnixServer"" on vserver ""$VserverName"""
}Catch{
   Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
   Throw "Failed enumerating UNIX user mapping for server ""$UnixServer"" on vserver ""$VserverName"""
}
#'------------------------------------------------------------------------------
#'Ensure the UNIX user mapping is created.
#'------------------------------------------------------------------------------
If($result.UserName -eq $UnixServer){
   Get-WFALogger -Info -Message "Unix account for server ""$UnixServer"" on ""$VserverName"" already exists"
}Else{
   [String]$command = "Get-NcNameMappingUnixUser -Name L`* -VserverContext $VServerName -ErrorAction Stop"
   Try{
      $result = Invoke-Expression -Command $command -ErrorAction Stop
      Get-WFALogger -Info -Message "Executed Command`: $command"
      Get-WFALogger -Info -Message "Enumerated UNIX user mapping for server ""L`*"" on vserver ""$VserverName"""
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      Throw "Failed enumerating UNIX user mapping for server ""L`*"" on vserver ""$VserverName"""
   }
   #'---------------------------------------------------------------------------
   #'Set the UNIX user mapping UID to 10000 if it doesn't exist otherwise increment.
   #'---------------------------------------------------------------------------
   If($result -eq $Null){
      [Int]$NextUID = 10000
   }Else{
      $UserIDs = $result.UserId
      $UserIDs = $UserIDs | Measure -Maximum
      If($UserIDs.Maximum -lt 10000){
         [Int]$NextUID = 10000
      }Else{
         [Int]$NextUID = $($UserIDs.Maximum + 1)
      }
   }
   [Int]$GroupID    = 65534
   [String]$command = "New-NcNameMappingUnixUser -Name $UnixServer -UserId $NextUID -GroupId $GroupID -VserverContext $VServerName -ErrorAction Stop"
   #'---------------------------------------------------------------------------
   #'Create the UNIX user mapping.
   #'---------------------------------------------------------------------------
   Try{
      Invoke-Expression -Command $command -ErrorAction Stop
      Get-WFALogger -Info -Message "Executed Command`: $command"
      Get-WFALogger -Info -Message "Created user mapping for server ""$UnixServer"" UserID ""$NextUID"" GroupID ""$GroupID"" on vserver ""$VserverName"""
   }Catch{
      Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message)
      Throw "Failed creating UNIX user mapping for server ""$UnixServer"" UserID ""$NextUID"" GroupID ""$GroupID"" on vserver ""$VserverName"""
   }
}
#'------------------------------------------------------------------------------&lt;/PRE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 00:03:34 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136005#M24665</guid>
      <dc:creator>mbeattie</dc:creator>
      <dc:date>2017-11-15T00:03:34Z</dc:date>
    </item>
    <item>
      <title>Re: WFA error message when creating new command</title>
      <link>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136006#M24666</link>
      <description>&lt;P&gt;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/57034"&gt;@Jim_Robertson&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/2305"&gt;@mbeattie&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To Aid your Debugging powershell code in WFA, use this :&amp;nbsp;&lt;A href="http://community.netapp.com/t5/OnCommand-Storage-Management-Software-Discussions/Debugging-powershell-code-in-WFA-The-First-Aid/m-p/129914#M23441" target="_self"&gt;Debugging powershell code in WFA: The First Aid&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sinhaa&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 06:36:04 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Active-IQ-Unified-Manager-Discussions/WFA-error-message-when-creating-new-command/m-p/136006#M24666</guid>
      <dc:creator>sinhaa</dc:creator>
      <dc:date>2017-11-15T06:36:04Z</dc:date>
    </item>
  </channel>
</rss>

