Files
claudetools/clients/dataforth/scripts/Reset-DataforthNotificationsPassword.ps1
Mike Swanson 5cbd49ce24 Reorganize repo: compartmentalize scripts by client/project
Move 150+ scripts from root and scripts/ into client/project directories:
- clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts)
- clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination)
- clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups)
- projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto)
- projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts)
- clients/glaztech/scripts/ (1 file: CentraStage removal)

Also reorganized:
- VPN scripts → infrastructure/vpn-configs/
- Retrieved API/JS files → api/
- Forum posts → projects/community-forum/forum-posts/
- SSH docs → clients/internal-infrastructure/docs/
- NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/
- ACG website files → projects/internal/acg-website-2025/
- Dataforth docs → clients/dataforth/docs/
- schema-retrieved.sql → docs/database/

Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history).
Root reduced from 220+ files to 62 items (docs + directories only).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 17:15:07 -07:00

106 lines
4.0 KiB
PowerShell

# Reset password for notifications@dataforth.com and set to never expire
# Using Microsoft Graph PowerShell (modern approach)
Write-Host "[OK] Resetting password for notifications@dataforth.com..." -ForegroundColor Green
Write-Host ""
# Check if Microsoft.Graph module is installed
if (-not (Get-Module -ListAvailable -Name Microsoft.Graph.Users)) {
Write-Host "[WARNING] Microsoft.Graph.Users module not installed" -ForegroundColor Yellow
Write-Host " Installing now..." -ForegroundColor Yellow
Install-Module Microsoft.Graph.Users -Scope CurrentUser -Force
}
# Connect to Microsoft Graph
Write-Host "[OK] Connecting to Microsoft Graph..." -ForegroundColor Green
Connect-MgGraph -Scopes "User.ReadWrite.All", "Directory.ReadWrite.All" -TenantId "7dfa3ce8-c496-4b51-ab8d-bd3dcd78b584"
# Generate a strong random password
Add-Type -AssemblyName System.Web
$NewPassword = [System.Web.Security.Membership]::GeneratePassword(16, 4)
Write-Host "[OK] Generated new password: $NewPassword" -ForegroundColor Cyan
Write-Host " SAVE THIS PASSWORD - you'll need it for the website config" -ForegroundColor Yellow
Write-Host ""
# Reset the password
$PasswordProfile = @{
Password = $NewPassword
ForceChangePasswordNextSignIn = $false
}
try {
Update-MgUser -UserId "notifications@dataforth.com" -PasswordProfile $PasswordProfile
Write-Host "[SUCCESS] Password reset successfully!" -ForegroundColor Green
} catch {
Write-Host "[ERROR] Failed to reset password: $($_.Exception.Message)" -ForegroundColor Red
exit 1
}
# Set password to never expire
Write-Host "[OK] Setting password to never expire..." -ForegroundColor Green
try {
Update-MgUser -UserId "notifications@dataforth.com" -PasswordPolicies "DisablePasswordExpiration"
Write-Host "[SUCCESS] Password set to never expire!" -ForegroundColor Green
} catch {
Write-Host "[ERROR] Failed to set password policy: $($_.Exception.Message)" -ForegroundColor Red
}
# Verify the settings
Write-Host ""
Write-Host "================================================================"
Write-Host "Verifying Configuration"
Write-Host "================================================================"
$User = Get-MgUser -UserId "notifications@dataforth.com" -Property UserPrincipalName,PasswordPolicies,LastPasswordChangeDateTime
Write-Host "[OK] User: $($User.UserPrincipalName)"
Write-Host " Password Policies: $($User.PasswordPolicies)"
Write-Host " Last Password Change: $($User.LastPasswordChangeDateTime)"
if ($User.PasswordPolicies -contains "DisablePasswordExpiration") {
Write-Host " [OK] Password will never expire" -ForegroundColor Green
} else {
Write-Host " [WARNING] Password expiration policy not confirmed" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "================================================================"
Write-Host "NEXT STEPS"
Write-Host "================================================================"
Write-Host "1. Update the website SMTP configuration with:" -ForegroundColor Cyan
Write-Host " - Username: notifications@dataforth.com"
Write-Host " - Password: $NewPassword" -ForegroundColor Yellow
Write-Host ""
Write-Host "2. Test SMTP authentication:"
Write-Host " D:\ClaudeTools\Test-DataforthSMTP.ps1"
Write-Host ""
Write-Host "3. Monitor for successful sends:"
Write-Host " Get-MessageTrace -SenderAddress notifications@dataforth.com -StartDate (Get-Date).AddHours(-1)"
Write-Host ""
# Save credentials to a secure file for reference
$CredPath = "D:\ClaudeTools\dataforth-notifications-creds.txt"
@"
Dataforth Notifications Account Credentials
Generated: $(Get-Date -Format "yyyy-MM-dd HH:mm:ss")
Username: notifications@dataforth.com
Password: $NewPassword
SMTP Configuration for Website:
- Server: smtp.office365.com
- Port: 587
- TLS: Yes
- Username: notifications@dataforth.com
- Password: $NewPassword
DO NOT COMMIT TO GIT OR SHARE PUBLICLY
"@ | Out-File -FilePath $CredPath -Encoding UTF8
Write-Host "[OK] Credentials saved to: $CredPath" -ForegroundColor Green
Write-Host " (Keep this file secure!)" -ForegroundColor Yellow
Disconnect-MgGraph