Coder Social home page Coder Social logo

michelderooij / connect-office365services Goto Github PK

View Code? Open in Web Editor NEW
94.0 24.0 26.0 199 KB

Helper functions to connect to Office 365 services or Exchange On-Premises.

Home Page: https://eightwone.com/2015/08/31/connecting-to-office-365exchange/

License: MIT License

PowerShell 100.00%
exchange powershell msteams azuread microsoft

connect-office365services's Introduction

Connect-Office365Services

PowerShell script defining functions to connect to Office 365 online services or Exchange On-Premises. Call manually or alternatively embed or call from $profile (Shell or ISE) to make functions available in your session. If loaded from PowerShell_ISE, menu items are defined for the functions. To surpress creation of menu items, hold 'Shift' while Powershell ISE loads.

Getting Started

After execution, the following helper functions will be available:

  • Connect-AzureActiveDirectory Connects to Azure Active Directory
  • Connect-AzureRMS Connects to Azure Rights Management
  • Connect-ExchangeOnline Connects to Exchange Online
  • Connect-EOP Connects to Exchange Online Protection
  • Connect-ComplianceCenter Connects to Compliance Center
  • Connect-SharePointOnline Connects to SharePoint Online
  • Connect-MSTeams Connects to Microsoft Teams
  • Get-Office365Credentials Gets Office 365 credentials
  • Connect-ExchangeOnPremises Connects to Exchange On-Premises
  • Get-OnPremisesCredentials Gets On-Premises credentials
  • Get-ExchangeOnPremisesFQDNGets FQDN for Exchange On-Premises
  • Get-Office365Tenant Gets Office 365 tenant name
  • Set-Office365Environment Configures Uri's and region to use

Prerequisites

Script requires PowerShell 3.0 and higher and any modules installed you would like to use for connecting to Office 365 workloads.

Installing

Call the script ad-hoc, or load from PowerShell profile, e.g.

Store the script in the same location as your profile; default location is $ENV:UserProfile\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1)

Then, create a PowerShell profile when you have not done so yet:

notepad $Profile

and insert a line to load the script (making helper functions available):

& (Join-Path $PSScriptRoot "Connect-Office365Services.ps1")

Next time you open PowerShell, the script should load.

Contributing

N/A

Versioning

Initial version published on GitHub is 1.84. Changelog is contained in the script.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md for details.

Acknowledgments

N/A

connect-office365services's People

Contributors

ladewig avatar michelderooij avatar squazic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

connect-office365services's Issues

Packaging of this Script (Module)

Hello,

to make this wonderful script more widely available, could I ask you to publish it in a Module please?
I want to list it as a dependency in TeamsFunctions which I am building out at the moment.

The Module Updater is a piece of art, just wanted to write the same, though very crude in comparison :)

Thanks,
David

Check for Administrative privileges

When checking for administrative privileges use another method for verification.
Backstory: We use AccessDirector to elevate users temporarily and when using it the users is not in the administrators local group but user still have Administrator privileges.
When your script tests for Administrator privileges it looks at the group and therefore the user is denied using some features even though it is elevated to Administrator.

I tested using code below to verify my users privileges and this check returns the correct value.
$local:IsAdmin = $ThisPrincipal.IsInRole("Administrators")
changed to
$local:IsAdmin = $ThisPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

I changed this on lines 221 and 570 and i can now update modules and so on without doing it manually.
I have not tested on other systems where user is actually part of the Administrators group so please test this before merging into live code.

Disconnect-ExchangeOnline session management

Hi

I am curious to find out how can I disconnect a particular exchange online session. I don't want to kill all the sessions. I want to disconnect only from the session that was created by connect-exchangeonline earlier in a powershell script.

any pointers will be very helpful to my project.

thanks
Raj

Using the script

Hi, Michel..

When running the script, I only see this:

PowerShell 7.4.2


Connect-Office365Services v3.20
Environment:AzureCloud, Administrator:False
Architecture:AMD64, PS:7.4.2, PSGet:2.2.5, PackageManagement:1.4.8.1


Collecting Module information ..
Found Exchange Online Management module (v3.5.0)
Found SharePoint Online module (v16.0.24810.12000)
Found Microsoft Teams module (v6.2.0)
Found Microsoft.Graph module (v2.19.0)
Loading personal and system profiles took 1644ms.
PS C:\Users\MyUser>

I'm I doing something wrong ?

Thank you.

Integrating Office365 for all incoming mails.

When any user from the internet is posting mail to our mail server, ( for example, suppose I own contoso.com and I

am using office.outlook.com to connect to our mailbox).

When mail has been posted to contoso.com, I want to examine the mail before it reaches to end-user i.e. contoso.com.

Suppose I have an application called ContosoExaminerApp. Then my mail flow would be something like

Internet ---> ContosoExaminerApp(it can add some additional information or check for malicious mails) --> contoso.com(mail server/office 365)

How can we do that?

Enable Session reconnection for SkypeOnline

Hello,

Enable-CsOnlineSessionForReconnection is available in v7 of the SkypeOnlineConnector.
Could you incorporate this one?

Cheers,
David

My version of Connect-SkypeOnline has these lines in it:

      $moduleVersion = (Get-Module -Name SkypeOnlineConnector).Version
      Write-Host "SkypeOnlineConnector Module is v$ModuleVersion"
      if ($moduleVersion.Major -ge "7") # v7 and higher can run Session Limit Extension
      {
        Enable-CsOnlineSessionForReconnection -WarningAction SilentlyContinue
        Write-Verbose -Message "The PowerShell session reconnects and authenticates, allowing it to be re-used without having to launch a new instance to reconnect." -Verbose

      }
      else 
      {
        Write-Host "Your Session will time out after 60 min. - To prevent this, Update this module to v7 or higher, then run Enable-CsOnlineSessionForReconnection"
        Write-Host "You can download the Module here: https://www.microsoft.com/download/details.aspx?id=39366"
      }

Missing menu options using Ex OnPrem

From version in November 2022 to the latest version, no longer populates the exchange on-premise options - an earlier version I have (Version 2.71 April 29th, 2021) works as expected.

Update-Office365Modules failes on parameter -AllowPrerelease

v3.01 fails Update-Office365Modules with an error static that parameter AllowPrerelease is not supported with Find-Module.
Both on a W10 and W11 device. I only tested with response N on "Would you like to check for pre-release modules"?

Checking Exchange Online ManagementFind-Module : A parameter cannot be found that matches parameter name 'AllowPrerelease'.
At C:\Users\<snip>\Documents\WindowsPowerShell\Connect-Office365Services.ps1:807 char:98
+ ... Name $local:Item[3] -Repository $local:Repo -AllowPrerelease:$global: ...
+                                                 ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Find-Module], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Find-Module

Local:2.0.5 Online:N/A

Have to run Connect-ExchangeOnline twice

I've copied "Connect-Office365Services.ps1" and "Microsoft.PowerShell_profile.ps1" to $ENV:UserProfile\Documents\WindowsPowerShell and installed Exchange Online Management module as well.

I run Connect-ExchangeOnline and enter my username and password in the legacy login window and get the below error.
Screen Shot 2021-02-26 at 2 14 56 pm

But if I run Connect-ExchangeOnline again, it shows me the modern login window where I have to enter my credentials again and it works.

Is this how it's supposed to work or am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.