Skip to content
Menu

Client Domain About to Expire (RDAP Expiry Check)

Reads each domain's expiration date from its registry's RDAP server and alerts when it falls within WarningDays, has passed, or the domain is not found at the registry.

Client domain about to expire (RDAP expiry check) is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Client domain about to expire (RDAP expiry check). Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, Windows Server 2016+; runs as SYSTEM or a user
NeedsPowerShell 5.1, outbound https to data.iana.org and the registries' RDAP servers
Read-onlyReads, changes nothing

What It Does

The script is read-only. For each domain in Domains it finds the registry's RDAP server through the IANA bootstrap file at data.iana.org, asks that server for the domain's registration record and reads the expiration event. It writes one row per domain. It uses HTTPS URLs from the IANA bootstrap. The registry lookup sends the domain name in the request path.

It alerts, with exit 1, when a domain expires within WarningDays days, has already expired, or is not found at its registry, which often means a misspelled name. Give the registered domain, such as example.com or example.co.uk, not a host name such as www.example.com, because RDAP has no record for a subdomain. Names with non-ASCII characters must be written in punycode.

A domain is reported but not judged when its top-level domain has no RDAP service (State NoRdapService) or the record carries no expiration event (State NoExpiryDate), because some registries hide it. If no domain could be judged, the result is SKIPPED. If a lookup fails, through no internet, a registry that is down or rate limiting, and nothing else alerts, the result is ERROR, so a blind monitor is never reported as healthy.

On a healthy run the answer names the domain that expires soonest and how many days it has left.

Before You Run It

  • List the registered domains, one for each name the client depends on, and leave out subdomains.
  • Set WarningDays to give you time to renew. The default is 30 days.
  • Allow outbound https to data.iana.org and to the registries' RDAP servers.
  • Treat NoRdapService and NoExpiryDate rows as domains this monitor cannot watch, and check those another way.
  • Schedule it in your RMM and alert on exit 1.

Type and Risk

  • Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: A few seconds per domain.
  • Example answer: "contoso.com expires in 12 days (2026-11-29); warning at 30 days"
  • Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • Domains: The domains to check, separated by commas, semicolons or new lines. Required. At most 100. Lower or upper case, a trailing dot is ignored. Internationalised names must be written in punycode (xn--...).
  • WarningDays: Alert when a domain expires within this many days. Whole number, 1 to 3650. Default 30.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

test-domain-expiry.ps1 · 897 lines · 45.2 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.