Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

Login script on Window 7

There is a  Window 7 (in workgroup) that need to access our file services and network printer.
Is it possible to write login script on the desktop that will ask for user authentication and then mount the file server and printer ? For some reason, this Window 7 will not join the window domain.

Tkx
0
AXISHK
Asked:
AXISHK
  • 2
  • 2
  • 2
2 Solutions
 
Seaton007Commented:
Here is one I use for mapping drives:
'***************************************************************************
' Script Name:	MapDrives.vbs
'      Author:	Seaton007
'     Created:	September 2012
'
' Description:	Asks the user for their domain credentials and then maps
'				a network drive.
'***************************************************************************

' Set the domain name
Const conDomain = "DOMAIN_NAME"

' Get the user name and password
strDomainUser = InputBox("Please enter your user name:" & vbCrLf & vbCrLf & "Example: JSmith", "User Name")
	If VarType(strDomainUser) = 0 Then WScript.Quit	' If the "Cancel" button is pressed then quit
strPassword = InputBox("Please enter your password:" & vbCrLf & vbCrLf & "NOTE: Your password will be visible below, so please make sure nobody is watching as you type it.", "Password")
	If VarType(strPassword) = 0 Then WScript.Quit	' If the "Cancel" button is pressed then quit

' Map new network drives
strUser = conDomain & "\" & strDomainUser
Set objNetwork = CreateObject("WScript.Network")
	objNetwork.MapNetworkDrive "DRIVE_LETTER:", "\\SERVER_NAME\SHARE_NAME", True, strUser, strPassword
MsgBox "Finished mapping drives.", vbOKOnly+vbInformation+VbMsgBoxSetForeground, "Finished"

Open in new window

There is a built-in script in Windows 7 that you can use to manage printers.  You should be able to call it from within the above script to add the printer(s).  Here is the information on how to use it: Prnmngr.vbs
0
 
Joseph MoodyBlogger and wearer of all hats.Commented:
I think the best solution will be to figure out why it won't join the domain. What error are you getting?
0
 
AXISHKAuthor Commented:
This is a senior management's laptop but only occaonially need to access to company network. He refuses his personal laptop to join the domain.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Joseph MoodyBlogger and wearer of all hats.Commented:
Sucks... any particular reason? I know we had a lot like that that were XP. Offline files never worked that great.

Windows 7 is a completely different story though.

But if you still can't do it, I would place a script (like those mentioned above) and place them in the Common Startup folder for the computer.

c:\Programdata\Microsoft\Windows\Start Menu\Programs\StartUp
0
 
AXISHKAuthor Commented:
Tks
0
 
Seaton007Commented:
You probably already figured this out, but I forgot to mention... in the above script code, just replace DOMAIN_NAME with your domain name, replace DRIVE_LETTER with the drive letter you want to map, and replace \\SERVER_NAME\SHARE_NAME with the path you want to map it to.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now