Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

vbscript to compare strings and replace if condition is met

Avatar of Ponthecomputer
Ponthecomputer asked on
VB Script
9 Comments1 Solution390 ViewsLast Modified:
I'm migrating users from one print server to another. Currently their login scripts map their printers as such:
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "\\server01\HP_LJ_01"
WshNetwork.AddWindowsPrinterConnection "\\server01\HP_MFP002"

The printers are being migrated to server02 and all of the printers have the same names on server02. I'd like the new login script to
1. look to see if "server01" is anywhere in their default printer setting and if so,
2. change it to "server02".

I know that the default printer can be found in the registry under:
HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device

If I can find a way to read this reg value, see if "server01" exists and if so, change it to "server02" then I can map the new printers and make sure the user keeps the same default printer.

Avatar of Serge Fournier
Serge FournierFlag of Canada imageAnalyst Programmer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 9 Comments.
See Answers