Code Monkey home page Code Monkey logo

posh365's Introduction

Posh365

Install
Set-ExecutionPolicy RemoteSigned
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Install-Module Posh365 -Force
Install without Admin Access
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Install-Module Posh365 -Force -Scope CurrentUser
Update Posh365
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Install-Module Posh365 -Force
Import-Module Posh365 -Force

Connect

Connect-Cloud Connect to one or more services: Az, AzureAD, Compliance, Exo2, MSOnline, SharePoint & Teams. Credentials are locally encrypted for reuse - no need to reenter credentials the next time you need to connect.

Connect-Cloud -Tenant Contoso -EXO2 -MSOnline -AzureAD
Connect-Cloud -Tenant Contoso -EXO2 -MSOnline -AzureAD -GCCHIGH
Connect-Cloud -Tenant Contoso -EXO2 -MFA #when using MFA
Connect-Cloud -Tenant Contoso -Teams
Connect-Cloud -Tenant Contoso -Teams -GCCHIGH
Connect-Cloud -Tenant Contoso -AZ
Connect-Cloud -Tenant Contoso -AZ -GCCHIGH
Connect-Cloud -Tenant Contoso -SharePoint
Connect-Cloud -Tenant Contoso -Compliance
Connect-Cloud -Tenant Contoso -DeleteCreds #Deletes locally encrypted creds only

New-ExoCBAConnection Create reusable Exchange Online Certificate Based Authentication (CBA) connections

New-ExoCBAConnection -Tenant Contoso
Connect-Cloud -Tenant Contoso -EXOCBA

Exchange_Online_Certificate_Based_Authentication_Function

Connect-CloudMFA Same as Connect-Cloud but includes built-in password manager GUI

Connect-CloudMFA -Tenant Contoso -EXO2 -MSOnline -AzureAD -Teams

Connect-Exchange Connect to Exchange on-premises

Connect-Exchange -Server EXHybrid #Encrypts and reuses creds locally
Connect-Exchange -Server EXHybrid -DontViewEntireForest
Connect-Exchange -Server EXHybrid -DeleteExchangeCreds #Deletes locally encrypted creds only

Export-GraphConfig Use a GUI to save/encrypt ClientID, TenantID, Secret, UserName & Password Connect-PoshGraph Use saved encrypted credentials to connnect to Graph and Azure APIs

Export-GraphConfig -Tenant Contoso
Connect-PoshGraph -Tenant Contoso

Discover Office 365

Get-DiscoveryOffice365 -Tenant Contoso -Verbose

Choose all items & click OK Choose Connection type & click OK

First time running this? Let's install PowerShellGet2:

1. Run: Connect-Cloud -Tenant Contoso -EXO2 2. Sign in as Global Admin & restart powershell when prompted 3. Run: Get-DiscoveryOffice365 -Tenant Contoso -Verbose

Discover On-Premises

Requires RSAT

Get-DiscoveryOnPrem -Verbose

1. Run: Get-Discovery -Verbose 2. Enter name of Exchange Server when prompted 3. Click link for Batches, copy/paste code on-premises 4. Click link for Permissions, copy/paste code on-premises 5. Add both documents to the root of SharePoint > Documents 6. Add BATCH01 to BatchName column in Batches.xlsx for pilot

Document to add to SharePoint Paste code on-premises (not EMS)
Batches.xlsx https://bit.ly/corebatches
Permissions.xlsx http://bit.ly/PermissionsScaled

Migrate from Hybrid to Office 365

Note: Each command presents a GUI for selection and confirmation Connect to Exchange Online. Connect-Cloud -Tenant Contoso -EXO2

Analyze Permissions

Update-MailboxMovePermissionBatch GUI to analyze permissions of mailboxes from Batches.xlsx. Will output new Batches.xlsx to desktop. Can add to SharePoint as new Batches file.

$params = @{
    SharePointURL = 'https://contoso.sharepoint.com/sites/migrate'
    ExcelFile     = 'Batches.xlsx'
}
Update-MailboxMovePermissionBatch @params

Migrate

Test-MailboxMove Test migration readiness of the mailboxes from Batches.xlsx. Of each user to be migrated, reports PASS or FAIL overall and individual on the following tests:

  • Verifies each smtp address domain is an accepted domain
  • Verifies mail user exists in Exchange Online
  • Verifies mailbox does not exist in Exchange Online
  • Verifies mail user is DirSynced
  • Verifies UserMailboxes accounts are not disabled
  • Verifies Routing Address is valid
  • Verifies UserPrincipalName matches PrimarySmtpAddress (Use -SkipUpnMatchSmtpTest to skip this test)
$params = @{
    SharePointURL = 'https://contoso.sharepoint.com/sites/migrate'
    ExcelFile     = 'Batches.xlsx'
}
Test-MailboxMove @params

New-MailboxMove Creates new move requests. Example uses batches file in SP site named "migrate". Use links in Discovery On-Premises to create Batches and Permissions files [ Link ]

$params = @{
    SharePointURL = 'https://contoso.sharepoint.com/sites/migrate'
    ExcelFile     = 'Batches.xlsx'
    RemoteHost    = 'hybrid.contoso.com'
    Tenant        = 'contoso'
}
New-MailboxMove @params
# For GCC/GCCHIGH tenants: use full tenant address as shown below:
$params = @{
    SharePointURL = 'https://contoso.sharepoint.com/sites/migrate'
    ExcelFile     = 'Batches.xlsx'
    RemoteHost    = 'hybrid.contoso.com'
    Tenant        = 'contoso.mail.onmicrosoft.us'
}
New-MailboxMove @params

Set-MailboxMove Set move requests

Set-MailboxMove -BadItemLimit 300 -LargeItemLimit 400

Suspend-MailboxMove Suspends move requests

Suspend-MailboxMove

Resume-MailboxMove Resumes move requests

Resume-MailboxMove
Resume-MailboxMove -DontAutoComplete

Remove-MailboxMove Removes move requests

Remove-MailboxMove

Complete-MailboxMove Complete move requests

Complete-MailboxMove
Complete-MailboxMove -Schedule #GUI presented to pick time, date, and users

Report on Migration

Get-MailboxMoveStatistics Gets move request statistics for any or all move requests. Multi-select or select all, click OK

Get-MailboxMoveStatistics
Get-MailboxMoveStatistics -IncludeCompleted

Get-MailboxMoveReport Gets full move request report - from present to past. The way it should be

Get-MailboxMoveReport

License

Set-MailboxMoveLicense GUI to license users via AzureAD

Connect to AzureAD Connect-Cloud -Tenant Contoso -AzureAD

Set-MailboxMoveLicense
Set-MailboxMoveLicense -MailboxCSV .\UserPrincipalName.csv

$params = @{
    SharePointURL = 'https://contoso.sharepoint.com/sites/migrate'
    ExcelFile     = 'Batches.xlsx'
 }
Set-MailboxMoveLicense @params

Get-MailboxMoveLicense Reports on user license Skus via AzureAD

Get-MailboxMoveLicense
Get-MailboxMoveLicense -OneSkuPerLine
Get-MailboxMoveLicense -OneSkuPerLine -ExportToExcel # file saved in Posh365 folder on desktop
Get-MailboxMoveLicense -IncludeRecipientType # Connect to EXO2

$params = @{
    SharePointURL = 'https://contoso.sharepoint.com/sites/migrate'
    ExcelFile     = 'Batches.xlsx'
 }
Get-MailboxMoveLicense @params

Get-MailboxMoveLicenseCount Reports on a tenant's consumed and total skus and options

Get-MailboxMoveLicenseCount

Get-MailboxMoveLicenseReport Reports on each user's assigned skus and options, csv and excel output

Get-MailboxMoveLicenseReport -Path C:\temp\

Mail Flow

Message Trace

Trace-Message GUI to trace Exchange Online messages. Select messages & click OK for trace details

Trace-Message # all messages from past 15 minutes
Trace-Message -StartSearchHoursAgo 6.3 -EndSearchHoursAgo 5 -Subject 'From the CEO'
Trace-Message -StartSearchHoursAgo 10 -Sender jane@Contoso.com
Trace-Message -Sender jane@Contoso.com -Recipient emily@Contoso.com

Trace-ExchangeMessage GUI to trace on-premises messages. Select messages & click OK for messageID details

Trace-ExchangeMessage # all messages from past 15 minutes
Trace-ExchangeMessage -StartSearchHoursAgo 10 -ExportToCsv
Trace-ExchangeMessage -StartSearchHoursAgo 10 -ExportToExcel -SkipHealthMessages

Administration

Managed Folder Assistant

Get-MfaStats Return Managed Folder Assistant statistics as an object. Switch to start the MFA too

'[email protected]' | Get-MfaStats
'[email protected]' | Get-MfaStats -StartMFA
(Import-CSV .\mailboxes.csv).UserPrincipalName | Get-MfaStats
(Import-CSV .\mailboxes.csv).UserPrincipalName | Get-MfaStats -StartMFA
(Get-EXOMailbox -Properties Office -Filter "Office -eq 'Redmond'").UserPrincipalName | Get-MfaStats
(Get-EXOMailbox -Properties Office -Filter "Office -eq 'Redmond'").UserPrincipalName | Get-MfaStats -StartMFA

Networking

Office365 Endpoints

Get-OfficeEndpoints URLs and IPs, initial and "changes since", CSV and Excel output (click to enlarge)

ME3V6nNhwV

posh365's People

Contributors

andrewtchilds avatar kevinblumenfeld avatar neckross 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

Watchers

 avatar  avatar  avatar  avatar  avatar

posh365's Issues

Additional Columns

Column for LicenseSuite
Column for EnableArchive
Column for ConvertToShared

Duplicate Get-ExchangeDistributionGroup

Get-EXOGroup.ps1 is the same script as Get-ExchangeDistributionGroup so can be removed for better understanding and code update.
The only difference is about the OU attribute. To me it is not a problem because this attribute also exists in Office 365.

MobileDevices report (Windows, iOS, Android)

I'm not sure "which" does it but I do know its missing info when pulling a report to find ALL devices (windows, ios and android) either from functions Get-O365Info or Get-365MobileDevice. Can you investigate? The reports are different.

you're using this on Get-O365Info
https://docs.microsoft.com/en-us/powershell/module/azuread/get-azureaddevice?view=azureadps-2.0

and you're using this on Get-365MobileDevice
https://docs.microsoft.com/en-us/powershell/module/exchange/devices/get-mobiledevice?view=exchange-ps

Get-OktaDiscovery

bro, can you make the output report of Get-OktaDiscovery to consolidate into a single XLSX file similar to Get-O365Info.
Thanks

Use Chris Dents method to lookup ugly to friendly sku

function ConvertTo-SkuName {
    [CmdletBinding()]
    param (
        [Parameter(ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [AllowEmptyString()]
        [String]$SkuID
    )

    process {
        if ($SkuID -and $SkuHash.Contains($SkuID)) {
            $SkuHash[$SkuID]
        }
    }
}

($User.AssignedLicenses | ConvertTo-SkuName) -join '|'

Add Get-365MsolGroupMember to Get-365Info

Hi,
Get-365Info is very useful but maybe you can add Get-365MsolGroupMember ?
Because in case of user is part of security group (not mail enable), it seems we do not get the info.

(PS : Very great work with Posh365, I use it a lot ๐Ÿ‘ )

Use a check for archiveDB for Get-OnPremExchangeMailboxStatistics

$ArchiveGB = Get-MailboxStatistics -identity ($Mailbox.Guid).ToString() -Archive -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | ForEach-Object {
    [Math]::Round([Double]($_.TotalItemSize -replace '^.*\(| .+$|,') / 1GB, 4)
}
# for example we are already doing this in EXO (remove foreach-object as seen also)
if ($Mailbox.ArchiveDatabase) {
    $ArchiveGB = Get-EXOMailboxStatistics -ExchangeGuid ($Mailbox.Guid).ToString() -Archive -Properties LastLogonTime -Verbose:$false | Select-Object @(
        @{
            Name       = 'ArchiveStat'
            Expression = { [Math]::Round([Double]($_.TotalItemSize -replace '^.*\(| .+$|,') / 1GB, 4) }
        }
    )
}

Add> Get-MailboxMoveCount

Get-MailboxMoveReport gives detailed information of each mbx
Get-MailboxMove gives only status on the mbx
Get-MailboxMoveStatistics gives mbx stats like PercentMigrated

We need one that pulls a quick report count on migrated mbxs example:
Get-MoveRequest -ResultSize Unlimited | group-object Status -NoElement | sort count -descending

DAP Connect-Cloud

Hello

I use the Connect-Cloud as it's perfect for connecting to my client's tenancies for running PowerShell against.

Would love the following couple of functionalities and thought there's no harm in asking.

  1. Command line switch to close and disconnect the session before starting another.
  2. Option to use "-tenant DAP" as a switch option that would then get the tenancies for which I have DAP access and then bring them up as a list for me to chose one from.

I'd love to be able to write something myself but it would probably take me months.

Get-DiscoveryUNIFORMnamespace

can you make it uniform the naming convention for Discovery?
ex. Get-DiscoveryO365, Get-DiscoveryOkta, Get-DiscoveryAzure, Get-DiscoveryOnPrem
Thanks

GUID instead of UserPrincipanName > Update functions

Please update functions for MailboxMove to use the ExchangeGuid instead of UserPrincipalName.

Sometimes we have remediations in the middle of the migration and we need to change UPN/SMTP/Alias, etc... in AD
However, that must reflect also in Batches.xlsx, but since we forget to update the sheet due to the number of remediations, then the New-MailboxMove fails because it still looking at the old incorrect value.

Thank you.

Anyway to pass in Creds to Connect-CloudMFA -ExchangeOnline

Looking to grab encrypted password and pass in creds programmatically however doesn't appear their is a parameter for -credentials ? Possible to incorporate or another way to programmatically pass creds into the Connect-CloudMFA -ExchangeOnline ?

Update Connect-Exchange function from external (-Authentication Basic)

function Connect-EMS_External {
ย 
param (
[Parameter(Mandatory = $False, ValueFromPipeline = $true)]
$ConnectionUri = "https://hybrid..com/PowerShell"
)
$UserCredential = Get-Credential -UserName "[email protected]" -Message "Enter DomainAdmin creds"
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ConnectionUri -Credential $UserCredential -Authentication Basic
Import-PSSession $Session
}
Connect-EMS_External

new Get-MailboxPerms for onprem mailboxes?

Hello,
I used this tool several years ago and I remember a function Get-MailboxPerms.ps1.
From version 0.9.7.6, this function is gone.
How can we get onprem mailbox permissions?

Connect-IPPSSession Not working

I am trying to execute the below command and it throws below error in Powershell 5.x ( Windows latest version).

Other commands such as Get-365Info are working fine.

Is there any option to pass the access / refresh token and convert to Credential object and use that for authentication. I seen few people doing that in their application. How we can do that? We can generate the Token via Oauth 2 and copy the token here and work out.

Stack trace:

PS C:\WINDOWS\system32> Connect-IPPSSession
Connect-IPPSSession : The term 'Connect-IPPSSession' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • Connect-IPPSSession
  •   + CategoryInfo          : ObjectNotFound: (Connect-IPPSSession:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

Get-MailboxMoveLicenseUserSku -All is throwing error

PS C:\Scripts> Get-MailboxMoveLicenseUserSku -All -OnePerLine
else : The term 'else' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\Scripts\git\kevinblumenfeld\Posh365\Posh365\Private\Migration\Invoke-GetMailboxMoveLicenseUserSku.ps1:99 char:25

  •                     else {
    
  •                     ~~~~
    
    • CategoryInfo : ObjectNotFound: (else:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Report on ACLobjects for migration (ALL) onprem and remote

#Report on ALL on-prem and remote mailboxes and validate changes show reflect (-1073741818)
$UserMbxs = Get-Mailbox -ResultSize Unlimited
$reportUserMbxs = foreach ($CurMbx in $UserMbxs) {
    $ACL = Get-ADUser -Identity "$($CurMbx.Guid)" -Properties *
    [PSCustomObject]@{
        DisplayName    = $CurMbx.DisplayName
        UPN            = $CurMbx.UserPrincipalName
        SMTP           = $CurMbx.PrimarySmtpAddress
        Type           = $CurMbx.RecipientType
        TypeDetails    = $CurMbx.RecipientTypeDetails
        ACLtype        = $ACL.msExchRecipientDisplayType.ToString()
        ACLtypeDetails = $ACL.msExchRecipientTypeDetails.ToString()
    }
}$reportUserMbxs | Export-Csv

$RemoteMbxs = Get-RemoteMailbox -ResultSize Unlimited
$reportRemoteMbxs = foreach ($CurMbx in $RemoteMbxs) {
    $ACL = Get-ADUser -Identity "$($CurMbx.Guid)" -Properties *
    [PSCustomObject]@{
        DisplayName    = $CurMbx.DisplayName
        UPN            = $CurMbx.UserPrincipalName
        SMTP           = $CurMbx.PrimarySmtpAddress
        Type           = $CurMbx.RecipientType
        TypeDetails    = $CurMbx.RecipientTypeDetails
        RemoteType     = $CurMbx.RemoteRecipientType
        ACLtype        = $ACL.msExchRecipientDisplayType.ToString()
        ACLtypeDetails = $ACL.msExchRecipientTypeDetails.ToString()
        RemoteACLtype  = $ACL.msExchRemoteRecipientType
    }
}$reportRemoteMbxs | Export-Csv

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.