Security Basics mailing list archives

RE: cmdline tool to add users (win2k)


From: "Oscar Kooijman" <oscar.kooijman () chello nl>
Date: Fri, 3 Oct 2003 11:52:11 +0200

Hi,

Why not write a Perl script?
Using the Perl mod Win32::NetAdmin::UserCreate ($Machine, $User,
$Password, $PasswordAge,
                         $Privileges, $HomeDir, $Comment, $Flags,
$LogonScript );

Example:
                use Win32::NetAdmin;
                use Win32::AdminMisc;
                $User = "Joel";
                $FullName = "Joel Smith";
                $Domain = " Accounting";
                %Account = (
                        password => "\U$User",
                        homedir =>      "\\\\HomeServer\\Home\\$User",
                        priv => USER_PRIV_USER,
                        flags => UF_SCRIPT | UR_NORMAL_ACCOUNT,
                        fullname => $FullName,
                        comment => "The account for $FullName",
                        logon => "perl
\\\\LogonServer\\Logon\\Logon.pl",
                );
                Win32::NetAdmin::GetDomainController( '', $Domain,
$Server );
                if( ! Win32::NetAdmin::UserExist( $Server, $User ))
                  {
                        if( Win32::NetAdmin::UserCreate( $Server, $User,
$Account{pasasword}, 0,
                        $Account{priv}, $Account{homedir},
$Account{comment}, $Account{flags},
                        $Account{logon} ))
                  {
                        Win32::AdminMisc::UserSetMiscAttributes(
$Server, $User, 
                        USER_FULLNAME=>$Account{fullname} );
                  }
                }else{
                        print "The account already exists.\n";
                }

I don't write to much Perl scripts, so forgive any faults.

Oscar Kooijman
Secure-IT 
oscar[DOT]kooijman[AT]chello[DOT]nl

-----Original Message-----
From: Hugo Saro [mailto:h_saro () yahoo com] 
Sent: 30 September 2003 23:26
To: security-basics () securityfocus com
Subject: cmdline tool to add users (win2k)


.. anyone knows a nice cmd utility to add/rem
groups/users? I have access to some w2k terminal
servers but i prefer telnet (with proper encriptation)
to the gui, something that lets me add users etc would
be nice, but I couldn't find any.

Ideas?

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

------------------------------------------------------------------------
---
------------------------------------------------------------------------
----

Attachment: smime.p7s
Description:


Current thread: