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

Disconnect from Connect-MSOLService

$
0
0

I am updating my scripts to O365 in preparation for this migration. However, I do have a question. I am connecting using the following bit of script

Powershell
#Connect to O365 and licenses the userConnect-MsolServiceSet-MsolUserLicense-UserPrincipalName(-join($un,'@.com'))-AddLicenses

Do I need to disconnect from O365 like a normal session or just let it expire? I do not see a disconnect function for O365 so I wasn't sure.

Plus, I am already connecting one time before this in order to create the mailbox. Can I do the licensing at the same time as the mailbox creation or do these need to be in separate sessions?

Here is the code to the connection for the mailbox creation:

Powershell
#Connects to the Exchange box, creates the users email account, then disconnects from the Exchange box$mail=New-PSSession-ConfigurationNameMicrosoft....

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>