Files
claudetools/Reset-Password-ExchangeOnline.ps1

82 lines
3.3 KiB
PowerShell

# Reset password for notifications@dataforth.com using Exchange Online
# This works when Microsoft Graph permissions are insufficient
Write-Host "[OK] Resetting password via Azure AD (using web portal method)..." -ForegroundColor Green
Write-Host ""
$UserPrincipalName = "notifications@dataforth.com"
# Generate a strong password
Add-Type -AssemblyName System.Web
$NewPassword = [System.Web.Security.Membership]::GeneratePassword(16, 4)
Write-Host "================================================================"
Write-Host "PASSWORD RESET OPTIONS"
Write-Host "================================================================"
Write-Host ""
Write-Host "[OPTION 1] Use Azure AD Portal (Recommended - Always Works)" -ForegroundColor Cyan
Write-Host ""
Write-Host "1. Open browser to: https://portal.azure.com"
Write-Host "2. Navigate to: Azure Active Directory > Users"
Write-Host "3. Search for: notifications@dataforth.com"
Write-Host "4. Click 'Reset password'"
Write-Host "5. Use this generated password: $NewPassword" -ForegroundColor Yellow
Write-Host "6. UNCHECK 'Make this user change password on first sign in'"
Write-Host ""
Write-Host "[OPTION 2] Use PowerShell with Elevated Admin Account" -ForegroundColor Cyan
Write-Host ""
Write-Host "If you have a Global Admin account, connect to Azure AD:"
Write-Host ""
Write-Host "Install-Module AzureAD -Scope CurrentUser" -ForegroundColor Gray
Write-Host "Connect-AzureAD -TenantId 7dfa3ce8-c496-4b51-ab8d-bd3dcd78b584" -ForegroundColor Gray
Write-Host "`$Password = ConvertTo-SecureString '$NewPassword' -AsPlainText -Force" -ForegroundColor Gray
Write-Host "Set-AzureADUserPassword -ObjectId notifications@dataforth.com -Password `$Password -ForceChangePasswordNextSignIn `$false" -ForegroundColor Gray
Write-Host ""
Write-Host "================================================================"
Write-Host "RECOMMENDED PASSWORD"
Write-Host "================================================================"
Write-Host ""
Write-Host " $NewPassword" -ForegroundColor Yellow
Write-Host ""
Write-Host "SAVE THIS PASSWORD for the website configuration!"
Write-Host ""
# Save to file
$CredPath = "D:\ClaudeTools\dataforth-notifications-NEW-PASSWORD.txt"
@"
Dataforth Notifications Account - PASSWORD RESET
Generated: $(Get-Date -Format "yyyy-MM-dd HH:mm:ss")
Username: notifications@dataforth.com
NEW Password: $NewPassword
IMPORTANT: Password policy is already set to never expire!
You just need to reset the actual password.
SMTP Configuration for Website:
- Server: smtp.office365.com
- Port: 587
- TLS: Yes
- Username: notifications@dataforth.com
- Password: $NewPassword
STATUS:
- Password Never Expires: YES (already configured)
- Password Reset: PENDING (use Azure portal or PowerShell above)
DO NOT COMMIT TO GIT OR SHARE PUBLICLY
"@ | Out-File -FilePath $CredPath -Encoding UTF8
Write-Host "[OK] Instructions and password saved to:" -ForegroundColor Green
Write-Host " $CredPath" -ForegroundColor Cyan
Write-Host ""
Write-Host "================================================================"
Write-Host "AFTER RESETTING PASSWORD"
Write-Host "================================================================"
Write-Host "1. Update website SMTP config with new password"
Write-Host "2. Test: D:\ClaudeTools\Test-DataforthSMTP.ps1"
Write-Host "3. Verify: Get-MessageTrace -SenderAddress notifications@dataforth.com"
Write-Host ""