In the vSphere Client “Delete snapshots older than X days” scheduled task, X is stored in the scheduled task action arguments as a VMware.Vim.SnapshotSelectionSpec object, specifically RetentionDays, and the action method is RemoveAllSnapshots_Task.
When you pull the task with Get-View, you’ll see something like:
Info.Action.Name = RemoveAllSnapshots_Task
Info.Action.Argument = two MethodActionArgument entries
The second argument’s .Value is a SnapshotSelectionSpec containing RetentionDays
also, I would run the script from a centralized location/server