Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

We have a laptop trolley down in science, we've had many issues with getting these laptops on the domain so we've got them running standalone with steadystate and various other things to lock them down.

 

Obviously we'd like them to get access to their shared area. I reckon we can do this by means of visual basic script. This would run when the user logs in and ask them for their network username. Then the script will map the drive (which should throw up the windows authentication window).

Anyone think of a better way of doing this? Am I going down the wrong route? (Using the domain isn't an option here).

 

Thanks :)

Posted
I've done the same thing, except my script is written in Perl and asks for the user's password too.

 

Any chance of sharing the knowledge?

Guest AustenLowe
Posted
a bit of an out of the box thought; what about using windows sharepoint services with webdav, you can access the documents via a webpage
Posted

The following Perl script uses Tk to create a little GUI box to ask the user for their username and password, then maps a network drive using those details.

 

 

 

# Connect to senior IT room file areas and printers.

$doAuthentication = sub {

$username = $entry1->get();

$password = $entry2->get();

 

# Change the following as appropriate.

system("net use h: \\\\server\\$username /user:$username $password /persistent:no");

 

exit(0);

};

 

 

 

# Ask the user for a username and password.

while (1 == 1) {

$mainWindow = MainWindow->new();

$mainWindow->configure(-title=>$computerName, -background=>'blue');

if ($screenRes == $WXGA) {

$mainWindow->geometry('+575+350');

} else {

$mainWindow->geometry('+375+250');

}

 

$frame1 = $mainWindow->Frame(-relief=>'groove', -borderwidth=>3, -background=>'blue');

$frame1->pack(-side=>'top', -fill=>'x');

$label1 = $frame1->Label(-text=>'Username:', -background=>'blue', -foreground=>'white');

$label1->pack(-side=>'left');

$entry1 = $frame1->Entry(-width=>40, -background=>'white');

$entry1->pack(-side=>'left', -pady=>3);

 

$frame2 = $mainWindow->Frame(-relief=>'groove', -borderwidth=>3, -background=>'blue');

$frame2->pack(-side=>'top', -fill=>'x');

$label2 = $frame2->Label(-text=>'Password:', -background=>'blue', -foreground=>'white');

$label2->pack(-side=>'left');

$entry2 = $frame2->Entry(-width=>40, -background=>'white');

$entry2->pack(-side=>'left', -pady=>3);

 

$entry2->bind(''=>$doAuthentication);

 

MainLoop();

}

Guest frankybaloney
Posted

How do I get the script to run?

 

Do I need to put it into a bat file and run it?

Posted
How do I get the script to run?

 

If you are talking about the Perl script, you will need a Perl interpreter (dhicks can probably suggest one) and Tk libraries (I suspect GTk is used for this).

 

@dhicks: If you would like to share some more Perl scripts with us, PM me and I'll set up a login on the wiki ;)

Guest frankybaloney
Posted

Can the script be converted into a program?

 

Basically type in username and password, click OK type of thing with a nice GUI interface?

 

If so, how is this done? A step by step guide would be helpful - im new to all of this...

 

cheers and apologies for my lack of understanding

Posted

Perl on Windows: go and download and install ActivePerl from Activestate (http://www.activestate.com). This includes the Tk library, so the code above should run fine.

 

Place the Perl code into a text file with a .pl extension. Double-clicking on the file should then run it.

 

The code above produces a little GUI box that asks for username and password (that's what the Tk library does).

 

As others have pointed out, a script to to this might be overkill for your situation. I use the above code in part of a larger system that handles workstation reimages, software installation, printing system and so on (most of which isn't finished yet, so it'll be a while until its worth posting anything on the Wiki). I find that the script above is handy when you have several different servers to connect to with the same username/password (I plan to get it to handle logging in to Moodle, too). It also means that teachers can use their own laptops in school without having to make them part of your Windows domain (which is handy, as we don't have one).

 

--

David Hicks

Posted
What's wrong with net use s: \\serveranme\sharename ?

 

Inevitably autentication will fail, and windows will prompt you to enter valid credentials.

 

That's what I was hoping would happen- However, it seems that it doesn't and VB just reports the error... Annoying...

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



×
×
  • Create New...