You can set EmployeeLeaveDateTime while guest creation by adding 7 days from the creation date. For example,
$EmployeeLeaveDateTime=((Get-Date).AddDays).Date
Schedule the below script (You can use certificate based authentication to run the script unattended) to run daily in the Task scheduler.
Get-Mguser -All | foreach {
$UserId=$.Id
$AccountStatus=$_.AccountEnabled
$EmployeeLeaveDateTime=$_.EmployeeLeaveDateTime
If(($EmployeeLeaveDateTime -lt (Get-date)) -and ($Account -eq $True))
{
Update-MgUser -UserId $UserId -AccountEnabled $false
}
}
This will disable users who are in enabled state and EmployeeLeaveDateTime exceeds the current date.