> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/m/microsoft-wsus.md).

# Microsoft WSUS

Windows Server Update Services (WSUS) distributes Microsoft updates. OctoXLabs runs PowerShell over WinRM on the WSUS server and adds the computer targets and their update installation summary to the device inventory.

## Use cases

* List the computers known to WSUS.

```
Adapters = wsus
```

* Find WSUS computers that have not synced for 30 days.

```
Adapters = wsus AND NOT LastSeen last now-30d/d
```

## Before you begin

### Network

| Source              | Destination         | Port                        | Protocol      |
| ------------------- | ------------------- | --------------------------- | ------------- |
| OctoXLabs connector | WSUS server (WinRM) | 5985 (HTTP) or 5986 (HTTPS) | HTTP or HTTPS |

### Required permissions

| Scope or role                                                                              | Permission | Needed for                                       |
| ------------------------------------------------------------------------------------------ | ---------- | ------------------------------------------------ |
| Account allowed to open remote PowerShell sessions and use the WSUS administration cmdlets | Read       | Computer targets and update installation summary |

The frontend instructions do not list a role. The connector runs `Get-WsusServer`, so the account needs WSUS administration rights. Not verified which WSUS role is the minimum.

## Create credentials in Microsoft WSUS

{% stepper %}
{% step %}

### Enable WinRM

Enable the WinRM listener on the WSUS server (port 5985 for HTTP, 5986 for HTTPS).
{% endstep %}

{% step %}

### Create an account

Use an account that can open remote PowerShell sessions and read WSUS data.
{% endstep %}

{% step %}

### Choose the auth type

NTLM is the default. For Kerberos, use a UPN username or set the Kerberos realm and KDC IP.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                                | Required | Type    | Default | Description                                                                                |
| ---------------------------------------- | -------- | ------- | ------- | ------------------------------------------------------------------------------------------ |
| IP (`ip`)                                | Yes      | String  |         | IP address or hostname of the Windows host.                                                |
| Port (`port`)                            | No       | Integer | 5985    | WinRM port. 5985 is the HTTP listener, 5986 the HTTPS listener.                            |
| Username (`username`)                    | Yes      | String  |         | Account used to connect. For Kerberos, use UPN format (`user@CONTOSO.COM`).                |
| Password (`password`)                    | Yes      | String  |         | Password of the account.                                                                   |
| Is Secure (`is_secure`)                  | No       | Boolean | False   | Connect over HTTPS. Use it with port 5986.                                                 |
| Auth Type (`auth_type`)                  | No       | String  | NTLM    | One of Basic, Certificate, NTLM, Kerberos, Plaintext, SSL, Credssp.                        |
| Certificate verification (`cert_verify`) | No       | Boolean | True    | Validate the WinRM HTTPS certificate. Applied only when Is Secure is on.                   |
| Kerberos realm (`kerberos_realm`)        | No       | String  |         | Realm in uppercase. Needed when Auth Type is Kerberos and the username is not in UPN form. |
| KDC IP / FQDN (`kdc_ip`)                 | No       | String  |         | Kerberos KDC host. Leave empty to use DNS discovery.                                       |

## Troubleshooting

| Error message           | Cause                                                                   | Fix                                                                                                                   |
| ----------------------- | ----------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Connection test failed. | Neither the HTTP nor the HTTPS WinRM session ran `whoami` successfully. | Check the port, Is Secure, Auth Type and the account. The account must be allowed to open remote PowerShell sessions. |

## Change history
