Kaffeeundcode
n8n Flow-Bibliothek
n8n Workflow 01.06.2026

Flow Arbeitsbereich

Password Expiry Notifier

Flow prüfen, Nodes verstehen, JSON importieren und Credentials sauber anpassen.

Workflow Diagramm

auto-generiert
graph LR
    N0(["⚡ Daily Check"])
    N1["🔧 Get Users"]
    N2["🔧 Filter Expiring"]
    N3[["📤 Send Email"]]
    N0 --> N1
    N1 --> N2
    N2 --> N3

    classDef trigger fill:#f59e0b,stroke:#b45309,color:#000
    classDef action fill:#292524,stroke:#44403c,color:#e7e5e4
    classDef logic fill:#1e1b4b,stroke:#4338ca,color:#c7d2fe
    class N0 trigger
    class N1 action
    class N2 action
    class N3 action

12_Password_Expiry_Notifier.json

{
    "name": "12_Password_Expiry_Notifier",
    "nodes": [
        {
            "parameters": {
                "rule": {
                    "interval": [
                        {
                            "field": "days",
                            "triggerAtHour": 8
                        }
                    ]
                }
            },
            "name": "Daily Check",
            "type": "n8n-nodes-base.schedule",
            "typeVersion": 1,
            "position": [
                250,
                300
            ]
        },
        {
            "parameters": {
                "authentication": "predefinedCredentialType",
                "nodeCredentialType": "microsoftGraphOAuth2Api",
                "requestMethod": "GET",
                "url": "https://graph.microsoft.com/v1.0/users?$select=id,displayName,userPrincipalName,passwordPolicies,lastPasswordChangeDateTime",
                "options": {}
            },
            "name": "Get Users",
            "type": "n8n-nodes-base.httpRequest",
            "typeVersion": 3,
            "position": [
                450,
                300
            ],
            "credentials": {
                "microsoftGraphOAuth2Api": {
                    "id": "YOUR_CREDENTIAL_ID",
                    "name": "Microsoft Graph Account"
                }
            }
        },
        {
            "parameters": {
                "functionCode": "const maxAgeDays = 90;nconst warningThreshold = 7;nconst now = new Date();nnreturn items.filter(item => {n  const user = item.json;n  if (user.passwordPolicies && user.passwordPolicies.includes('DisablePasswordExpiration')) return false;n  n  const lastChange = new Date(user.lastPasswordChangeDateTime);n  const ageDays = (now - lastChange) / (1000 * 60 * 60 * 24);n  const daysLeft = maxAgeDays - ageDays;n  n  item.json.daysLeft = Math.floor(daysLeft);n  n  return daysLeft > 0 && daysLeft <= warningThreshold;n});"
            },
            "name": "Filter Expiring",
            "type": "n8n-nodes-base.function",
            "typeVersion": 1,
            "position": [
                650,
                300
            ]
        },
        {
            "parameters": {
                "fromEmail": "it@yourdomain.com",
                "toEmail": "={{ $json.userPrincipalName }}",
                "subject": "⚠️ Action Required: Password Expiring Soon",
                "text": "=Hi {{ $json.displayName }},nnYour password will expire in {{ $json.daysLeft }} days. Please change it properly."
            },
            "name": "Send Email",
            "type": "n8n-nodes-base.emailSend",
            "typeVersion": 1,
            "position": [
                850,
                300
            ]
        }
    ],
    "connections": {
        "Daily Check": {
            "main": [
                [
                    {
                        "node": "Get Users",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Get Users": {
            "main": [
                [
                    {
                        "node": "Filter Expiring",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Filter Expiring": {
            "main": [
                [
                    {
                        "node": "Send Email",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    }
}