If your workstations are domain joined and you have access to modify group policies then all of this can be specified in GPO;
Computer Configuration | Policies | Administrative Templates | System | User Profiles
Alternatively you should look at delprof2 (https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/), this will do what you need.
It's a command line tool (so you can script it) and takes a parameter to specify how old a profile must be before it's eligible for deletion. For example this command will delete all local profiles older than 60 days;
delprof2 /d 60
It has more uses too, such as only deleting profiles that are local caches of roaming profiles (ignoring true local profiles), deleting profiles remotely (so you could potentially script this to run from a server and target each of your workstations in turn), pattern matching for inclusion / exclusion so you can tell it to ignore specific profiles (e.g. all accounts starting with john*).
It's also free in many cases (I quote)
"Delprof2 is free for private use, for educational and non-profit organizations. All
other organizations may use Delprof2 for free, too, if they allow us
to publish their name. Otherwise a commercial license must be purchased."
Does that help?
Edit:
Seeing as you appear to want an additional option, try this script or a modification of it. I found it on this forum (http://www.edugeek.net/forums/windows-7/79028-delete-user-profiles-older-than-specified-number-days.html) and it is entirely untested; use at your own risk. You'll probably want to remove the MsgBox line, and the unused period can be adjusted by changing the value of variable 'intMaxProfileAge'
On Error Resume Next
Dim objFSO, objWMIService, strComputer, strFilter, intMaxProfileAge, colProfiles, objProfile, dtmLastUseTime
strComputer = "."
strFilter = "SID Like ""S-1-5-21%"" And Not LocalPath Like ""%Administrator%"""
intMaxProfileAge = 14
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set colProfiles = objWMIService.ExecQuery("Select * From Win32_UserProfile Where " & strFilter)
If Not colProfiles Is Nothing Then
For Each objProfile in colProfiles
dtmLastUseTime = CDate(Mid(objProfile.LastUseTime, 7, 2) & "/" & Mid(objProfile.LastUseTime, 5, 2) & "/" & Left(objProfile.LastUseTime, 4) & " " & Mid (objProfile.LastUseTime, 9, 2) & ":" & Mid(objProfile.LastUseTime, 11, 2) & ":" & Mid(objProfile.LastUseTime, 13, 2))
MsgBox DateDiff("d", dtmLastUseTime, Date)
If DateDiff("d", dtmLastUseTime, Date) > intMaxProfileAge Then
Err.Clear
objProfile.Delete_
If Err.Number = -2147024809 Then
'Profile in use, skipping.
ElseIf Err.Number = -2147024751 Then
objFSO.DeleteFolder objProfile.LocalPath, True
ElseIf Err.Number <> 0 Then
'"Error: " & Err.Number & ": " & Err.Description
Else
'Profile Deleted.
End If
End If
Next
End If