Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

migration of print services

Status
Not open for further replies.

SMO6

Technical User
Feb 11, 2002
159
US
Hello everybody.

I'm moving print services from one server to another. I've already recreated all the printers on the new server. I'm now at the stage where I need to change printing services over client side. I don't want to touch each individual machine (around 50 of them). There's got to be a way to automate the disconnection of the current printers and the connection of the new printers by way of SMS or Active Directory, both of which we have.

What good is technology if we can't make it work for us?
 
You have already done the hard part. Set this as a login script and it will create the new printers.



Set WSHNetwork = CreateObject("WScript.Network")

'Remove Old Printers
WSHNetwork.RemoveWindowsPrinterConnection "\\ServerOld\HP5si"
'Install Printers
WSHNetwork.AddWindowsPrinterConnection "\\Server\HP5si"
 
I've got XP and 2000 clients. Does the syntax differ for XP machines? I didn't get the remove or add scripts to work on my XP workstation. I've yet to test the scripts on a 2000 workstation. I did get the following to work though:

'VBScript
'Script for NT 4.0, Windows 2000 and XP

Set WshNetwork = WScript.CreateObject("WScript.Network")

PrinterPath = "\\torrent\5500DTN"

WshNetwork.AddWindowsPrinterConnection PrinterPath

I tried changing the 'wshnetwork' line at the bottom to read: WshNetwork.AddWindowsPrinterConnection PrinterPath

...but that didn't work. Plz help! Thanks!
 
sorry my last post wasn't proofread...

I meant to say this at the end:

I tried changing the 'wshnetwork' line at the bottom to read: WshNetwork.RemoveWindowsPrinterConnection PrinterPath

This didn't work.
 
Are you getting any error messages?

Try downloading a copy of PrimalScript from Sapien.com. It helps isolate what is going on.
 
I am getting errors. If I could only post a picture here.... This is what the error message says:

Script: C:\Documents and Settings\....script.vbs
Line: 4
Char: 1
Error: Object doesnt support this property or method: 'WSHNetwork.RemoveWindwosPrinterConnection'

Code: 800A01B6
Source: Microsoft VBScript runtime error

I also downloaded the trial version of PrimalScript. No offense but alot a good it does me if I don't know how to use it! :(
 
Post your whole script here so we can see what exactly is on line 4.
 
Set WshNetwork = WScript.CreateObject("WScript.Network")

PrinterPath = "\\servername\printername"

WshNetwork.RemoveWindowsPrinterConnection PrinterPath
 
Try using this instead:

WshNetwork.RemoveWindowsPrinterConnection (chr(34) & PrinterPath & chr(34))

The problem you are getting is that you don't havequotes showing up in your command when the variable is selected. The chr(34) is equal to quotes.
 
Same error (Code: 800A01B6).

Set WshNetwork = WScript.CreateObject("WScript.Network")

PrinterPath = "\\servername\printername"

WshNetwork.RemoveWindowsPrinterConnection (chr(34) & PrinterPath & chr(34))
 
If I knew what that meant, I could tell you what happens. Please be more specific. TY

Just for grins, there isn't any patch or update I need installed to make these scripts work, right?
 
No patch, but you should be running WSH 5.6.

Try using this script and tell me what the result is.

On Error Resume Next
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.RemoveWindowsPrinterConnection "\\servername\printername"


 
Well WSH 5.6 was part of the problem then. I didn't have it! Anyway, did you see my last post? All is well now. Thanks for your help bro!

;) Take care!
 
Glad you got it working. Looks like we were both posting at about the same time as I had not seen your last one till after mine went up.

Regards,

Mark
 
Should have just use the printer migration wizard from the resource kit. "Printmig.exe"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top