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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Migrating network printers

Status
Not open for further replies.

OrionCookies

Programmer
May 5, 2005
43
0
0
US
I am trying to migrate printer from old server to new.
this script works fine if found no Fully qualified domain name print que.
But won't migrate if script find any FQDN.

So, if ECHO objPrinter.Name, and printer has FQDN name, it won't echo me back.


is there any way i can read FQDN name of the printer...



'****************************************************************
strComputer = "."
Set objNetwork = WScript.CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colPrinters = objWMIService.ExecQuery _
("Select * From Win32_Printer Where Local = False")

NewpthName = "\\abc.def.ghi.corp\"
On Error Resume Next
For Each objPrinter in colPrinters
wscript.echo objPrinter.name

pthLength = Len(objPrinter.Name)


midSlash = InStr(3,objPrinter.Name,"\")


serverpth = Left(objPrinter.Name,midSlash-1)


PtrName = Right(objPrinter.Name,pthLength-midSlash)


lserverpth = lcase(serverpth)

next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top