> For the complete documentation index, see [llms.txt](https://docs.scepman.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scepman.com/de/zertifikatsverwaltung/api-certificates/api-enrollment/windows-server.md).

# Windows-Server

{% hint style="info" %}
Gilt für SCEPman Version 2.9 und höher
{% endhint %}

Mit dem PowerShell-Modul SCEPmanClient können Sie Zertifikate für Ihren Windows-Server anfordern. Bitte beachten Sie den Hauptartikel des Moduls für die Voraussetzungen:

{% content-ref url="/pages/dbb1c25b5c5378e0bfea99026d67efd5eddf2f37" %}
[SCEPmanClient](/de/zertifikatsverwaltung/api-certificates/scepmanclient.md)
{% endcontent-ref %}

## Beschreibung des Anwendungsfalls

Obwohl das Modul in der Lage ist, Zertifikate zunächst anzufordern, ist es möglicherweise nicht wünschenswert, die Anmeldeinformationen des Service Principal auf einem System zu speichern, das zur Anforderung beliebiger Zertifikate verwendet werden könnte.

Wenn Ihr Szenario also die Bereitstellung eines Zertifikats mit Certificate Master umfasst, können Sie es automatisch erneuern mit *SCEPmanClient* indem Sie ein bereits vorhandenes Zertifikat zur Authentifizierung bereitstellen:

<pre class="language-powershell"><code class="lang-powershell"><strong>$Subject = $env:COMPUTERNAME
</strong><strong>$ValidityThreshold = 30
</strong><strong>
</strong><strong>$CertificateToRenew = Get-ChildItem Cert:\LocalMachine\My `
</strong>                        | Where-Object NotAfter -lt (Get-Date).AddDays($ValidityThreshold) `
                        | Where-Object Subject -match $Subject

New-SCEPmanCertificate -Certificate $CertificateToRenew -SaveToStore 'LocalMachine'

# Mit dem neuen Zertifikat können wir das alte entfernen
# Remove-Item $CertificateToRenew.PSPath
</code></pre>

Dieses Beispiel sucht nach Zertifikaten, die im nächsten Monat ablaufen, und verwendet sie zur Authentifizierung der Erneuerungsanforderung.

## Erstanforderung

Wenn Sie auf Ihrem Server anfänglich Zertifikate anfordern möchten, können Sie dies tun, indem Sie einen Service Principal zur Authentifizierung bereitstellen, dem die Rolle **CSR DB Requesters** zugewiesen ist. Bitte beachten Sie die folgende Anleitung zur Implementierung eines solchen Service Principals:

{% content-ref url="/pages/c6e9b6e18fdecafb14aaae14587abd1f7a62b135" %}
[API-Registrierung](/de/zertifikatsverwaltung/api-certificates/api-enrollment.md)
{% endcontent-ref %}

```powershell
$Parameters = @{
    'Url'              = 'scepman.contoso.com'
    'ClientId'         = '569fbf51-aa63-4b5c-8b26-ebbcfcde2715'
    'TenantId'         = '8aa3123d-e76c-42e2-ba3c-190cabbec531'
    'ClientSecret'     = 'csa8Q~aVaWCLZTzswIBGvhxUiEvhptuqEyJugb70'
    'Subject'          = 'CN=WebServer'
    'DNSName'          = 'Webserver.domain.local'
    'ExtendedKeyUsage' = 'ServerAuth'
    'SaveToStore'      = 'LocalMachine'
}

New-SCEPmanCertificate @Parameters
```

Wenn wir nun ein Zertifikat erneuern möchten, können wir den Service Principal außer Acht lassen und ein bereits ausgestelltes Zertifikat zur Authentifizierung verwenden. Dadurch werden die Details des vorhandenen Zertifikats verwendet, um eine neue CSR zu erstellen, die an SCEPman zur Ausstellung eines neuen Zertifikats gesendet wird.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.scepman.com/de/zertifikatsverwaltung/api-certificates/api-enrollment/windows-server.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
