Script Assistance Request - Remove Computer Profiles

I need a script that will delete the profiles and user folders for all users that have logged into a machine except certain ones that are designated in the script.

Our use case is that my organization has a large room with 40 computers in it that visitors use for a full day and then are gone. Even if they don’t download or create a lot of files, there is still data usage. We deploy a bunch of micro pcs due to cost, so only have 50GB of storage overall.

Hi @dminga ,

Thanks for your script request. We have shared your script request with our script developers and will share an update once ready.

Kind Regards,
PremJK

Hi @dminga ,

Please run this script prepared by our script developer
https://scripts.itarian.com/frontend/web/topic/script-to-remove-computer-profiles-except-user-defined-profiles

Note:

Run As a local system user

  1. Provide user names at parameters (“excepUser”) which you do not want to remove data type should be a string

example 1):

Type

String

Endpoint Manager Label

excepUser

Default Value

Robert

________________________________________________________________

example 2) if you do not want to remove more than one user use comma

Type

String

Endpoint Manager Label

excepUser

Default Value

Robert,Banner (no spaces between comma)
image-2023-03-28-14-54-06-250

Warning before running the script make sure the users are signed out

Kind Regards,
PremJK