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

Azure MFA with Azure AD and RDS

Failed to setup initiator portal. Error status is given in the dump data.

Invalid pointer on gpresult /h gpreport.html