Page 1 of 2 12>
Topic Options
#60453 - 2001-11-08 01:04 AM UserCreate() UDF
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
UserCreate.kix

code:
Function UserCreate($target,$user,OPTIONAL $rightstouse)
;UserCreate Function
;
;Syntax:
; UserRename(<Domain/computer>,<userid>,[rights to use])
; <domain/computer> = the domain or computer you want to create a new account in
; <userid> = the name of the account to create
; [rights to use] = optional user name and password used to make the account
;
;Examples:
; ;This will create a user account called "thing1" in the local domain
; UserCreate(@domain,"Thing1")
;
; ;This will create a user account called thing2 on the workstation
; ;beanbag in the kixtart domain
; usercreate("kixtart/beanbag","thing2")
;
; ;This will create a user account called thing3 on the workstation
; ;beanbag in the kixtart domain, using the local Administrator account
; usercreate("kixtart/beanbag","thing2","beanbag\administrator|password")

if $rightstouse
$rightstouse = split($rightsToUse,"|")
if ubound($rightstouse) <> 1 exit(1) endif
? $rightstouse[0]
? $rightstouse[1]

if instr($target,"/") <> 0
$target = getobject("WinNT:").OpenDSObject("WinNT://$target,computer",$rightstouse[0],$rightstouse[1], 2)
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
else
$target = getobject("WinNT:").OpenDSObject("WinNT://$target",$rightstouse[0],$rightstouse[1],2)
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
endif
else
if instr($target,"/") <> 0
$target = getobject("WinNT://$target,computer")
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
else
$target = getobject("WinNT://$target")
if @error <> 0 and vartype($target) <> 9 exit(@error) endif
endif
endif

$user = $target.create("user","$user")
if @error <> 0 and vartype($user) <> 9 exit(@error) endif

$user.setinfo
exit(@error)
endfunction



Top
#60454 - 2001-11-08 01:18 AM Re: UserCreate() UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Ok - we REALLY REALLY REALLY need a proper UDF library (area) on this board. Have no idea how it would work or who would manage/edit it (Henri?) ... but we need one soon so that UDF's like this (and like aerathi's) don't get buried (lost focus, whatever - which happens real quick around here)

ScriptLogic's library is fine but the problem is - it belongs to them - not us - plus i get the impression it's not updated too often (or it's edited too vigoursly) not too sure what's going on there ...

We need our own !

-Shawn


-Shawn

[ 08 November 2001: Message edited by: Shawn ]

Top
#60455 - 2001-11-08 02:35 AM Re: UserCreate() UDF
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I concur! Let's all send Henri our requests. You know, there are two links on the forum home page that are just wasting space. I mean, FAQ is old, and examples is empty.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#60456 - 2001-11-08 03:32 AM Re: UserCreate() UDF
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
I agree also. And let's talk Les in to getting a MS Messenger account
Top
#60457 - 2001-11-08 07:23 AM Re: UserCreate() UDF
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

It is a good idea, but ....

  • how prevent we a chaos? who will monitor the input of topics?
    f.e. other boards are removing unwanted topics from their forums and they let
    the member know which forum he should use for his request.
    a suggestion: one or more active members becomes moderator from this new forum
    and they will read the information and they will close a topic when necessary to
    prevent a very long discussion.

  • topics code can't easily transfer to your environment. f.e. indentations are
    gone. so scripts must also put somewhere on internet in plain text format.
    a suggestion: the site http://kixscript.isorg.net will have a place for those scripts.

  • sometimes a script is in development and a lot of members are reacting on.
    is this what we want in this new forum? reactions are no problem on other forums.
    a suggestion: the moderator(s) will close topics must faster to prevent such
    discussions.

greetings.

btw: Bryce, your scripts are very usefull.

_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#60458 - 2001-11-08 11:31 AM Re: UserCreate() UDF
Anonymous
Unregistered


I agree with this suggestion. It's hard to find a script or UDF of your needs.

If there's a need for a moderator, I'm open for it.

Top
#60459 - 2001-11-09 12:02 AM Re: UserCreate() UDF
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
A Moderated UDF forum gets my vote.

There is a moderated read only "Examples" forum which apparently contains som "Fine examples" of scripts. This is currently empty. I like to think that this is because it is moderated by "no one" rather than that we've collectively been unable to come up with a "Fine example" of a script

Top
#60460 - 2001-11-08 03:57 PM Re: UserCreate() UDF
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I've borrowed Henri's ear for this cause. Let's hope this comes to fruition.

BTW DOC, IM is not gonna happen. Corporate firewall rules... they've got me in the penalty box for being vocal...

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#60461 - 2001-11-08 04:22 PM Re: UserCreate() UDF
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Hey Bryce !

I played around with this udf (it already has a place of honor in my udf folder here )
you may need to tweak a little because it returns 0 allthough the user wasn't created (occurs when $rightstouse has no right to create users )

Did you already got time to code CopyUser() ???
I don't want to push you, only looking forward to it !!!

ermmm .. in the mean time I had success creating those users (with all neccessary enhancements) on all of our domains using addusers.exe ... but hey , I'd really prefer UDFs !!!

J.

ps. Ahh yes, please create an udf library PLUS a games forum

_________________________



Top
#60462 - 2001-11-08 04:41 PM Re: UserCreate() UDF
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
The copy users command is really more complicated than I first thought.

Their are a large number of variables to handle and that will take some time to write.

When you copy a user account you really are creating a new account and filling in the new account with information from the template account. But at the same time, you will want to personalize the new account, and this is where the devil in the details is .

already, i see a need for a new UserSetpass() UDF, and i am sure others will popup. Even as i set here typing this, i am thinking that the devil of a task for all of the user properties... should be it's own UDF file as well UserProperties().

so a UserCopy() UDF will be a high end UDF that calls other UDF's to preform the required task's.


I will take a look at that bug in UserCreate(), thanks.

Bryce

Top
#60463 - 2001-11-08 04:56 PM Re: UserCreate() UDF
Anonymous
Unregistered


It's there a dedicated UDF forum, moderated by MartijnL (thanks!)

Henri

Top
#60464 - 2001-11-08 05:30 PM Re: UserCreate() UDF
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Henri,

thanks to you ! What about the Games forum ?

J.

_________________________



Top
#60465 - 2001-11-08 06:52 PM Re: UserCreate() UDF
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
looks like that bug in usercreate() is that limitation in the .openDSObject command.

Basically, if you already have a valid security token with the computer, it appears that .OpenDSObject ignores the given userid and password to make the connection with.

this tosses a nice wrench in to my thought's for my UDF library

Top
#60466 - 2001-11-08 07:05 PM Re: UserCreate() UDF
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Damn !

hopefully fixable !?!

_________________________



Top
#60467 - 2001-11-08 07:39 PM Re: UserCreate() UDF
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
But, hey, what do I talking about !

Cancel $rightstouse !!!
It will be anyway used exclusively (at least 99,9% I think) by admin staff !
right ?
So an avarage domain admin should know about getting applicable credentials (on a scripting point of view )

J.

_________________________



Top
#60468 - 2001-11-08 07:59 PM Re: UserCreate() UDF
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
but!...but!........

that is what i am going to have to do.

The sad thing is that $rightstouse does work for non-trusted domains and non-member workstations..... but you can do the same thing by mapping to the non-trusted domain/workstation IPC$ share (this is all that OpenDSObject does anyway).

Bryce

Top
#60469 - 2001-11-08 08:09 PM Re: UserCreate() UDF
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Bryce,

please note that the only reason why I even noticed that was that I was a bit tired at test time and accidentally assumed $rightstouse to be $usertocopy ...

_________________________



Top
#60470 - 2001-11-09 01:45 AM Re: UserCreate() UDF
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I like the Games forum idea.

cj

Top
#60471 - 2001-11-09 03:12 AM Re: UserCreate() UDF
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hey ceej, how about scripting some DirectX games - maybe with a little DirectAnimation, delicately wrapped in Internet Explorer, with a milk chocolately KiXtart center ?

code:

break on


$ie = createobject("internetexplorer.application")


$ie.navigate("about:blank")
while $ie.busy and @error=0 loop


$html = '<'+'OBJECT ID="DAControl" STYLE="position:absolute; left:0; top:0;width:800;'+
'height:300;z-index: -1" CLASSID="CLSID:B6FFC24C-7E13-11D0-9B47-00C04FC2F51D"'+'>'+
'<'+'/OBJECT'+'>'


$ie.document.write("$html")


$ie.visible = 1


$dacontrol = $ie.document.all("dacontrol")
$m = $dacontrol.meterlibrary


; Create an animated color


$half = $m.danumber("0.5")
$clr = $m.colorhslanim($m.mul($m.localtime, $m.danumber("0.345")),$half, $half)


; Contstruct a 12pt font and a text image


$font = $m.font("Arial", 11, $clr)
$txtimg = $m.stringimage("KiXtart 2001 - A Scripting Odessey", $font)


; Move the text image across the page


$pos = $m.mul($m.sin($m.localtime), $m.danumber("0.02"))
$scl = $m.add($m.danumber("2"), $m.abs($m.mul($m.sin($m.localtime), $m.danumber("3"))))
$xf = $m.compose2($m.translate2anim($m.danumber("0"), $pos), $m.scale2uniformanim($scl))
$txtimg = $txtimg.transform($xf)


; Assign the animation back to the control and start it


$dacontrol.image = $txtimg
$dacontrol.start

gets$


exit 1


Code adapated from the DirectAnimation SDK

-Shawn

[ 09 November 2001: Message edited by: Shawn ]

[ 09 November 2001: Message edited by: Shawn ]

Top
#60472 - 2001-11-09 10:08 AM Re: UserCreate() UDF
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
I just tried to get that by using the edit post button, but it says that only admins can do that

Is there someway to get this code out easily?

cj

Top
Page 1 of 2 12>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 578 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.077 seconds in which 0.027 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org