Você pode usar o comando net
para isso.
Para conta de usuário del.
net user YourUsername /del
Para adicionar.
net user YourUserName YourPassword /add
Para mais informações, leia How to Use the Net User Command
.
Existe uma ferramenta de linha de comando para fazer isso, chame Delprof2
(sucessor inofficial do Delprof
) da Microsoft.
Uso: delprof2 [/l] [/u] [/q] [/p] [/r] [/c:[\]<computername>] [/d:<days> [/ntuserini]] [/ed:<pattern>] [/id:<pattern>] [/i]
/l List only, do not delete (what-if mode)
/u Unattended (no confirmation)
/q Quiet (no output and no confirmation)
/p Prompt for confirmation before deleting each profile
/r Delete local caches of roaming profiles only, not local profiles
/c Delete on remote computer instead of local machine
/d Delete only profiles not used in x days
/ntuserini
When determining profile age for /d, use the file NTUSER.INI
instead of NTUSER.DAT for age calculation
/ed Exclude profile directories whose name matches this pattern
Wildcard characters * and ? can be used in the pattern
May be used more than once and can be combined with /id
/id Include only profile directories whose name matches this pattern
Wildcard characters * and ? can be used in the pattern
May be used more than once and can be combined with /ed
/i Ignore errors, continue deleting
Exemplo de Delprof2 em ação, excluindo perfis de usuário remotamente.
delprof2.exe -c:192.168.175.129 -p