Printer problem install with VB Script

Hi all

I hope you guys can help me with a problem I have. For a customer, we are trying to install printers via a script run when connecting. We got it working on 32-bit workstations, but I won't work on 64-bit workstations.

We know that the problem is by removing the printer before connecting. With the script we have now it works only in 32 bits, but we need a solution that works on both. Or a script that checks the architecture of the en PC runs the script for 32 or 64 bit.

The script:

Option Explicit
Dim FSO, strUserName, WSHNetwork, strUserDomain, ObjGroupDict, varenv, strVarUserName
Dim objNetwork, strComputer, objWMIService, colInstalledPrinters, objPrinter, strLocal
Dim strUNCPrinter1, strUNCPrinter2, strUNCPrinter3, strUNCPrinter4
Dim strUNCPrinter5
Sun printers
Dim counter

Set WSHNetwork = WScript.CreateObject ("WScript.Network")
Set varenv = WScript.CreateObject ("WScript.Shell")
Set FSO = CreateObject ("Scripting.FileSystemObject")
strVarUserName = EnvVar.ExpandEnvironmentStrings("%username%") "

"Wait for the user to connect

strUserName = «»
While strUserName = «»
WScript.Sleep 100
strUserName = WSHNetwork.UserName
Wend
strUserDomain = WSHNetwork.UserDomain

Set ObjGroupDict = CreateMemberOfObject (strUserDomain, strUserName)

'Create printers '.

strUNCPrinter1 = "\\s-exch\P50 - A4 Dubbel (Kleur)"
strUNCPrinter2 = "\\s-exch\P50 - A4 Dubbel (Z - W)"
strUNCPrinter3 = "\\s-exch\P50 - A4 Enkel (Kleur)"
strUNCPrinter4 = "\\s-exch\P50 - A4 I (Z - W)"
strUNCPrinter5 = "\\s-exch\P50 - TCE - Briefpapier (Z - W)" "

'Delete printers '.

Set objNetwork = CreateObject
objNetwork.RemoveWindowsPrinterConnection "\\s-exch\P50 - A4 Dubbel (Kleur)"
objNetwork.RemoveWindowsPrinterConnection "\\s-exch\P50 - A4 Dubbel (Z - W)"
objNetwork.RemoveWindowsPrinterConnection "\\s-exch\P50 - A4 Enkel (Kleur)"
objNetwork.RemoveWindowsPrinterConnection "\\s-exch\P50 - A4 I (Z - W)"
objNetwork.RemoveWindowsPrinterConnection "\\s-exch\P50 - TCE - Briefpapier (Z - W)" "

' Create printermappings based on groupmembership

If MemberOf (ObjGroupDict, "P50" ") then
Set objNetwork = CreateObject
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
End If

If MemberOf (ObjGroupDict, "P50" ") then
Set objNetwork = CreateObject
objNetwork.AddWindowsPrinterConnection strUNCPrinter2
End If

If MemberOf (ObjGroupDict, "P50" ") then
Set objNetwork = CreateObject
objNetwork.AddWindowsPrinterConnection strUNCPrinter3
End If

If MemberOf (ObjGroupDict, "P50" ") then
Set objNetwork = CreateObject
objNetwork.AddWindowsPrinterConnection strUNCPrinter4
End If

If MemberOf (ObjGroupDict, "P50" ") then
Set objNetwork = CreateObject
objNetwork.AddWindowsPrinterConnection strUNCPrinter5
End If

Function MemberOf (ObjDict, strKey)
MemberOf = CBool (ObjGroupDict.Exists (strKey))
End Function

Function CreateMemberOfObject (strDomain, strUserName)
Dim objUser, objGroup
Set CreateMemberOfObject = CreateObject ("Scripting.Dictionary")
CreateMemberOfObject.CompareMode = vbTextCompare in
Set objUser = GetObject ("WinNT: / /" & strDomain & "/" & strUserName & ", user")
For each objGroup in objUser.Groups
CreateMemberOfObject.Add objGroup.Name, «»
Next
Set objUser = Nothing
End Function

Hello Miesjel,

Welcome to the Microsoft Community Forum.

The question you posted would be better suited to the Technet community. Please visit the link below to find a community that will provide the support you want.

Microsoft TechNet
http://social.technet.Microsoft.com/forums/scriptcenter/en-us/home?category=scripting

Hope the helps of information. Let us know if you need help with Windows related issues. We will be happy to help you.

Happy new year!

Thank you

Tags: Windows

Similar Questions

  • problem installing with lightroom.  error: change of modules, number of required folder?

    problem installing with lightroom.  error: change of modules, number of required folder?

    Hi daves.

    This problem normally occurs when the files of Adobe to launch Lightroom do not have read/write permissions.

    Please follow this article changing the error modules and grant permissions to required files

    Here's a double thread Lightroom: "an error occurred when attempting to change modules."

    Let us know if this helps

    ~ Assani

  • Printing problems wireless with Windows 7 Home Premium

    Previously, I had Window Vista downloaded on my laptop and had NO problem printing wireless. Now I have Windows 7 Home Premium. I have a modem from my phone company, a wireless router and a Photosmart All printer (C4795).  The same one I had with Vista.  I just can't get anything to print UNLESS I connect a USB cable from my laptop to my printer (very frustrating). I'm not completely PC illiterate, but not very clever of them either. I uninstalled and reinstall the printer, the router and the modem and that did not help. I had the company of phone on the phone for an hour last night and they could not help and saw nothing wrong with my set up. I need an answer "simply stated and clear" what I have to do. I have a group RESIDENTIAL network set up on my computer, but have not set upt the other computers at home (a laptop) with the network home for the moment. I wanted to get a computer is working correctly before moving forward. The internet connection to the HOMEGROUP network seems to be well. All devices are listed and look good, but I can not just wireless printer that's why I brought the first wireless printer.

    Help?

    Headed home, this is my desktop PC. Hoping answers tomorrow or to my email. * E-mail address is removed from the privacy *

    Hello

    1. what happens when you try to print?

    The printer is compatible with windows 7 as per this link: http://www.microsoft.com/windows/compatibility/windows-7/en-us/Details.aspx?type=Hardware&p=HP%20Photosmart%20C4795%20All-in-One%20Printer&v=HP&uid=Q8382A&l=en-US&pf=0&pi=0&s=Photosmart%20All%20in%20ONE%20Printer%20C4795&os=32-bit

    I suggest you follow the steps in this article.

    Find and install the printer in Windows 7 drivers: http://windows.microsoft.com/is-IS/windows7/Find-and-install-printer-drivers

    Install a printer: http://windows.microsoft.com/en-us/windows7/Install-a-printer

    Refer.

    Update a hardware driver that is not working properly: http://windows.microsoft.com/is-IS/windows7/Update-a-driver-for-hardware-that-isn ' t-work properly

    Printer in Windows problems
    http://Windows.Microsoft.com/en-us/Windows/help/printer-problems-in-Windows

    For more information:

    The product does not work properly after reinstalling on a network and upgrading Windows Vista to Windows 7

    http://h10025.www1.HP.com/ewfrf/wc/document?DocName=c01918192&tmp_task=solveCategory&cc=us&DLC=en&lang=en&LC=en&product=3940574

    Wireless printing Center

    http://www.HP.com/global/us/en/wireless/troubleshooting.html

    I hope this helps.

  • the problems associated with writing script

    Hi all

    I use DIAdem 10.2

    (1) I write the Script for the declaration of my scada system. In my report model, there are some common text as user field, period reoprt, designation, report, etc. etc... I designed the dialog box to ask these details in starting, and now I wanted to transfer these details on each page of the report. Is it possible to connect these details with the report model?

    (2) I am facing problem in the allocation of train paths within the script... Is it possible to get rid of problems that arise due to movement of files from file *.sud or *.tdr. It will be great if diadem automatiocally search inside the folder in which the script is saved... so whenever we are going to move the complete file of any statement. It won't create any problem condition save us all files in a folder.

    (3) I crushed my script different system or sometimes need to distribute it. Is it possible to make my script running on another system where tiara is not installed... sort of it, even making available using any platform of programming such as LabVIEW, Measurement studio, CVI etc. etc.

    Thank you very much!

    HS

    HS Hello!

    (1) you can use global variables to solve this task. There are some predefined as "T1" or - I prefer - assign them in the Script with the command GlobalDim and fill them in your data. In the report, you can use the expression '@T1 @' or ' @@MyGlobalDimVar @ ' in the text fields to display the content.

    (2) you can use the AutoActPath variable to all access to the files compared to the running script. If you put all your files next to the script, you can move the package wherever you want in the file system. In all commands of loading like PicFileLoad you must use AutoActPath.

    (3) you can run Scripts DIAdem and dialogs only in DIAdem.

    Matthias

  • 4500 HP Envy Photo printing problem - out with a look of sepia tone

    Hello

    I recently installed a HP Envy 4500 printer and have problems printing of photos on my iPhone 5 (ios 7.1.2).

    When I print from my camera pictures come out in a sepia tone color scheme.

    I tried with 2 different pictures and the results were the same.

    I printed from my PC and the color was on the spot.

    A way to solve this problem?

    Thank you

    Hello Talkoon,

    Welcome to the Forums of HP Support!

    I understand that photos of the iPhone printing are not the same color scheme when the photo is printed from the computer.

    Try printing the HP ePrint App photo and let me know what is the result.

    Kind regards

  • problem installing with C4480 and Time Capsule

    I'm putting in place a new Photosmart C4480 to use with my computer laptop MacBook and my Office PowerPC G4 tower. When I connect the printer directly to the G4 using the USB cable, it works fine. But when I connect to the USB port of my time Capusule the C4480 (which is connected to the G4 by ethernet cable) G4 can't find the printer. However, I can print wireless from the MacBook. This configuration has worked with my previous Epson printer. Is there anything else I need to do? Thanks for any help/suggestions.

    I just answered my own question - I didn't notice the "Hello Printers" in the "printer" drop-down menu. Selecting the C4480 in this option solves the problem. Thanks anyway.

  • Problem installing with fsx deluxe edition

    I had a previous installation of Flight Sim X, but uninstalled it centuries ago. Yesterday I got a new copy and this morning attempted installation. After you insert the disc 2, a pop-up asked me to "insert disk". Which drive? Not sure if this meant disc 1, but it didn't work anyway, so I re-inserted disc 2 and got the same pop-up again and cannot go any further. Someone knows what to do?

    I use Win XP Professional 2002.

    Nick

    Hi Nick,

    ·         What is the full error message?

    Follow these methods.

    Method 1: Put the computer in a clean boot State to see if there is a software conflict as the clean boot helps eliminate software conflicts.

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state from the link to start the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click restart to restart the computer.

    Method 2: Follow the steps in the article.

    Error message when you install a Microsoft game or a mapping program

    Microsoft games: InstallShield Error Messages

    For reference:

    Solve problems with activation for Microsoft games problems and mapping programs

    Frequently asked questions on how to enable Microsoft Games for Windows, streets and trips and Mappoint

  • Problem installing with WPS54G on new computer w/Windows 7

    When settiing upward the PS on a new computer with Windows 7, I get 2 error messages.  The first is: "address is not valid - enter a valid address - try again."  The other rises after that: "Put in failure-error Code 87 printer."

    The PS is set up on another computer in my home and works very well.  The printer is set up on the new computer.  Is this a compatibility issue with Windows 7?

    Can I fix?

    As the Printserver is already installed, you don't need to run the CD for the Printserver again on the new computer. You just need to open ports on computer Windows7... Check out this link.

  • Problems installing with Zoo Tycoon 2 Marine Mania.

    I have Zoo tycoon 2 is installed on my computer, but when I try to install marine mania, I takes me to the screen to uninstall Zoo tycoon 2. He is stuck in a loop. It uninstalls everything and will not re install! How can I solve this problem?

    Hello

    I suggest that you follow the steps mentioned below and check if the problem persists.

    Step 1:

    Uninstall and reinstall Microsoft Zoo Tycoon 2 Marine Mania and check if the problem persists.

    Step 2:

    Perform a clean start to verify if a third person or service is interfering with the installation process. We can isolate the program using the clean boot.

    Note: Follow step 7 to your computer as usual.

    Additional information:

    Error message when you install Microsoft Games:

    http://support.Microsoft.com/kb/258496

    http://zootycoon.com/support/TechSupport.htm

  • I have problems installing with kaspersky internet security, 2015 on windows 7

    Original title:

    internet security Kaspersky 2015

    iI problems of installation with kaspersky internet security, 2015 on windows 7 will not install it comes up with a message to reinstall net framework from microsoft which I did & the question was not resolved.i however installed on my other pc that runs vista without issues.has - what someone has encountered this and if so is there a resolution? Thank you

    Make sure that you install the .NET Framework 4.5 for Windows 7, not 4.0.

    Also try to stay connected to the Internet during installation:

    http://support.Kaspersky.com/11045#Block1

    You can also do a clean boot.

  • problem installing with elements 9 on mac

    I have elements 9 on a old computer but recently bought a new. I wanted to download items 9 on my new computer. I found the serial number on my account and downloaded the software, but it does not install. Normally on a mac you just drag it on the hard drive to install. There is no option. I was chatting to support when I downloaded it and when she does not he said to go to forums... Can someone help me with this problem? My mac OS is El Capitan.

    Thank you

    Glenda

    Former software installation on the new machines is generally a problem... sometimes without one solution other than relying on the original material.

    Download and Installation Help-

    https://helpx.Adobe.com/download-install.html

    PSE 7, 8, 9 - http://helpx.adobe.com/photoshop-elements/kb/photoshop-elements-7-8-9-downloads.html

    PE 9 - http://helpx.adobe.com/premiere-elements/kb/premiere-elements-9-downloads.html

  • Problem installing with Muse

    I have a problem with the Muse: "Adobe Application Manager" shown as installed and updated, but it really is not inside the computer. I had a trial version that I uninstalled the appropriate application of Adobe. I forgot to mention that I'm subscribed regularly to creative cloud, of course! What can I do?

    Mac OsX 10.8.3.

    If the Muse is that already installed on yor computer just start and then click on license this software button enter your Adobe ID to activate Muse.

    If you are unable to launch Muse and you have vandalized it then go to Application/Utilities/Adobe Installers and check if you get uninstall of Muse here. Double-click Muse Uninstaller to uninstall completely from Muse.

    If you are not able to find Muse download uninstaller then Adobe CS cleaner of: http://www.adobe.com/support/contact/cscleanertool.html and uninstall completely from Muse.

    After uninstalling, you can install Muse with the help of Adobe Application Manager.

  • Problems installing with the new kernel 2.6.27 - 9

    Hello

    I think I'm doing ok with my installation.  My problem is that I don't know how to go beyond this problem:

    None of the vmmon modules pre-built for VMware Server is suitable for your

    kernel running.  Do you want this program to try to build the vmmon module for

    your system (you must have a C compiler installed on your system)?

    If I answer Yes, I get the following:

    Using compiler "/ usr/bin/gcc". Environment variable CC to override.

    What is the location of the directory of C header files that match your running

    kernel? / usr/src/linux/include

    The path "/ usr/src/linux/include" is not an existing directory.

    What would be the best way to solve this problem?  I really want to do this race.

    Ok

    This is not a forum for Linux, is a Vmware forum...

    When you ask for something in a forum, it is good to have a GOOD ATTITUDE...

    In any case...

    I'll do it so easy

    To see if you have installed linux-headers, all you need is to execute this comand:

    dpkg-l | grep linux - headers-'uname - r '.

    To install the linux-headers necessary according to your kernel running:

    apt - get install linux - headers-'uname - r '.

    And that's all.

    Concerning

    If you found this information useful, please consider awarding points to 'Correct' or 'Useful' answers and answers. Thank you!!

  • Problems installing with NO-Sync 3.0 and LabVIEW 8.6

    I try to use NO-Sync 3.0 with the PXI-6682 timing and GPS support. However the screws NOR-Sync that worked under LV8.5.1 are broken by LV8.6 and NOR-Sync is no longer present in the menu diagram functions measure IO. have functions OR-Sync was displaced, obsolete or simply not supported yet in 8.6? Or is the installation procedure of NOR-Sync different with 8.6 compared to 8.5.1?

    Hello Magma,

    I just wanted to confirm in this thread that NEITHER-Sync 3.0 does not natively install support for LabVIEW 8.6, but your workaround displayed is valid to activate the support until the next version of releases OR Sync.  A knowledge base entry is created to explain this and should be online in the near future.

    Kind regards

    Mike: Torba

    National Instruments

  • Problems installing with Sidewinder X 5 (help, help, help).

    First of all, let me say that I think that the mouse is a piece of ____. It crashes and or freezes on any setting above 1600DPI. The lightness of the body flew everywhere in the mouse pad. The buttons are not placed comfortably. I also lost all my mouse functions in Photoshop. I put my new mouse for sale on Ebay this week.

    The problem is that when I installed Intellipoint drivers it completely removed my Logitech Mouseman drivers and disabled somehow my serial port.

    When I uninstalled Intellipont and re-installed the Mouseman I found that I could not use my Logitech mouse to my serial port (I have had no issues before installing the software Intellipoint 6 of Microsoft).

    There is a supplementary program (MS or third party) that completely removes the Intellipoint software?

    I'm an MCP and know how to use the registry. If there is one there, who knows what registry cahnges I need to do to fix this please let me know.

    Hi loufah jones,.

    Microsoft had an uninstall program called "Windows Installer Cleanup utility", but it seems that they removed the utility.

    I will suggest you to download a free software utility that has helped many people to eliminate the traces of their registry entries and uninstalling software.

    You can download the software from the link given:
    http://www.revouninstaller.com/

    BTW, when are you going to put the mouse on sale on Ebay? :)

    Concerning
    The Terminator

Maybe you are looking for