Remote PowerShell login Office 365 all modules
Remote
PowerShell login
SkypeForBusiness
NOTE:
if you are in an hybrid setup, you need to change the New-CsOnlineSession cmdlet. Else you would receive an error message: The remote server returned an error. (404) Not Found".
$SfBoSession = New-CsOnlineSession –Credential $credential –OverrideAdminDomain "yourdomain.onmicrosoft.com"
SharePoint
Exchange
Security
Logout
Run the following cmdlet to
set the user password to never expire
Requisites login into Office 365 Skype for Business Online are:
·
Running
OS must be 64bit
·
Microsoft
.NET Framework 4.5.x
·
PowerShell
Version 3.0 or higher
(if you need to install Version 3.0+, download and install Windows Management Framework 4.0: https://www.microsoft.com/en-us/download/details.aspx?id=40855)
(if you need to install Version 3.0+, download and install Windows Management Framework 4.0: https://www.microsoft.com/en-us/download/details.aspx?id=40855)
- You need to install the modules that are required for Office 365, SharePoint Online, and Skype for Business Online:
- Microsoft Online Service Sign-in
Assistant for IT Professionals RTW
(only for older systems : Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Vista) - Windows Azure Module for Windows PowerShell (64-bit version) -V2.0
- Install-Module MSOnline
- Download the Windows PowerShell module for Skype for Business Online
- Download the Windows PowerShell module for SharePoint Online
- Install MS Teams PS Module
Open a Windows PowerShell console.
Run the Install-Module cmdlet as shown here.
- PS> Install-Module -Name MicrosoftTeams
NOTE - MULTI-FACTOR AUTHENICATION:
Beside of Msol you must NOT use the $credential variable. Instead let the connect open the Login Frame
MicrosoftOnlineLogin
Set-ExecutionPolicy RemoteSigned
$credential = Get-Credential
Connect-MsolService -Credential $credential
Connect-MsolService -Credential $credential
Microsoft Teams
Connect-MicrosoftTeams -Credential $credential
Import-Module SkypeOnlineConnector
$SfBoSession = New-CsOnlineSession -Credential $credential
Import-PSSession $SfBoSession
$SfBoSession = New-CsOnlineSession -Credential $credential
Import-PSSession $SfBoSession
NOTE:
if you are in an hybrid setup, you need to change the New-CsOnlineSession cmdlet. Else you would receive an error message: The remote server returned an error. (404) Not Found".
$SfBoSession = New-CsOnlineSession –Credential $credential –OverrideAdminDomain "yourdomain.onmicrosoft.com"
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
$orgName = "<name of your Office 365 organization, e.g. tpoett>"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $credential
$orgName = "<name of your Office 365 organization, e.g. tpoett>"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $credential
Note:
orgName is not the DNS Name!
orgName is not the DNS Name!
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange
-ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential
$credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking
Import-PSSession $exchangeSession -DisableNameChecking
$ccSession = New-PSSession -ConfigurationName Microsoft.Exchange
-ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential
$credential -Authentication Basic -AllowRedirection
Import-PSSession $ccSession -Prefix cc
Import-PSSession $ccSession -Prefix cc
Remove-PSSession $sfboSession
Remove-PSSession $exchangeSession
Remove-PSSession $ccSession
Disconnect-SPOService
Remove-PSSession $exchangeSession
Remove-PSSession $ccSession
Disconnect-SPOService
Azure AD
Requirements:
PowerShell 6.x
.NET Framework 4.7.2
PowerShell 6.x
.NET Framework 4.7.2
Power Shell:
Install-Module -Name Az -AllowClobber
Connect-AzAccount
Update-Module -Name Az
Update-Module -Name Az
Enable-AzureRmAlias
Login-AzureRmAccount
Set a user's password to never expire
I strongly
urge you, that your admin user have the password set NEVER to never expire!
1. Connect to Windows PowerShell
by using your company admin credentials. Run the following cmdlet:
Connect-MsolService
Connect-MsolService
2.
In the Enter Credentials page, enter your Office 365
global admin credentials.
3.
After you enter your Office 365 credentials, do the
following:
o
To set the password of one user to never expire, run
the following cmdlet:
Set-MsolUser -UserPrincipalName <serviceaccount@contoso.com> -PasswordNeverExpires $true
Set-MsolUser -UserPrincipalName <serviceaccount@contoso.com> -PasswordNeverExpires $true
Find out whether a user's
password is set to never expire
1.
Connect to Windows PowerShell by using your company
admin credentials. Run the following cmdlet:
Connect-MsolService
Connect-MsolService
2.
Do the following:
o
To see whether a single user’s password is set to
never expire, run the following cmdlet by using the user principal name (UPN)
(for example, april@contoso.onmicrosoft.com) or the user ID of the user you
want to check:
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires
Author: Thomas Poett MVP, Business Unit Lead Microsoft Unified Communication
Get-MSOLUser -UserPrincipalName <user ID> | Select PasswordNeverExpires
Author: Thomas Poett MVP, Business Unit Lead Microsoft Unified Communication
great
ReplyDelete