windows-iac-vm-tooling/docs/07-advanced/evaluation.md

201 lines
4.9 KiB
Markdown
Raw Normal View History

# ⏰ 90-Day Evaluation Management
[![Windows](https://img.shields.io/badge/Windows-Evaluation-0078D6?style=flat&logo=windows)](https://www.microsoft.com/en-us/evalcenter/)
## Overview
Windows Evaluation editions expire after 90 days. This document explains the expiration mechanism and provides strategies for managing it in your automation pipeline.
---
## Understanding Evaluation Expiration
```mermaid
flowchart LR
subgraph Timeline["90-Day Timeline"]
Start[Install Day 0] --> Day30[Day 30] --> Day60[Day 60] --> Day90[Day 90 - Expiration]
end
subgraph States["System States"]
Active[✅ Active] --> Warning[⚠️ Warning 15 days] --> Expired[❌ Expired]
end
Timeline --> States
style Timeline fill:#e3f2fd
style States fill:#e8f5e9
```
| Phase | Duration | Status |
|-------|----------|--------|
| **Full Activation** | Days 0-89 | ✅ Fully functional |
| **Warning Period** | Days 90-104 | ⚠️ Countdown warnings |
| **Grace Period** | Days 105-180 | ⏳ Extended grace |
| **Expired** | Day 181+ | ❌ System stops |
---
## Expiration Methods
### Method 1: Rearm (Manual/Scripted)
The `slmgr /rearm` command resets the activation timer.
```powershell
# Run as Administrator
slmgr /rearm
# Reboot required
shutdown /r /t 0
```
**Limits:**
- Maximum 3 rearm attempts per installation
- Each rearm resets to 90 days
- **Total: 360 days maximum**
### Method 2: Packer Rebuild (Recommended)
The recommended approach is to **rebuild the golden image monthly**.
```mermaid
flowchart TB
subgraph Monthly["Monthly Schedule"]
direction LR
Week1[Week 1: Packer Build] --> Week2[Week 2-4: Use Template]
end
subgraph Process["Rebuild Process"]
Destroy[Destroy Old Template] --> Create[Create New Template] --> Verify[Test New Template]
end
Monthly --> Process
style Monthly fill:#e3f2fd
style Process fill:#e8f5e9
```
**Benefits:**
- Fresh timer each month
- Latest Windows updates baked in
- Consistent baseline
- No rearm limitations
---
## Implementation Strategy
### Automated Monthly Rebuild
Configure a scheduled workflow in Forgejo:
```yaml
# .forgejo/workflows/monthly-rebuild.yml
name: Monthly Template Rebuild
on:
schedule:
- cron: '0 0 1 * *' # First day of each month at midnight
jobs:
rebuild-template:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build New Template
run: |
cd packer
packer build -timestamp-ui windows.pkr.hcl
- name: Cleanup Old Template
run: |
# Script to remove template older than 45 days
./scripts/cleanup-old-templates.sh --older-than 45d
```
### Rebarm as Backup
For emergency extension:
```powershell
# emergency-rearm.ps1
# Run via Ansible or manually
if ((slmgr /dlv) -match "Remaining: 0") {
Write-Host "Rearming system..."
slmgr /rearm
shutdown /r /t 0
} else {
Write-Host "Not yet expired, no action needed"
}
```
---
## Monitoring Expiration
### Check Current Status
```powershell
# Method 1: slmgr
slmgr /dlv
# Method 2: PowerShell
(Get-CimInstance -Query "SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL").RemainingGracePeriod
```
### Automated Monitoring Script
```bash
#!/bin/bash
# check-expiration.sh - Run via Ansible monthly
VM_ID="9000"
PROXMOX_HOST="la-vmh-07"
# Get VM's Windows activation status
ssh root@$PROXMOX_HOST "qm agent $VM_ID exec-win32 powershell -Command '(Get-CimInstance -Query \"SELECT * FROM SoftwareLicensingProduct WHERE PartialProductKey IS NOT NULL\").RemainingGracePeriod'"
# Alert if less than 7 days
if [ $DAYS_REMAINING -lt 7 ]; then
echo "⚠️ ALERT: Template expires in $DAYS_REMAINING days"
# Send notification
fi
```
---
## Best Practices
| Practice | Description | Priority |
|----------|-------------|----------|
| **Monthly rebuild** | Schedule automatic Packer build | 🔴 High |
| **Monitor expiration** | Check status weekly | 🟡 Medium |
| **Test new templates** | Verify before production use | 🔴 High |
| **Document rebuilds** | Log template versions | 🟢 Low |
---
## Troubleshooting
| Issue | Cause | Solution |
|-------|-------|----------|
| Rearm failed | Already rearmed 3 times | Rebuild with Packer |
| VM won't boot after rearm | Activation issues | Rebuild template |
| Updates not installing | WSUS offline | Include updates in Packer build |
---
## Next Steps
| Goal | Next Document |
|------|---------------|
| View troubleshooting | [Troubleshooting](troubleshooting.md) |
| Configure pipeline | [Forgejo Workflows](../06-ci-cd/forgejo-workflows.md) |
| View architecture | [Architecture Overview](../01-overview/architecture.md) |
---
[← Documentation Index](../index.md) | [→ Troubleshooting](troubleshooting.md) | [← Forgejo Workflows](../06-ci-cd/forgejo-workflows.md)