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.

Who is Participating?
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
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?
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.
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

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
AXISHKAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.