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>
This commit is contained in:
104
clients/internal-infrastructure/scripts/Reset-GiteaPassword.ps1
Normal file
104
clients/internal-infrastructure/scripts/Reset-GiteaPassword.ps1
Normal file
@@ -0,0 +1,104 @@
|
||||
# Reset Gitea password for mike@azcomputerguru.com via SSH
|
||||
# Runs on Jupiter server (172.16.3.20)
|
||||
|
||||
$JupiterHost = "172.16.3.20"
|
||||
$JupiterUser = "root"
|
||||
$JupiterPassword = "Th1nk3r^99##"
|
||||
|
||||
Write-Host "=== Gitea Password Reset ===" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Prompt for new password
|
||||
$NewPassword = Read-Host "Enter new Gitea password" -AsSecureString
|
||||
$ConfirmPassword = Read-Host "Confirm password" -AsSecureString
|
||||
|
||||
# Convert to plain text for comparison
|
||||
$NewPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
|
||||
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($NewPassword))
|
||||
$ConfirmPasswordPlain = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
|
||||
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($ConfirmPassword))
|
||||
|
||||
if ($NewPasswordPlain -ne $ConfirmPasswordPlain) {
|
||||
Write-Host "[ERROR] Passwords do not match" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($NewPasswordPlain)) {
|
||||
Write-Host "[ERROR] Password cannot be empty" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[1] Connecting to Jupiter server..." -ForegroundColor Yellow
|
||||
|
||||
# Build SSH command to reset Gitea password in Docker container
|
||||
$GiteaCommand = @"
|
||||
# Find Gitea Docker container
|
||||
echo '[1] Finding Gitea container...'
|
||||
CONTAINER=`$(docker ps --filter 'name=gitea' --format '{{.Names}}' | head -n 1)
|
||||
|
||||
if [ -z "`$CONTAINER" ]; then
|
||||
echo '[ERROR] Cannot find Gitea container'
|
||||
echo 'Available containers:'
|
||||
docker ps --format '{{.Names}}'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo '[OK] Found container: '`$CONTAINER
|
||||
echo ''
|
||||
echo '[2] Resetting password for mike@azcomputerguru.com...'
|
||||
|
||||
# Execute gitea admin command inside container
|
||||
# Try username 'mike' first, then email
|
||||
docker exec `$CONTAINER gitea admin user change-password --username mike --password '$NewPasswordPlain' 2>&1 || \
|
||||
docker exec `$CONTAINER gitea admin user change-password --username mike@azcomputerguru.com --password '$NewPasswordPlain' 2>&1
|
||||
|
||||
if [ `$? -eq 0 ]; then
|
||||
echo ''
|
||||
echo '[SUCCESS] Password changed successfully!'
|
||||
exit 0
|
||||
else
|
||||
echo ''
|
||||
echo '[ERROR] Failed to change password'
|
||||
exit 1
|
||||
fi
|
||||
"@
|
||||
|
||||
# Execute via SSH using plink (or ssh if available)
|
||||
try {
|
||||
if (Get-Command plink -ErrorAction SilentlyContinue) {
|
||||
# Use PuTTY's plink
|
||||
$result = echo y | plink -ssh -batch -pw $JupiterPassword "$JupiterUser@$JupiterHost" $GiteaCommand 2>&1
|
||||
} elseif (Get-Command ssh -ErrorAction SilentlyContinue) {
|
||||
# Use OpenSSH
|
||||
# Note: This will prompt for password interactively
|
||||
Write-Host "[INFO] Using OpenSSH - you'll need to enter root password: $JupiterPassword" -ForegroundColor Yellow
|
||||
$result = ssh "$JupiterUser@$JupiterHost" $GiteaCommand 2>&1
|
||||
} else {
|
||||
Write-Host "[ERROR] No SSH client found (plink or ssh)" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Write-Host "Manual steps:" -ForegroundColor Yellow
|
||||
Write-Host "1. SSH to Jupiter: ssh root@172.16.3.20" -ForegroundColor Gray
|
||||
Write-Host "2. Find container: docker ps | grep gitea" -ForegroundColor Gray
|
||||
Write-Host "3. Reset password: docker exec <container_name> gitea admin user change-password --username mike --password 'YOUR_PASSWORD'" -ForegroundColor Gray
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host $result
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== Password Reset Complete ===" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
Write-Host "Login at: https://git.azcomputerguru.com/" -ForegroundColor Green
|
||||
Write-Host "Username: mike@azcomputerguru.com (or just 'mike')" -ForegroundColor Green
|
||||
Write-Host "Password: (the one you just set)" -ForegroundColor Green
|
||||
|
||||
} catch {
|
||||
Write-Host ""
|
||||
Write-Host "[ERROR] Failed to connect: $($_.Exception.Message)" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Write-Host "Manual alternative:" -ForegroundColor Yellow
|
||||
Write-Host "1. SSH to Jupiter: ssh root@172.16.3.20 (password: $JupiterPassword)" -ForegroundColor Gray
|
||||
Write-Host "2. Find Gitea container: docker ps | grep gitea" -ForegroundColor Gray
|
||||
Write-Host "3. Reset password: docker exec <container_name> gitea admin user change-password --username mike --password 'YOUR_PASSWORD'" -ForegroundColor Gray
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
# 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 ""
|
||||
@@ -0,0 +1,165 @@
|
||||
# Add Rob Williams and Howard to all GDAP Security Groups
|
||||
# This fixes CIPP access issues for multiple users
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Configuration
|
||||
$TenantId = "ce61461e-81a0-4c84-bb4a-7b354a9a356d"
|
||||
$ClientId = "fabb3421-8b34-484b-bc17-e46de9703418"
|
||||
$ClientSecret = "~QJ8Q~NyQSs4OcGqHZyPrA2CVnq9KBfKiimntbMO"
|
||||
|
||||
# Users to add to GDAP groups
|
||||
$UsersToAdd = @(
|
||||
"rob@azcomputerguru.com",
|
||||
"howard@azcomputerguru.com"
|
||||
)
|
||||
|
||||
# GDAP Groups (from analysis)
|
||||
$GdapGroups = @(
|
||||
@{Name="M365 GDAP Cloud App Security Administrator"; Id="009e46ef-3ffa-48fb-9568-7e8cb7652200"},
|
||||
@{Name="M365 GDAP Application Administrator"; Id="16e99bf8-a0bc-41d3-adf7-ce89310cece5"},
|
||||
@{Name="M365 GDAP Teams Administrator"; Id="35fafd80-498c-4c62-a947-ea230835d9f1"},
|
||||
@{Name="M365 GDAP Security Administrator"; Id="3ca0d8b1-a6fc-4e77-a955-2a7d749d27b4"},
|
||||
@{Name="M365 GDAP Privileged Role Administrator"; Id="49b1b90d-d7bf-4585-8fe2-f2a037f7a374"},
|
||||
@{Name="M365 GDAP Cloud Device Administrator"; Id="8e866fc5-c4bd-4ce7-a273-385857a4f3b4"},
|
||||
@{Name="M365 GDAP Exchange Administrator"; Id="92401e16-c217-4330-9bbd-6a978513452d"},
|
||||
@{Name="M365 GDAP User Administrator"; Id="baf461df-c675-4f9e-a4a3-8f03c6fe533d"},
|
||||
@{Name="M365 GDAP Privileged Authentication Administrator"; Id="c593633a-2957-4069-ae7e-f862a0896b67"},
|
||||
@{Name="M365 GDAP Intune Administrator"; Id="daad8ec5-d044-4d4c-bae7-5df98a637c95"},
|
||||
@{Name="M365 GDAP SharePoint Administrator"; Id="fa55c8c1-34e3-46b7-912e-f4d303081a82"},
|
||||
@{Name="M365 GDAP Authentication Policy Administrator"; Id="fdf38f92-8dd1-470d-8ce8-58f663235789"},
|
||||
@{Name="AdminAgents"; Id="ecc00632-9de6-4932-a62b-de57b72c1414"}
|
||||
)
|
||||
|
||||
Write-Host "[INFO] Authenticating to Microsoft Graph..." -ForegroundColor Cyan
|
||||
|
||||
# Get access token
|
||||
$TokenBody = @{
|
||||
client_id = $ClientId
|
||||
client_secret = $ClientSecret
|
||||
scope = "https://graph.microsoft.com/.default"
|
||||
grant_type = "client_credentials"
|
||||
}
|
||||
|
||||
$TokenResponse = Invoke-RestMethod -Method Post `
|
||||
-Uri "https://login.microsoftonline.com/$TenantId/oauth2/v2.0/token" `
|
||||
-Body $TokenBody
|
||||
|
||||
$Headers = @{
|
||||
Authorization = "Bearer $($TokenResponse.access_token)"
|
||||
}
|
||||
|
||||
Write-Host "[OK] Authenticated successfully" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
|
||||
# Process each user
|
||||
$TotalSuccessCount = 0
|
||||
$TotalSkippedCount = 0
|
||||
$TotalErrorCount = 0
|
||||
|
||||
foreach ($UserUpn in $UsersToAdd) {
|
||||
Write-Host "="*80 -ForegroundColor Cyan
|
||||
Write-Host "PROCESSING USER: $UserUpn" -ForegroundColor Cyan
|
||||
Write-Host "="*80 -ForegroundColor Cyan
|
||||
|
||||
# Get user ID
|
||||
Write-Host "[INFO] Looking up user..." -ForegroundColor Cyan
|
||||
try {
|
||||
$User = Invoke-RestMethod -Method Get `
|
||||
-Uri "https://graph.microsoft.com/v1.0/users/$UserUpn" `
|
||||
-Headers $Headers
|
||||
|
||||
Write-Host "[OK] Found user:" -ForegroundColor Green
|
||||
Write-Host " Display Name: $($User.displayName)"
|
||||
Write-Host " UPN: $($User.userPrincipalName)"
|
||||
Write-Host " ID: $($User.id)"
|
||||
Write-Host ""
|
||||
|
||||
$UserId = $User.id
|
||||
}
|
||||
catch {
|
||||
Write-Host "[ERROR] User not found: $($_.Exception.Message)" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
continue
|
||||
}
|
||||
|
||||
# Add user to each group
|
||||
$SuccessCount = 0
|
||||
$SkippedCount = 0
|
||||
$ErrorCount = 0
|
||||
|
||||
foreach ($Group in $GdapGroups) {
|
||||
Write-Host "[INFO] Adding to: $($Group.Name)" -ForegroundColor Cyan
|
||||
|
||||
# Check if already a member
|
||||
try {
|
||||
$Members = Invoke-RestMethod -Method Get `
|
||||
-Uri "https://graph.microsoft.com/v1.0/groups/$($Group.Id)/members" `
|
||||
-Headers $Headers
|
||||
|
||||
$IsMember = $Members.value | Where-Object { $_.id -eq $UserId }
|
||||
|
||||
if ($IsMember) {
|
||||
Write-Host "[SKIP] Already a member" -ForegroundColor Yellow
|
||||
$SkippedCount++
|
||||
continue
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "[WARNING] Could not check membership: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Add to group
|
||||
try {
|
||||
$Body = @{
|
||||
"@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/$UserId"
|
||||
} | ConvertTo-Json
|
||||
|
||||
Invoke-RestMethod -Method Post `
|
||||
-Uri "https://graph.microsoft.com/v1.0/groups/$($Group.Id)/members/`$ref" `
|
||||
-Headers $Headers `
|
||||
-Body $Body `
|
||||
-ContentType "application/json" | Out-Null
|
||||
|
||||
Write-Host "[SUCCESS] Added to group" -ForegroundColor Green
|
||||
$SuccessCount++
|
||||
}
|
||||
catch {
|
||||
Write-Host "[ERROR] Failed to add: $($_.Exception.Message)" -ForegroundColor Red
|
||||
$ErrorCount++
|
||||
}
|
||||
|
||||
Start-Sleep -Milliseconds 500 # Rate limiting
|
||||
}
|
||||
|
||||
# User summary
|
||||
Write-Host ""
|
||||
Write-Host "Summary for $($User.displayName):" -ForegroundColor Cyan
|
||||
Write-Host " Successfully added: $SuccessCount groups" -ForegroundColor Green
|
||||
Write-Host " Already member of: $SkippedCount groups" -ForegroundColor Yellow
|
||||
Write-Host " Errors: $ErrorCount groups" -ForegroundColor $(if($ErrorCount -gt 0){"Red"}else{"Green"})
|
||||
Write-Host ""
|
||||
|
||||
$TotalSuccessCount += $SuccessCount
|
||||
$TotalSkippedCount += $SkippedCount
|
||||
$TotalErrorCount += $ErrorCount
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "="*80 -ForegroundColor Cyan
|
||||
Write-Host "FINAL SUMMARY" -ForegroundColor Cyan
|
||||
Write-Host "="*80 -ForegroundColor Cyan
|
||||
Write-Host "Total users processed: $($UsersToAdd.Count)"
|
||||
Write-Host "Total additions: $TotalSuccessCount groups" -ForegroundColor Green
|
||||
Write-Host "Total already members: $TotalSkippedCount groups" -ForegroundColor Yellow
|
||||
Write-Host "Total errors: $TotalErrorCount groups" -ForegroundColor $(if($TotalErrorCount -gt 0){"Red"}else{"Green"})
|
||||
Write-Host ""
|
||||
|
||||
if ($TotalSuccessCount -gt 0 -or $TotalSkippedCount -gt 0) {
|
||||
Write-Host "[OK] Users should now be able to access all client tenants through CIPP!" -ForegroundColor Green
|
||||
Write-Host "[INFO] It may take 5-10 minutes for group membership to fully propagate." -ForegroundColor Cyan
|
||||
Write-Host "[INFO] Ask users to sign out of CIPP and sign back in." -ForegroundColor Cyan
|
||||
}
|
||||
else {
|
||||
Write-Host "[WARNING] Some operations failed. Review errors above." -ForegroundColor Yellow
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
# Check if Node.js server is running on AD2
|
||||
Write-Host "[OK] Checking Node.js server status..." -ForegroundColor Green
|
||||
|
||||
# Test 1: Check port 3000
|
||||
Write-Host "`n[TEST 1] Testing port 3000..." -ForegroundColor Cyan
|
||||
$portTest = Test-NetConnection -ComputerName 192.168.0.6 -Port 3000 -WarningAction SilentlyContinue -InformationLevel Quiet
|
||||
|
||||
if ($portTest) {
|
||||
Write-Host " [OK] Port 3000 is OPEN" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " [ERROR] Port 3000 is CLOSED" -ForegroundColor Red
|
||||
Write-Host " [INFO] Node.js server is not running" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
# Test 2: Check Node.js processes (via SMB)
|
||||
Write-Host "`n[TEST 2] Checking for Node.js processes..." -ForegroundColor Cyan
|
||||
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
||||
|
||||
try {
|
||||
$nodeProcs = Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
||||
Get-Process node -ErrorAction SilentlyContinue | Select-Object Id, ProcessName, @{Name='Memory(MB)';Expression={[math]::Round($_.WorkingSet64/1MB,2)}}, Path
|
||||
} -ErrorAction Stop
|
||||
|
||||
if ($nodeProcs) {
|
||||
Write-Host " [OK] Node.js process(es) found:" -ForegroundColor Green
|
||||
$nodeProcs | Format-Table -AutoSize
|
||||
} else {
|
||||
Write-Host " [ERROR] No Node.js process found" -ForegroundColor Red
|
||||
}
|
||||
} catch {
|
||||
Write-Host " [WARNING] WinRM check failed: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
Write-Host " [INFO] Cannot verify via WinRM, but port test is more reliable" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
Write-Host "`n[SUMMARY]" -ForegroundColor Cyan
|
||||
if (!$portTest) {
|
||||
Write-Host " Node.js server is NOT running" -ForegroundColor Red
|
||||
Write-Host "`n [ACTION] Start the server on AD2:" -ForegroundColor Yellow
|
||||
Write-Host " cd C:\Shares\testdatadb" -ForegroundColor Cyan
|
||||
Write-Host " node server.js" -ForegroundColor Cyan
|
||||
} else {
|
||||
Write-Host " Node.js server appears to be running" -ForegroundColor Green
|
||||
Write-Host " But API endpoints are not responding - check server logs" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "`n[OK] Done" -ForegroundColor Green
|
||||
@@ -0,0 +1,37 @@
|
||||
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
||||
|
||||
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
||||
Write-Host "=== Files in _COMMON\ProdSW ===" -ForegroundColor Yellow
|
||||
Get-ChildItem "C:\Shares\test\_COMMON\ProdSW" -File |
|
||||
Select-Object Name, Length, LastWriteTime |
|
||||
Sort-Object Name |
|
||||
Format-Table -AutoSize
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== Files in COMMON\ProdSW ===" -ForegroundColor Yellow
|
||||
Get-ChildItem "C:\Shares\test\COMMON\ProdSW" -File |
|
||||
Select-Object Name, Length, LastWriteTime |
|
||||
Sort-Object Name |
|
||||
Format-Table -AutoSize
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== Files ONLY in _COMMON\ProdSW ===" -ForegroundColor Cyan
|
||||
$underFiles = Get-ChildItem "C:\Shares\test\_COMMON\ProdSW" -File | Select-Object -ExpandProperty Name
|
||||
$commonFiles = Get-ChildItem "C:\Shares\test\COMMON\ProdSW" -File | Select-Object -ExpandProperty Name
|
||||
$onlyInUnder = $underFiles | Where-Object { $_ -notin $commonFiles }
|
||||
if ($onlyInUnder) {
|
||||
$onlyInUnder | ForEach-Object { Write-Host " $_" -ForegroundColor White }
|
||||
} else {
|
||||
Write-Host " (none)" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "=== Files ONLY in COMMON\ProdSW ===" -ForegroundColor Cyan
|
||||
$onlyInCommon = $commonFiles | Where-Object { $_ -notin $underFiles }
|
||||
if ($onlyInCommon) {
|
||||
$onlyInCommon | ForEach-Object { Write-Host " $_" -ForegroundColor White }
|
||||
} else {
|
||||
Write-Host " (none)" -ForegroundColor Gray
|
||||
}
|
||||
}
|
||||
80
clients/internal-infrastructure/scripts/create-task-xml.ps1
Normal file
80
clients/internal-infrastructure/scripts/create-task-xml.ps1
Normal file
@@ -0,0 +1,80 @@
|
||||
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
||||
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
||||
|
||||
Write-Host "Creating Sync Task via XML..." -ForegroundColor Cyan
|
||||
|
||||
Invoke-Command -ComputerName 192.168.0.6 -Credential $cred -ScriptBlock {
|
||||
# Create task XML
|
||||
$taskXml = @'
|
||||
<?xml version="1.0" encoding="UTF-16"?>
|
||||
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
||||
<RegistrationInfo>
|
||||
<Description>Sync test data and software updates between NAS and AD2</Description>
|
||||
</RegistrationInfo>
|
||||
<Triggers>
|
||||
<TimeTrigger>
|
||||
<Repetition>
|
||||
<Interval>PT15M</Interval>
|
||||
<StopAtDurationEnd>false</StopAtDurationEnd>
|
||||
</Repetition>
|
||||
<StartBoundary>2026-01-20T10:00:00</StartBoundary>
|
||||
<Enabled>true</Enabled>
|
||||
</TimeTrigger>
|
||||
</Triggers>
|
||||
<Principals>
|
||||
<Principal id="Author">
|
||||
<UserId>INTRANET\sysadmin</UserId>
|
||||
<LogonType>Password</LogonType>
|
||||
<RunLevel>HighestAvailable</RunLevel>
|
||||
</Principal>
|
||||
</Principals>
|
||||
<Settings>
|
||||
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
|
||||
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
||||
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
||||
<AllowHardTerminate>true</AllowHardTerminate>
|
||||
<StartWhenAvailable>true</StartWhenAvailable>
|
||||
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
|
||||
<AllowStartOnDemand>true</AllowStartOnDemand>
|
||||
<Enabled>true</Enabled>
|
||||
<ExecutionTimeLimit>PT30M</ExecutionTimeLimit>
|
||||
</Settings>
|
||||
<Actions Context="Author">
|
||||
<Exec>
|
||||
<Command>powershell.exe</Command>
|
||||
<Arguments>-ExecutionPolicy Bypass -NonInteractive -File "C:\Shares\test\scripts\Sync-FromNAS.ps1"</Arguments>
|
||||
<WorkingDirectory>C:\Shares\test\scripts</WorkingDirectory>
|
||||
</Exec>
|
||||
</Actions>
|
||||
</Task>
|
||||
'@
|
||||
|
||||
# Save XML to file
|
||||
$xmlPath = "C:\Temp\sync-task.xml"
|
||||
$taskXml | Out-File -FilePath $xmlPath -Encoding Unicode -Force
|
||||
|
||||
Write-Host "[1] Deleting old task if exists..." -ForegroundColor Yellow
|
||||
schtasks /Delete /TN "Sync-FromNAS" /F 2>$null
|
||||
|
||||
Write-Host "[2] Creating task from XML..." -ForegroundColor Yellow
|
||||
$result = schtasks /Create /XML $xmlPath /TN "Sync-FromNAS" /RU "INTRANET\sysadmin" /RP "Paper123!@#" /F
|
||||
Write-Host " $result" -ForegroundColor White
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[3] Starting task..." -ForegroundColor Yellow
|
||||
schtasks /Run /TN "Sync-FromNAS"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host " Waiting 30 seconds for sync..." -ForegroundColor White
|
||||
Start-Sleep -Seconds 30
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[4] Checking task status..." -ForegroundColor Yellow
|
||||
schtasks /Query /TN "Sync-FromNAS" /FO LIST /V
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "[5] Last 25 lines of sync log..." -ForegroundColor Yellow
|
||||
if (Test-Path "C:\Shares\test\scripts\sync-from-nas.log") {
|
||||
Get-Content "C:\Shares\test\scripts\sync-from-nas.log" | Select-Object -Last 25 | ForEach-Object { Write-Host " $_" -ForegroundColor Gray }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Find machine folders with Backup subdirectories
|
||||
$testPath = "\\192.168.0.6\test"
|
||||
|
||||
Write-Host "Searching for machine folders with Backup subdirectories in $testPath"
|
||||
Write-Host ""
|
||||
|
||||
$machineFolders = Get-ChildItem -Path $testPath -Directory -ErrorAction SilentlyContinue
|
||||
|
||||
foreach ($folder in $machineFolders) {
|
||||
$backupPath = Join-Path $folder.FullName "Backup"
|
||||
if (Test-Path $backupPath) {
|
||||
Write-Host "FOUND: $($folder.Name) -> $backupPath"
|
||||
|
||||
# Check if there are any files in the backup folder
|
||||
$backupFiles = Get-ChildItem -Path $backupPath -File -ErrorAction SilentlyContinue
|
||||
if ($backupFiles) {
|
||||
Write-Host " Files: $($backupFiles.Count) files found"
|
||||
Write-Host " Latest: $($backupFiles | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | ForEach-Object { "$($_.Name) - $($_.LastWriteTime)" })"
|
||||
} else {
|
||||
Write-Host " (Empty backup folder)"
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Search complete."
|
||||
47
clients/internal-infrastructure/scripts/find_ts_backups.ps1
Normal file
47
clients/internal-infrastructure/scripts/find_ts_backups.ps1
Normal file
@@ -0,0 +1,47 @@
|
||||
# Find TS-XX machine folders with Backup subdirectories
|
||||
$testPath = "\\192.168.0.6\test"
|
||||
|
||||
Write-Host "Searching for TS-XX machine folders with Backup subdirectories..."
|
||||
Write-Host ""
|
||||
|
||||
# Get all directories matching TS-*
|
||||
$tsFolders = Get-ChildItem -Path $testPath -Directory -Filter "TS-*" -ErrorAction SilentlyContinue
|
||||
|
||||
if ($tsFolders) {
|
||||
Write-Host "Found $($tsFolders.Count) TS-XX folders:"
|
||||
Write-Host ""
|
||||
|
||||
foreach ($folder in $tsFolders) {
|
||||
$backupPath = Join-Path $folder.FullName "Backup"
|
||||
|
||||
Write-Host "Machine: $($folder.Name)"
|
||||
|
||||
if (Test-Path $backupPath) {
|
||||
Write-Host " [OK] Backup folder exists: $backupPath"
|
||||
|
||||
# Check for files in backup folder
|
||||
$backupFiles = Get-ChildItem -Path $backupPath -ErrorAction SilentlyContinue
|
||||
if ($backupFiles) {
|
||||
Write-Host " Files: $($backupFiles.Count) items"
|
||||
|
||||
# Show most recent file
|
||||
$latestFile = $backupFiles | Where-Object { -not $_.PSIsContainer } | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
if ($latestFile) {
|
||||
Write-Host " Latest: $($latestFile.Name)"
|
||||
Write-Host " Date: $($latestFile.LastWriteTime)"
|
||||
Write-Host " Size: $([math]::Round($latestFile.Length / 1KB, 2)) KB"
|
||||
}
|
||||
} else {
|
||||
Write-Host " [EMPTY] No files in backup folder"
|
||||
}
|
||||
} else {
|
||||
Write-Host " [MISSING] No Backup folder"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
}
|
||||
} else {
|
||||
Write-Host "No TS-XX folders found in $testPath"
|
||||
}
|
||||
|
||||
Write-Host "Search complete."
|
||||
@@ -0,0 +1,72 @@
|
||||
#!/bin/bash
|
||||
# Reset Gitea password for mike@azcomputerguru.com
|
||||
# Run this on Jupiter server (172.16.3.20) as root
|
||||
# Note: Gitea runs in Docker container
|
||||
|
||||
echo "=== Gitea Password Reset (Docker) ==="
|
||||
echo ""
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "[ERROR] This script must be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find Gitea Docker container
|
||||
echo "[1] Finding Gitea Docker container..."
|
||||
CONTAINER=$(docker ps --filter 'name=gitea' --format '{{.Names}}' | head -n 1)
|
||||
|
||||
if [ -z "$CONTAINER" ]; then
|
||||
echo "[ERROR] Cannot find Gitea container"
|
||||
echo ""
|
||||
echo "Available containers:"
|
||||
docker ps --format '{{.Names}}'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[OK] Found container: $CONTAINER"
|
||||
echo ""
|
||||
|
||||
echo "[2] Current Gitea users:"
|
||||
docker exec $CONTAINER gitea admin user list 2>/dev/null || \
|
||||
echo "[WARNING] Could not list users"
|
||||
|
||||
echo ""
|
||||
echo "[3] Resetting password for: mike@azcomputerguru.com"
|
||||
echo ""
|
||||
|
||||
# Prompt for new password
|
||||
read -sp "Enter new password: " NEW_PASSWORD
|
||||
echo ""
|
||||
read -sp "Confirm password: " CONFIRM_PASSWORD
|
||||
echo ""
|
||||
|
||||
if [ "$NEW_PASSWORD" != "$CONFIRM_PASSWORD" ]; then
|
||||
echo "[ERROR] Passwords do not match"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$NEW_PASSWORD" ]; then
|
||||
echo "[ERROR] Password cannot be empty"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "[4] Executing password change..."
|
||||
|
||||
# Reset password using docker exec (try username 'mike' first, then email)
|
||||
docker exec $CONTAINER gitea admin user change-password --username mike --password "$NEW_PASSWORD" 2>&1 || \
|
||||
docker exec $CONTAINER gitea admin user change-password --username mike@azcomputerguru.com --password "$NEW_PASSWORD" 2>&1
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo ""
|
||||
echo "[SUCCESS] Password reset complete!"
|
||||
echo ""
|
||||
echo "You can now login at: https://git.azcomputerguru.com/"
|
||||
echo "Username: mike@azcomputerguru.com (or just 'mike')"
|
||||
echo "Password: (the one you just set)"
|
||||
else
|
||||
echo ""
|
||||
echo "[ERROR] Password reset failed"
|
||||
echo "Try running manually with different username format"
|
||||
fi
|
||||
@@ -0,0 +1,47 @@
|
||||
# Test the API endpoint directly
|
||||
Write-Host "[OK] Testing API endpoints on AD2..." -ForegroundColor Green
|
||||
|
||||
# Test 1: Stats endpoint
|
||||
Write-Host "`n[TEST 1] GET /api/stats" -ForegroundColor Cyan
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://192.168.0.6:3000/api/stats" -Method GET -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host "[OK] Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
Write-Host "[OK] Response:" -ForegroundColor Green
|
||||
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
|
||||
} catch {
|
||||
Write-Host "[ERROR] Request failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||
Write-Host "[ERROR] Response: $($_.Exception.Response)" -ForegroundColor Red
|
||||
if ($_.ErrorDetails.Message) {
|
||||
Write-Host "[ERROR] Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
# Test 2: Search endpoint (simple)
|
||||
Write-Host "`n[TEST 2] GET /api/search?limit=1" -ForegroundColor Cyan
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://192.168.0.6:3000/api/search?limit=1" -Method GET -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host "[OK] Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
Write-Host "[OK] Response:" -ForegroundColor Green
|
||||
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
|
||||
} catch {
|
||||
Write-Host "[ERROR] Request failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||
if ($_.ErrorDetails.Message) {
|
||||
Write-Host "[ERROR] Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
# Test 3: Record by ID
|
||||
Write-Host "`n[TEST 3] GET /api/record/1" -ForegroundColor Cyan
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "http://192.168.0.6:3000/api/record/1" -Method GET -UseBasicParsing -ErrorAction Stop
|
||||
Write-Host "[OK] Status: $($response.StatusCode)" -ForegroundColor Green
|
||||
Write-Host "[OK] Response:" -ForegroundColor Green
|
||||
$response.Content | ConvertFrom-Json | ConvertTo-Json -Depth 5
|
||||
} catch {
|
||||
Write-Host "[ERROR] Request failed: $($_.Exception.Message)" -ForegroundColor Red
|
||||
if ($_.ErrorDetails.Message) {
|
||||
Write-Host "[ERROR] Details: $($_.ErrorDetails.Message)" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "`n[OK] Done" -ForegroundColor Green
|
||||
Reference in New Issue
Block a user