What are some commands that i should know in order to troubleshoot user and password issues in Office 365?
It’s extremely easy to get started using PowerShell with SharePoint Online or Office 365. Within a few simple steps and a few minutes you could be writing your very own PowerShell code for Office 365. For this you will need:
- A Windows computer with a 64-bit operating system. Ideally this will have Windows 7 or higher.
- An Office 365 subscription. A trial subscription will do fine
Download and install these packages on your computer:
- Microsoft Online Services Sign-In Assistant for IT Professionals BETA (64 bit version)
- Azure Active Directory Module for Windows PowerShell (64 bit version)
- SharePoint Online Management Shell (64 bit version)
Launch a PowerShell window as an Administrator Execute these lines of code: Set-ExecutionPolicy RemoteSigned Import-Module Microsoft.PowerShell.Utility Import-Module MSOnline -force Import-Module MSOnlineExtended -force Import-Module Microsoft.Online.SharePoint.PowerShell -force Next execute: $credential = Get-Credential This will prompt you for a username and password. Enter your Office 365 username and password then click OK: Finally to connect to Office 365 execute: Connect-MsolService -Credential $credential As a simple test you could check the Office 365 domain to which the session is connected using this command: Get-MsolDomain In order to manually sync the directory changes, follow the following steps: Open PowerShell Type: Set-ExecutionPolicy Unrestricted and hit return. Type: Import-Module DirSync and hit return. Type: Start-OnlineCoexistenceSync and hit return.Now that you have successfully forced the Directory Sync with Office 365 for changes. You may now want to check what’s synced and if it at all worked. Open the MIIS Client: “C:\Program Files\Windows Azure Active Directory Sync\SYNCBUS\Synchronization Service\UIShell\miisclient.exe”On the main screen that opens by default, you’ll see what all has been synced, and its detailed result. There are different section to this page. Clicking on any of the underlined item will show its details. If for any reason it doesn’t open the default screen (shown above), you can open it by clicking the Operations button on the top left side of the screen.
-Connect to Service Connect-MsolService -Export all users Get-MsolUser -All | select userprincipalname,immutableid | Out-File c:\users.txt Set-MsolUser -UserPrincipalName user@domain.org -ImmutableId b610M4VThEqOHyxiDPFDJQ== -ImmutableId is the objectGUID: from the Msol directory -Get List of users that did not sync yet Get-MsolUser -All | Where-Object{$_.lastdirsynctime -eq $null} | select displayname, userprincipalname | epcsv C:\list.csv -Force removal from Recycling bin Get-MsolUser -ReturnDeletedUsers -All | Remove-MsolUser -RemoveFromRecycleBin -Force -Start Sync Start-OnlineCoexistenceSync
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session When done: Remove-PSSession $Session