Ankur Bawiskar
Tera Patron

@veenal 

link shared by @SD_Chandan has the script from ServiceNow docs itself.

please try that and let us know

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader