The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to register at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

Accessing the stored credentials in WFA for Vfiler dr resync

mteeuwen

How do I access the set of credentials that are stored in WFA from the PowerShell code in a command?

 

I need to do a vfiler dr resync on 7-Mode. There are no commands provided for that functionality, so I need to write it myself.

 

But the vfiler dr resync command needs to be executed on the dr filer, but then has to connect to the source filer:

Invoke-NaVfilerDrResync -RemoteVfiler $SourceVfiler -RemoteFiler $SourceFiler

 

This fails with the following error:
Parameter name: Credentials not provided in cmdlet argument or credentials cache.

 

So I need to specify the -Credential parameter. Are the WFA controller credentials accessible via a parameter?

 

2 REPLIES 2

mbeattie

Hi Marco,

 

The PowerShell code for the WFA command would be something like this:

 

#'------------------------------------------------------------------------------
Param(
    [parameter(Mandatory=$true, HelpMessage="The NetBIOS Hostname or IP address of the Source Controller")]
    [String]$SourceController,
    [parameter(Mandatory=$true, HelpMessage="The NetBIOS HostName or IP address of the Source Vfiler")]
    [String]$SourceVFiler
)
#'------------------------------------------------------------------------------
#'Enumerate Credentials and connect to the Source Controller
#'------------------------------------------------------------------------------
[System.Management.Automation.PSCredential]$Credentials = Get-WfaCredentials -Host $SourceController
Connect-WfaController -Array $SourceController
#'------------------------------------------------------------------------------
#'Invoke the vFiler DR Resync
#'------------------------------------------------------------------------------
Get-WFALogger -Info -Message $("Resyncing remote vfiler: " + $SourceVFiler + "@" + $SourceController)
[String]$command = "Invoke-NaVfilerDrResync -RemoteVfiler $SourceVFiler -RemoteFiler $SourceController"
Try{
    Invoke-NaVfilerDrResync -RemoteVfiler $SourceVFiler -RemoteFiler $SourceController -Credential $Credentials -Confirm:$False
   Get-WFALogger -Info -Message "Executed $command"
}Catch{
    [String]$errorMessage = $error[0].Exception.Message
    Get-WFALogger -Error -Message "Failed Executing $command. $errorMessage"
    Throw "Failed Executing $command. $errorMessage"
}
#'------------------------------------------------------------------------------

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

sinhaa

$Credentials = Get-WfaCredentials -HostName $myHost

 

where $myHost is the name/ip of the Host whose credentials are saved in WFA->Execution->Credentials

 

Read more about WFA cmdlets at : http://<wfa_server_name_or_ip>/wfa/wfa_docs/PoSH/docs/index.html . You can locate more documentation from WFA-> Help -> Support Links.

 

sinhaa

 

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public