Solved

logon script not working with Server 2008

Posted on 2008-10-23
4
3,966 Views
Last Modified: 2012-05-05
I have several scripts that run on logon that map different drives and printers based on group membership. I am testing Server 2008 for compatability and have run into the following problem: when logging on with a domain user nothing is mapped. There is also a script that places shortcuts on the desktop and that is still succesful, but neither the mapped drives or printers make it on. It also takes a very, very long time to log in.

This server is, in the long run, dsetined to be a terminal server for quite a few users, so getting the logon scripts to work is very important.

Thanks.
0
Comment
Question by:wally_llama1
  • 2
4 Comments
 
LVL 24

Expert Comment

by:andrew_aj1
Comment Utility
You did not provide the script that you are using, but I actually just made a vbs script this week to do exactly what you want. I use this script for both desktop machines and on a terminal server. All you need to do is replace the group name under the select case statement with your group names and point the drives/printers to the correct destination. Good Luck.
' VBScript to map drives based on group membership

'---------------------------------------------------

On Error Resume Next
 

Set WshNetwork = CreateObject("WScript.Network")
 

DomainString = WshNetwork.UserDomain

UserString = WshNetwork.UserName
 

Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
 

'unmap all drives

WshNetwork.RemoveNetworkDrive "V:",true,true

WshNetwork.RemoveNetworkDrive "W:",true,true

WshNetwork.RemoveNetworkDrive "X:",true,true
 
 

For Each GroupObject In UserObj.Groups

	Select Case GroupObject.Name

		Case "Group 1"

			WshNetwork.MapNetworkDrive "Z:", "\\<Server>\<Share>"

			wshNetwork.AddWindowsPrinterConnection "\\<Server>\<Share>"

		Case "Group 2"

			WshNetwork.MapNetworkDrive "Y:", "\\<Server>\<Share>"

		Case "Group 3"

			WshNetwork.MapNetworkDrive "X:", "\\<Server>\<Share>"

	End Select

Next
 

WScript.Quit

Open in new window

0
 

Author Comment

by:wally_llama1
Comment Utility
Sorry for not including the printer mapping script. Yours is much nicer and I will probably replace mine with it, but I do notknow if that will solve the problem. SInce first asking the quesiton I created an OU just for remote users that my current printer mapping script does not apply to and the slow log in problem was solved.

I have disabled UAC on the 2008 server. Is there an issue with mapping printers specific to Server 2008?
0
 
LVL 24

Accepted Solution

by:
andrew_aj1 earned 250 total points
Comment Utility
First I do not recommend you disable UAC on Server 2008. It is much improved over UAC on Vista and you should want to keep your server as secure and safe as possible.
I am unaware of any specific printer mapping issues with Server 2008 as long as there are drivers for the device. I deployed this script on a network that had no fewer than 11 different printer models from various vendors.
Test the script when you can and let me know if it works for you. If it does not maybe we can modify it for your situation.
0
 

Expert Comment

by:LimestoneData
Comment Utility
hello, pardon my jumping in here but I am looking for a solution much like what it appears your scrip is doing.. can you clarify a couple of things for me? Thanks in advance.

You said,

All you need to do is replace the group name under the select case statement with your group names
For Each GroupObject In UserObj.Groups
        Select Case GroupObject.Name
                Case "Group 1
"
                        WshNetwork.MapNetworkDrive "Z:", "\\<Server>\<Share>"
                        wshNetwork.AddWindowsPrinterConnection "\\<Server>\<Share>"
                Case "Group 2
"
                        WshNetwork.MapNetworkDrive "Y:", "\\<Server>\<Share>"

Open in new window

So does that mean all I would have to do is, replace the highlighted text with my group names.. for example CAD and ACCOUNTS and then I could set the drives I want to be mapped for each?

Or do I need to add more lines of the "select case" statement each one with a different GroupObject.CAD and GroupObject.ACCOUNTS ya still a little hazy...

Also I note you put - Set UserObj = GetObject("WinNT://"
Where as my installation is in Windows would I need to change that as well?

Finally I know how to call a .bat file can I just run the .vbs script from the same place in the same way or do I have to call it from a .bat file? Sorry really rookie questions I know...

The reason I ask is I need to have the .bat file run unless there is a way to put in THIS script a line I need to run each time users login...

cmd /c "start \\printsrv\PCClient\win\pc-client-local-chache.exe --slient"

Our print tracking software requires this to be there for each login... so can this be added to your script, or do I run my bat file and after this print thingy is called then call your vbs script?

Thanks very very much for this help, I think I maybe need to open a new question to give you some points as this is obviously bordering on answering an entirely new issue, if you would prefer that let me know I would be happy to do so..

0

Featured Post

Shouldn't all users have the same email signature?

You wouldn't let your users design their own business cards, would you? So, why do you let them design their own email signatures? Think of the damage they could be doing to your brand reputation! Choose the easy way to manage set up and add email signatures for all users.

Join & Write a Comment

Recently, I was asked to look into SCCM 2007 by my employer, having a degree of experience of earlier versions of SMS and some previous SCCM knowledge I didn't expect the procedure to involve to much time. I read a number of guides concerning it…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This tutorial will walk an individual through the steps necessary to configure their installation of BackupExec 2012 to use network shared disk space. Verify that the path to the shared storage is valid and that data can be written to that location:…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now