NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Microsoft Virtualization Discussions

equal plus

JSHACHER11
7,318 Views

Hi guys,

I saw this in some scripts and could not get my head around it:

$filers += "filer1"

$filers += "filer2"

Can you please explain that?

Cheers

Joel

1 ACCEPTED SOLUTION

vinith
7,318 Views

It's done to add individual elements to an array.

$filers Is a array and individual filer names are added to the array.

View solution in original post

8 REPLIES 8

vinith
7,319 Views

It's done to add individual elements to an array.

$filers Is a array and individual filer names are added to the array.

JSHACHER11
7,318 Views

so it is the same as:

$filers = "filer1","filer2"

?

thanks

vinith
7,318 Views

Yes.

JSHACHER11
7,318 Views

great, thanks!

JGPSHNTAP
7,318 Views

Joel -

Don't take this the wrong way, but I would suggest grabbing a powershell book from amazon and flipping through it

Also, for general powershell questions, I would use a forum site @ powershell.com or powershell.org.

Even though i'm just a customer, this community is for Powershell for Netapp mainly

But to answer your questions += usually when you stuff an array of custom objects, and $filers = "1","2" - creates an array so you can do something like $filerrs | % { }

JSHACHER11
7,318 Views

I'm already reading a book by Dr. Tobias Weltner called "Matering PowerShell" but that issue wasn't mentioned there

Don't take this the wrong way but the way I see it, you can either answer my questions or not. If you think this is not the right question for you then don't answer and BTW, I really appreciate the help so far..

vinith
7,318 Views

JSHACHER11
7,318 Views

Looks good - I'll check it out

Thanks

Public