Jump to content

Simple Netlogon script


Cem
 Share

Recommended Posts

How and with what Editor I make these lines save it as au3

After it converting is easy.

net use Z: /delete

net use Z: \\10.10.10.10\Dir Password /user:me

echo You are Logged On The Drive !

pause

I dont want the user to see the password or the userename.

Is there a way to look who is using it by checking the Domain-User-Name.

Regards

Link to comment
Share on other sites

How and with what Editor I make these lines save it as au3

After it converting is easy.

I dont want the user to see the password or the userename.

Is there a way to look who is using it by checking the Domain-User-Name.

Regards

<{POST_SNAPBACK}>

Hello Cem,

Some useful AutoIt functions for this one are DriveMapAdd, DriveMapDel and DriveMapGet.

An example code:

$Username="me"
$Password="Password"

DriveMapGet("Z:")

if not @error then DriveMapDel("Z:")

DriveMapAdd("Z:","\\10.10.10.10\Dir",0, $Username, $Password)

Or even better is to use: DriveMapAdd("Z:","\\10.10.10.10\Dir",8, $Username) for the last line.

That shows the user an authentication dialog if authentication is required.

To get the currently logged on user name, you could use:

$Username=@UserName on the first line of the script.

Regards,

-Sven

Link to comment
Share on other sites

Thank You SvenP !!!  it worked !!!!!!!!!!!!

Is there a list of the Script Commands somewhere ?

/Cem

<{POST_SNAPBACK}>

Well, if you installed AutoIt3 correctly, you should have an "AutoIt help file" in your Start menu/Programs/AutoIt3.

Regards,

-Sven

Link to comment
Share on other sites

Thank You again SvenP

I now made a "not working" script for couple of users

getting this error message:

Line 0 (File "C:\usertest.exe"):

Until $i = 11

Error: "Until" satement with no matching "Do" statement.

Well I dont get it, to me I have a "Do"

$validuser=@UserName

$soy(0)="user0"

$soy(1)="user1"

$soy(2)="user2"

$soy(3)="user3"

$soy(4)="user4"

$soy(5)="user5"

$soy(6)="user6"

$soy(7)="user7"

$soy(8)="user8"

$soy(9)="user9"

$soy(10)="user10"

$soy(11)="user11"

$i = 0

Do

if $validuser=$soy($i) Then

$Username="user11"

$Password="Password"

DriveMapGet("Z:")

if not @error then DriveMapDel("Z:")

DriveMapAdd("Z:","\\10.10.10.10\DIR",0, $Username, $Password)

EXIT

else $i = $i + 1

Until $i = 11

MsgBox(0, "Example", "Invalid User !")

Link to comment
Share on other sites

Thanks thats what is was tilthis point I agree in reading.

How can I search for filling an area with values.

As I try it does not work

$soy[0] = "user0"

does get me an error

Expected a "=" operator in assignment statement.

Please advice (please)

Link to comment
Share on other sites

Thank You SlimShady !

As far as I came is this and it

looks like I have not done anything wrong

(reading on the Link You gave me)

AutoIt Error

$soy[0] = "user0"

$soy^ ERROR

Error: Expected a "=" operator in assignment statement.

Dim $soy = 11

$soy[0]= "user0"

$soy[1] = "user1"

$soy[2] = "user2"

$soy[3] = "user3"

$soy[4] = "user4"

$soy[5] = "user5"

$soy[6] = "user6"

$soy[7] = "user7"

$soy[8] = "user8"

$soy[9] = "user9"

$soy[10] = "user10"

$soy[11] = "user11"

$validuser=@UserName

$Username="Me"

$Password="Password"

$i = 0

Do

if $validuser=$soy[$i] Then

DriveMapGet("Z:")

if not @error then DriveMapDel("Z:")

DriveMapAdd("Z:","\\10.10.10.10\DIR",0, $Username, $Password)

endif

    $i = $i + 1

Until $1 = 11

exit

MsgBox(0, "Invalid User")

Link to comment
Share on other sites

IT's DONE !!!!

This is a working Version now:

Dim $soy[12]$soy[0] = "user0"

$soy[1] = "user1"

$soy[2] = "user2"

$soy[3] = "user3"

$soy[4] = "user4"

$soy[5] = "user5"

$soy[6] = "user6"

$soy[7] = "user7"

$soy[8] = "user8"

$soy[9] = "user9"

$soy[10] = "user10"

$soy[11] = "user11"

$validuser=@UserName

$i = 0

Do

if $validuser = $soy[$i] Then

MsgBox(0, "You are going to be loggede in because the Value of $i is:", $i)

$Username="me"

$Password="password"

DriveMapGet("Z:")

if not @error then DriveMapDel("Z:")

DriveMapAdd("Z:","\\10.10.10.10\DIR",0, $Username, $Password)

endif

MsgBox(0, "No login because the Value of $i is:", $i)

    $i = $i + 1

Until $i >= 12

exit

MsgBox(0, "Invalid User")

THANKS FOR ALL YOUR SO FAST H E L P
Link to comment
Share on other sites

A few tips I thought might help:

The way Windows Networking operates, once a username/password has been supplied for a particular server or domain, it need not be supplied again in subsequent NET USE commands.

Thus, if you connect to one share (netlogon seems sensible) from within an autoit script (which hides the password) your others can be in a standard batch-file which is Run from the script. This is easier to maintain than modifying the script for each change of drive-mapping.

So, doing it this way you just need a simple script that takes-in a password (and optionally a username if different from the local one) makes a single connection to the server, checks the error-flag to see it's successful, then launches the batch-file.

BTW, On NT/2k/XP-based systems, shares are permanent by default, and this can lead to a serious security problem if not dealt-with. (Trust Micrsosoft :idiot: ) Therefore it's highly advisable to start the whole process with the commands:

NET USE * /DELETE /YES

and

NET USE /PERSISTENT:NO

either called by RunWait statements, or by equivalent Autoit DriveMap commands.

Hope this helps,

Ian.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...