Author Posts

September 16, 2018 at 5:53 pm

I am looking for a powershell script to delete 100+ Local user accounts from 50+ desktops that are in the Domain. Instead of logging into each individual PC's and deleting the users one by one, I prefer to run a powershell script from somewhere like the domain controller to delete the users from each of these desktops.

I have the details in an excel spreadsheet as below


Any other forums that you suggest, for me to get help regarding this?

September 16, 2018 at 6:18 pm

PowerShell is capable of doing this. But we would like you to try this. You need to find the way to do it locally first, then execute the same command against you target systems using PowerShell's remoting capability. Below documentations will help you.

  • Get-Help Invoke-Command -Full
  • ImportExcel module by Douge Finke

We will be here to help you when encountering problems with your script.

September 16, 2018 at 8:17 pm

Depending on what version of PS you are on, there are built-in cmdlet to do this for a single host.

Otherwise use this...

As pointed out by , you then just need to run this for multiple computers by using a ForLoop targeting those remote systems using the noted cmdlet.

There are plenty of samples all over the web showing how to delete local user accounts.

Use PowerShell to remove local profiles





September 19, 2018 at 10:43 am

It would be great if you update the post by formating the code using code posting tags , this makes other to easily understand your code, below link will help you.