Create list from string and add items after being verified


so working on script create groups sharepoint list. having trouble taking string of usernames, email addresses , full names converting list create groups.

#check owners ***needs work*** foreach($owner in $owners){ #$verifiedowners = $null #$verifiedowners = new-object system.collections.arraylist $verifiedowners = @() if (get-mailbox $owner -erroraction silentlycontinue) { $verifiedowners.add($owner) } else {notifyerror} }

here example of $owners contains:

user one, user.two@domain.com, chq-user3

the $owners variable pulling sharepoint list. results come in string format.

so want verify contents of original string , place verified value $verifiedowners list. use $verifiedowners list create group owners. have identical block doing members.

as can see, i've tried 3 different methods perform action. either getting 1 result or errors.


$verifiedowners+= $owner

\_(ツ)_/



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS