RE: Simple Batch Virus 09-24-2012, 02:39 AM
#5
For the Random User account creation, i've already created a script that will delete all of the junk ones if something like that were to happen:
Deletes everything BUT the Administrator, Guest, and the main User account created when you first install Windows. If you have any others, you'd just have to add them in my if statement logic to avoid deleting them.
Code:
$Comp = "."
$UsrAccounts = get-wmiobject -class "Win32_UserAccount" -namespace "root\CIMV2" `
-filter "LocalAccount = True" -computername $Comp
write-host > del_users.txt
foreach ($objItm in $UsrAccounts) {
if ($objItm.Name -ne $env:username `
-and $objItm.Name -ne "Administrator" `
-and $objItm.Name -ne "Guest") {
$objItm.Name >> del_users.txt
}
}
$del_array = get-content del_users.txt | %{ $_ }
foreach ($str in $del_array) {
net users $str /del
}Deletes everything BUT the Administrator, Guest, and the main User account created when you first install Windows. If you have any others, you'd just have to add them in my if statement logic to avoid deleting them.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)