Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

add object to an array

$
0
0

Hi

im trying to create an array that will hold 4 exchange databases info in it.

for so I start with:

@dbs=get-mailboxdatabase db1

works fine

then I try to add more databases like this but I get errors:

@dbs +=get-mailboxdatabase db2

Method invocation failed because [Microsoft.Exchange.Data.Directory.SystemConfiguration.MailboxDatabase] doesn't contain a method named 'op_ Addi tion'.

At line:1 char:8

+ $dbs += <<<< (Get-MailboxDatabase db2)

    + CategoryInfo          : InvalidOperation: (op_Addition:String) [], RuntimeException

    + FullyQualifiedErrorId : MethodNotFound

what am I missing here?

should I create an empty array first and then add them into it?

also is there away to run all 4 commands(for db1-4) in one liner and store it as variable/array?

Thanks


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images