Your logon scripts in Vista/XP Environment?

TechieSooner

Supreme [H]ardness
Joined
Nov 7, 2007
Messages
7,601
Anyone mind posting it? I'm having trouble coming up with one that works in both Vista and XP:

Map Drives
Rename drives
Map Printers
 
What part of the script errors out for Vista on you? I still use the same "net use S: \\servername\sharename" that I always have.

I don't have any for renaming. Printers I generally don't load from a script anymore, used to do that a while ago with older DOS programs that just used LPT.
 
What part of the script errors out for Vista on you? I still use the same "net use S: \\servername\sharename" that I always have.

I don't have any for renaming. Printers I generally don't load from a script anymore, used to do that a while ago with older DOS programs that just used LPT.
I can't get the printers to work... I'd have to check it again and say exactly where it fails.

Are you using a batch file, or a VB script?
VB Script.


And actually, I also use it to create shortcuts on the desktop.
 
i use this commonly on all my setups

net use S: /del
net use U: /del

net use S: \\server\storage
net use U: \\server\%username%

RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer
 
Yes....

And my desktop shortcut doesn't work on Vista either.

I've had mixed results with Vista on Server 2K3 print shares. Some fairly standard printers work OK, like HP LaserJet 4000 series. But other printers, the drivers for Vista are different than the drivers for 2K/XP/2K3...and with Server 2K3 you don't have the option to install additional drivers for Vista for the shares. Sucks!!! So in those cases, on the one client that I flipped to Vista for workstations, gotta map those printers to the workstations as local IP printers, installing drivers locally. :rolleyes:
 
I've had mixed results with Vista on Server 2K3 print shares. Some fairly standard printers work OK, like HP LaserJet 4000 series. But other printers, the drivers for Vista are different than the drivers for 2K/XP/2K3...and with Server 2K3 you don't have the option to install additional drivers for Vista for the shares. Sucks!!! So in those cases, on the one client that I flipped to Vista for workstations, gotta map those printers to the workstations as local IP printers, installing drivers locally. :rolleyes:

That sucks. I'm waiting to Monday or Tuesday (who knows what Mondays are like...) to test this out to see exactly what doesn't work.

I'm planning on skipping Vista and going to Windows7 when available, but since they are so closely related, I can test on Vista NOW and at least get my logon scripts right.

I just don't want to install printers and drives manually. I've already met at a middle ground and settled with the fact I doubt I'll ever get printer mapping by group (and setting defaults) to work. But just plain ol' drive mapping, printer sharing, and desktop shortcut creating shouldn't be that hard.
 
Yeah... I put the file on the machines when I format... con2prt is awesome. I have mine set to delete the printers EVERYTIME someone logs in, then RE-ADD them everytime. That way if I install a new printer on the network it's there on first login. I love it.
 
i use this commonly on all my setups

net use S: /del
net use U: /del

net use S: \\server\storage
net use U: \\server\%username%

RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer

I even tried doing it via this method today. The problem I see is this:
If the connection does not exist, net use fails.
If the connection already exists, net use fails.

Thus, for a new user, the connection to drive S isn't there, so the net use S: /del will fail, resulting in the entire batch file not processing.
Also, running that PrintUIEntry command AGAIN at next logon results in an error as well (the connection already exists).

Is there a command to have it resume through the file, regardless of what fails or not? I'm not super familiar with batch files.

Also still have issues with the printer mapping on one of my printers, but haven't troubleshooted that 100% yet.

And also, is there a way, using net use in a batch file, to do these?
1) Friendly names on printers
2) Friendly names on drives
3) Add a desktop shortcut to a specified location
4) Registry edits

Thanks!
 
doesn't error for me in xp =)

Sure it does. I've got my drive X mapped right now, and just ran the net use command again.

3528919556_cbc088b057.jpg


And I don't have a drive S, so when I try to delete S, like the script would be doing to a new user:
3528111231_87feeb8fc0.jpg
 
I have never seen a batch file fail cause a net use x: /d resulted in the x drive not being found. Batch files just read commands not caring if the previous one failed.
 
same with printers, will add it, any time that it pops up on the user side for me is when i had a printer shared on a desktop not the server and that desktop was off, the script hanged for 10 seconds and then popped up with an error, click okay rest of script runs.
 
OK, I'll try it again then. My other question is how do I map multiple printers?

Do I just do two lines like this?

RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer
RunDll32.EXE printui.dll,PrintUIEntry /in /n \\server\printer2
 
Code:
ption Explicit	 'Require all variables to be declared

On Error Resume Next  'Ignore errors (Only errors will be from 98 machines
		      'with printers already installed)

'Declare the variables
	
Dim objNetwork	'Variable to bind to the COM object		
Dim computer	'Variable that determines computer name
Dim computer2	'Variable that determines computer location

'Retrieve computer name and parse it into room number
'and location.

set objNetwork = Wscript.CreateObject("Wscript.Network")
computer = Cstr(objNetwork.ComputerName)
'computer2 = Cstr(Mid(computer, 4, 1))
[B]computer = Cstr(Left(computer, 5))[/B]

'Test for computer name and connect the 
'appropriate printers and set the correct default
'printer.

select Case computer

    	Case "NURSE"    
            objNetwork.AddWindowsPrinterConnection "\\printserver\P1"
            objNetwork.AddWindowsPrinterConnection "\\printserver\P2"
            objNetwork.AddWindowsPrinterConnection "\\printserver\P3"
            'objNetwork.SetDefaultPrinter "\\Server Name\Printer share Name"
   
    	

	End Select
This vbscript has been edited for reasons of my job, but fill in the blanks with your own naming and you should be good to go. If you name groups of machines similar to each time you put them into production this might be helpful to you. The bold line searches the first 5 characters of the machine name (you can edit it for your naming scheme) and will the same printers each time someone with the first 5 characters matching the case. You can also set the default printer as well if there are multiple that you are adding. If the printers are already there, it will skip it and move on

Might be useful to someone at the very least
 
Back
Top