Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $problem = $true
- while ($problem = $true) {
- try {
- $O365Cred = Get-Credential -message "Please enter your Office365 Admin credentials"
- $O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection -ea Stop
- Write-Output 'Logon Successful'
- $problem = $false
- Import-PSSession $O365Session -AllowClobber
- Connect-MsolService –Credential $O365Cred
- }
- catch {
- Write-Output 'Your username or password was incorrect, please try again'
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment