Hi @Marko Todorovic ,
maybe this helps to get started (Use on your own risk! Not tested by myself.):
$searchBase = "OU=random,DC=random,dc=local"
Search-ADAccount -SearchBase $searchBase -UsersOnly -AccountInactive -TimeSpan ([timespan]5d)
| Set-ADUser -Enabled $false
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten