Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Using New-MailContact, Set-MailContact, and Set-Contact inside background jobs.

$
0
0

I'm trying to create a vast number of contacts in 365 using a script and would like to run parallel jobs to speed it up, I built a loop inside a job and tested it worked using the following inside the loop to make sure it could extract the correct variables from the CSV.

Powershell
$name=$c1.displaynameNew-Item-Path"C:\Temp\Output"-Name"$name"-ItemType"file"

Now when I attempt to run the loop with the commands in the title as below
Powershell
Connect-MsolService-cred$UserCredential
Powershell
$contacts=Import-Csv"C:\temp\testgal.csv"Start-Job-NameLoop-ScriptBlock{param([pscustomobject[]]$contacts,[System.Management.Automation.PSCredential[]]$UserCredential)$session2=New-PSSession-ConfigurationNameMicrosoft.Exchange-ConnectionUrihttps://outlook.office365.com/powershell-liveid-Credential$UserCredential...

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>