Re: Add second Print Server
hello,
here is a vbscript.
put a text file in \netlogon\printer\default.txt with just the target
printer server name.
It is from our script bu it stripped out things, can you test it ?
Const ForWriting = 2
Const ForReading = 1
Function GetDefaultPrinter()
sRegVal = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
sDefault = ""
On Error Resume Next
sDefault = objShell.RegRead(sRegVal)
sDefault = Left(sDefault ,InStr(sDefault, ",") - 1)
On Error Goto 0
GetDefaultPrinter = sDefault
End Function
On Error Resume Next
Set objNetwork = CreateObject ("Wscript.Network")
Set objShell = CreateObject ("WScript.Shell")
Set objFSO = CreateObject ("Scripting.FileSystemObject")
LogonServer = objShell.ExpandEnvironmentStrings("%logonserver%")
UserName = objShell.ExpandEnvironmentStrings("%username%")
Set objFileServer = objFSO.OpenTextFile (LogonServer &
"\netlogon\printer\default.txt", ForReading)
strComputer = "."
PrintServer = objFileServer.ReadLine
PrintServer = LCase (PrintServer)
Err.Clear
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!\\" & strComputer & "\root\cimv2")
If Err.Number Then
wscript.echo ("Error : " & Err.Number & ": " & Err.Description & VbCrLf)
Err.Clear
Else
ImpDefault = GetDefaultPrinter
Set colInstalledPrinters = objWMIService.ExecQuery _
("SELECT * FROM Win32_Printer")
For Each objPrinter in colInstalledPrinters
PrinterArray = Split (objPrinter.Name , "\")
If (LCase(objPrinter.ServerName) <> "") and (LCase(objPrinter.ServerName)
<> "\\" & PrintServer) then
objNetwork.AddWindowsPrinterConnection "\\" & PrintServer & "\" &
PrinterArray(3)
If Err.Number Then
wscript.echo ("Error : " & Err.Number & ": " & Err.Description &
VbCrLf)
Err.Clear
End If
If ImpDefault = objPrinter.Name then
objNetwork.SetDefaultPrinter ("\\" & PrintServer & "\" &
PrinterArray(3))
If Err.Number Then
objFile.Write ("Error: " & Err.Number & ": " & Err.Description &
VbCrLf)
Err.Clear
End If
End If
objNetwork.RemovePrinterConnection objPrinter.Name
End If
Next
End If
objFileServer.Close
objFile.Close
--
Cordialement,
Mathieu CHATEAU
http://lordoftheping.blogspot.com
"Jim" <Jim@discussions.microsoft.com> wrote in message
news:54CDFFBA-00FE-4790-9E6D-E570986B5113@microsoft.com...
> Mathieu,
> I like the vbscript solution. But, I do not know scripting. How can I get
> a
> quick vbscript to change some users to a different print server?
> Jim
>
> "Mathieu CHATEAU" wrote:
>
>> Hello,
>>
>> the vbscript will scan already installed printer and migrate only
>> installed
>> one.
>> Depending how is your OU & co, you may put 50% of users on each server.
>> So you will only have 50% of users that need to log in again to print.
>>
>> You may also put two vbscript (print_serverA.vbs; print_serverB.vbs) on
>> their workstation so they can switch themself.
>>
>>
>> --
>> Cordialement,
>> Mathieu CHATEAU
>> http://lordoftheping.blogspot.com
>>
>>
>> "Ian Zahn" <IanZahn@discussions.microsoft.com> wrote in message
>> news:880D840E-656A-438B-8373-3050FA13CA58@microsoft.com...
>> >I have to same senario, but haven't used a script to give them acces to
>> >the
>> > printers. Is it a matter of creating the script first apply to users
>> > then
>> > change the script and migrate to new server?
>> > Just trying to stop the "I cannot print" calls coming in, It would be a
>> > matter of assuming which users need which printers as well?
>> >
>> > "Mathieu CHATEAU" wrote:
>> >
>> >> Hello,
>> >> To backup/restore, the best tool:
>> >> Print Migrator 3.1
>> >> http://www.microsoft.com/downloads/...25-cbc9-44da-b2c9-ffdbc46b0b17&displaylang=en
>> >>
>> >> For switching users, the easy way is a vbscript at logon.
>> >> the vbscript will read a text file on netlogon that gives the current
>> >> printer server.
>> >> When you want to switch them, you change the txt and make them log
>> >> again
>> >> to
>> >> switch.
>> >>
>> >> --
>> >> Cordialement,
>> >> Mathieu CHATEAU
>> >> http://lordoftheping.blogspot.com
>> >>
>> >>
>> >> "Jim" <Jim@discussions.microsoft.com> wrote in message
>> >> news:879F4B51-B2B4-4C3B-925F-0943A3E5EADE@microsoft.com...
>> >> > In a W2003 domain, with one Print server. I want to add a second
>> >> > print
>> >> > server. I want to have about 15 of the many printers put on the
>> >> > second
>> >> > print
>> >> > server.
>> >> > I proabably can recreate or use a print manager utility to
>> >> > backup/restore
>> >> > the printers onto the second print server. How can I have the client
>> >> > machines
>> >> > access the same printer as they are configured for that is now on a
>> >> > different
>> >> > print server without touching there machines? Tks, Jim
>> >>
>> >>
>>
>>