######################################################################### ### AutoLogin Script ### ######################################################################### Start-transcript Import-Module MSOnline Import-Module LyncOnlineConnector $TenantUserName = "o365admin@TENANTNAME.onmicrosoft.com" ######################################################################### ### This next line is password is the key you created earlier ### ### Remember you need the full path to it. ### ######################################################################### $TenantPassword = cat "C:\O365\key\TENANTNAME.key" | ConvertTo-SecureString $TenantCredentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $TenantUserName, $TenantPassword ######################################################################### ### Exchange Online ### ### Here you create a session for Exchange Online and connect to it ### ######################################################################### $exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $Tenantcredentials -Authentication "Basic" -AllowRedirection Import-PSSession $exchangeSession –AllowClobber ########################################################################## #### Skype For Business Online ### #### Here you create session for Skype Online and connect to it ### #### If you want to connect to Skype remove the ## in the lines below ### ########################################################################## ## $sfboSession = New-CsOnlineSession -Credential $Tenantcredentials ## Import-PSSession $sfboSession ########################################################################## ### Connect your Session to Office 365 ### ########################################################################## Connect-MsolService -Credential $TenantCredentials ########################################################################## #### This last part Grabs some info out of the Tenant #### #### and places it on the screen and title bar #### ########################################################################## $Company = Get-MsolCompanyInformation | select -exp DisplayName $InitialDomain = Get-MsolCompanyInformation | select -exp InitialDomain $host.ui.RawUI.WindowTitle = "You are connected to: " + $Company + " (" + $InitialDomain + ") " ########################################################################## ##### Happy Scripting ### ##########################################################################