Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / August 2004

Tip: Looking for answers? Try searching our database.

Replace bat-file with a script!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christian-Josef Schrattenthaler - 27 Jul 2004 13:30 GMT
Hi!

I have a batch-file (*.bat) which logon the client to our server, including
printer and drive mappings.

Now I want to replace the batch-file with a script for the windows scripting
host, because I want the users to enter their username and password, and
then the script should make the mappings suitable to the username...

I lookd for the WSH and VBSCRIPT and JSCRIPT, but I didn't get any usable
information!

Is it possible, to write such a script? Or does the WSH not support this
feature?

Thanks and greetings,
Christian.
McKirahan - 27 Jul 2004 13:46 GMT
> Hi!
>
[quoted text clipped - 13 lines]
> Thanks and greetings,
> Christian.

A Google search of "WSH Logon script" returned:

WSH Logon Scripts
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=4760&pg=1
Torgeir Bakken \(MVP\) - 27 Jul 2004 14:01 GMT
> I have a batch-file (*.bat) which logon the client to our server, including
> printer and drive mappings.
[quoted text clipped - 8 lines]
> Is it possible, to write such a script? Or does the WSH not support this
> feature?
Hi

In VBScript, you can use InputBox to ask for username and password,
and MapNetworkDrive to map a network drive supplying username and
password if needed.

Note that you can pick up the current user name like this:

Set objWshNet = CreateObject("WScript.Network")
strCurrentLoggedInUser = objWshNet.UserName
WScript.Echo strCurrentLoggedInUser

You can also from your vbscript use the Internet Explorer object
to ask for and mask password input, take a look here:

http://groups.google.com/groups?selm=3EB7E661.7D857459%40hydro.com

The script in the link above requires IE 5.5+, if you want the script
to work on IE 5.01 as well, remove the following two lines (this will
re-enable right-click menu on the dialog):

           &  " onContextmenu='window.event.cancelbubble=true" _
           & ":window.event.returnvalue=false'" _

If you have Win98 or WinME computers, this might be relevant for the
PasswordBox routine in the link above:

http://groups.google.com/groups?threadm=e3496be5.0309162049.6c28474e%40posting.g
oogle.com


WSH 5.6 documentation (local help file) can be downloaded from here
if you haven't got it already:
http://msdn.microsoft.com/downloads/list/webdev.asp

Signature

torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Christian-Josef Schrattenthaler - 27 Jul 2004 16:29 GMT
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> schrieb im
Newsbeitrag news:OEQ4Pp9cEHA.1692@tk2msftngp13.phx.gbl...

> In VBScript, you can use InputBox to ask for username and password,
> and MapNetworkDrive to map a network drive supplying username and
> password if needed.

I know InputBox, but I can only ask for one. It is not possible to create a
windows which asks for the username and the password. Or do you have a hint,
how this works?

Greetings,
Christian.
Torgeir Bakken \(MVP\) - 27 Jul 2004 16:40 GMT
> "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> schrieb im
> Newsbeitrag news:OEQ4Pp9cEHA.1692@tk2msftngp13.phx.gbl...
[quoted text clipped - 6 lines]
> windows which asks for the username and the password. Or do you have a hint,
> how this works?
Hi

Did you take a look at the other link I gave you? You can use the
Internet Explorer object to do this (as the script in the link in
my other post in this thread do).

Signature

torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

Welman Jordan - 28 Jul 2004 01:42 GMT
> > "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> schrieb im
> > Newsbeitrag news:OEQ4Pp9cEHA.1692@tk2msftngp13.phx.gbl...
[quoted text clipped - 11 lines]
> Internet Explorer object to do this (as the script in the link in
> my other post in this thread do).

And another approach is to use HTML application (HTA).
Jared - 01 Aug 2004 02:15 GMT
Pardon me, but, am I missing something? Your users have just authenticated
to your domain, and now, you want them to supply their credentials all over
again just to map their drives and printers?  In my opinion this should be
transparent to the end user. You can use WSH to get the username of the
currently logged on user, use that to map as desired. I would hate to work
in your company, logging in twice???

>> > "Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> schrieb im
>> > Newsbeitrag news:OEQ4Pp9cEHA.1692@tk2msftngp13.phx.gbl...
[quoted text clipped - 15 lines]
>
> And another approach is to use HTML application (HTA).

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.