Microsoft Virtualization Discussions

Using Powershell to set Multiple addresses.


I'm having an issue trying to set the with multiple addresses.

I got it to work properly on an older (FAS2050 with OnTap 7.3.7) by doing this:

$partner = get-content C:\scripts\Powershell\content\partners.txt

set-naoption $partner

The partners.txt has 2 email addresses.

However when I try it on my new FAS6240 (OnTap 8.1.2 7mode) I keep getting this error:

Set-NaOption : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'OptionValue'. Specified method is not supported.

At line:1 char:37

+ set-naoption,

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (:) [Set-NaOption], ParameterBindingException

+ FullyQualifiedErrorId : CannotConvertArgument,DataONTAP.PowerShell.SDK.Cmdlets.Options.SetNaOption


Re: Using Powershell to set Multiple addresses.


i would probably go at it differently.  When you read stuff into a file it becomes in array that you would iterate through.  This doesn't seem the right case for it

It's easy to do something like

$partners = ","

  set-naoption $partners

View solution in original post

Re: Using Powershell to set Multiple addresses.


If I dropped the Variable and just did this:

set-naoption ","

I get an error stating that it was unable to set the option, however It works like a champ. The option is set and autosupport messages are going to all recipients.

Thanks for the help!!!!!!!!!!!!

Re: Using Powershell to set Multiple addresses.


That happens when you call set-naoption autosupport.doit to something too. I think that api has an issue. Just call it with -erroraction silentlycontinue to suppress the error.

Connected by DROID on Verizon Wireless

Earn Rewards for Your Review!
GPI Review Banner
All Community Forums