?
Solved

logon script not working with Server 2008

Posted on 2008-10-23
4
Medium Priority
?
3,974 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 24

Expert Comment

by:andrew_aj1
ID: 22800850
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
ID: 22807555
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 1000 total points
ID: 22807583
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
ID: 22901128
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
Suggested Courses

770 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