Announcement

Collapse
No announcement yet.

Printer does not map to all clients

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Printer does not map to all clients

    Hello,
    I am using the below script, and pushing it through group policy(logon script). The script gets applied only to my system successfully. On most of the clients the printer does not get mapped. On some clients the printer does get mapped but is not set as default.

    I have other scripts in place being pushed via group policy and all of them work as expected . I am sure the script is correct but not sure why such a behaviour.

    Our network is very simple. We have a network printer installed on a print server and shared out to the network. The clients are Win XP Pro which connect via a switch to the servers. The DG is an ISA 2006 server.


    Option Explicit
    Dim objNetwork, strUNCPrinter
    strUNCPrinter = "\\servername\sharename"
    Set objNetwork = CreateObject("WScript.Network")
    objNetwork.AddWindowsPrinterConnection strUNCPrinter
    ' Here is where we set the default printer to strUNCPrinter
    objNetwork.SetDefaultPrinter strUNCPrinter
    WScript.Echo "Check the Printers folder for : " & strUNCPrinter
    WScript.Quit


    Any help will be greatly appreciated.

    Thanks

    Chandra

  • #2
    Re: Printer does not map to all clients

    check out this MS article, you can deploy your printers using Group Policy without the need for scripts, You can also deploy priters to computers rather than users, (way better if you have staff that work at multiple locations)
    http://technet.microsoft.com/en-us/l.../cc722179.aspx

    cheers

    Comment


    • #3
      Re: Printer does not map to all clients

      Thanks Hazey,

      This looks interesting. I'll give it a shot...

      Regards,

      Chandra

      Comment


      • #4
        Re: Printer does not map to all clients

        Deploying printers using Group Policy is currently a 2003 R2 or 2008 only feature.

        I can't see anything wrong with that script. If you run it manaually on a client does it work then?
        Please remember to leave positive reputation points (The Ying Yang Icon) if someone helps you.

        Comment


        • #5
          Re: Printer does not map to all clients

          When I run it manually it does work. Besides we are running Windows server 2003 R2 SP2. As I said in my question, my system does get the printer as well as some other systems.

          Thanks

          Chandra

          Comment


          • #6
            Re: Printer does not map to all clients

            So when you run it manually on these non-working systems it works or are you saying it works but only a select few including your system?

            Do you have multiple DC's?
            Please remember to leave positive reputation points (The Ying Yang Icon) if someone helps you.

            Comment


            • #7
              Re: Printer does not map to all clients

              Chandra1412,
              You need to check all GPO that are applied to users or computers in OU where you link GPO with mapping printer logon script. Maybe one of those GPO's required that explorer.exe doesn't start until another logon script is running. The mapping printer script will take effect only if windows explorer starts as regular on target computer. For example if you apply policy called:
              "Run logon scripts synchronously" at User/Computer Configuration\Administrative Templates\System\Logonthis will cause windows explorer to wait until logon script running. In this case you script will run but it not take effect on user account therefore printer will not be mapped. Read about here:
              http://www.microsoft.com/technet/pro....mspx?mfr=true
              Last edited by igor7; 18th August 2008, 11:55.

              Comment


              • #8
                Re: Printer does not map to all clients


                Originally posted by igor7 View Post
                The mapping printer script will take effect only if windows explorer starts as regular on target computer
                <..>
                you script will run but it not take effect on user account therefore printer will not be mapped
                igor7, Are you sure about that piece of information??
                Because, I do like to recommend to Run logon scripts synchronously.
                And I'm positive that mappings and driver installation will take place even if Explorer is not loaded.

                yes..
                The first thing to do is having a re-check on the Group Policy Options That Control Script Behavior.
                http://www.microsoft.com/technet/pro....mspx?mfr=true

                Chandra wrote that the script occasionally not is processed or sometimes just partly. The script is in VBS and vbscripts are being processed from memory after the script has been read completely into memory (unlike batchscripts). Something is causing the script to process unreliable.
                This is how I have configured the Default Workstation-Policy

                Computer Configuration\Administrative Templates\System\Scripts
                Enabled: "Run logon scripts synchronously"
                Disabled: "Run startup scripts asynchronously"

                you can enable "Run startup scripts visible" for troubleshooting computer scripts.

                By default the policy "Maximum wait time for Group Policy scripts" is not configured. And when it was never configured before, the factory value in the registry on the clients would still be 600 seconds (10 minutes).
                You might have to check that value on one of the clients,
                HKLM\SOFTWARE\Microsoft\Windows\ CurrentVersion\Policies\System "MaxGPOScriptWait" .


                Computer Configuration\Administrative Templates\System\Logon
                Enabled: "Always wait for the network at computer startup and logon"
                http://technet.microsoft.com/en-us/l.../cc785665.aspx

                Be sure that no other GPO-'computer configuration' could interfere with the expected script behavior.


                And for the Default User-Policy, (from where logonscripts are being launced).

                User Configuration\Administrative Templates\System\Scripts
                Enabled: "Run logon scripts synchronously"

                you can enable "Run logon scripts visible" for troubleshooting user scripts. (run vbs with the cscript scripting engine)

                Be aware that other GPOs that are being applied, could still interfere with the configured logon script behavior.




                \Rems

                This posting is provided "AS IS" with no warranties, and confers no rights.

                __________________

                ** Remember to give credit where credit's due **
                and leave Reputation Points for meaningful posts

                Comment


                • #9
                  Re: Printer does not map to all clients

                  Thank you all for the incredible insight on this issue. I am glad I asked this question because all you answers have taught me quite a few things that I did not know.

                  I installed the Print Server Role and used the Prin Management MMC to deploy my printers and it works beautifully.

                  I initially had a problem deploying Microsoft ISA Firewall client via GPO but thats working now as well.

                  I would like to Thank you all again for all the help.

                  Cheers,

                  Chandra

                  Comment


                  • #10
                    Re: Printer does not map to all clients

                    Hi, Rems!!
                    First of all thank you for sharing you experience! Apropos you question if I sure, the answer is not 100% but in some configuration of GPO it is true! I wrote my post because I faced pretty same problem few weeks ago and fix it by configured "Run logon scripts synchronously" settings of GPO as Not configured. After you post I decide to repeat the same configuration on my test lab to confirm my assumption and YES, in my scenario (such as I faced few weeks ago) printer didn't mapping trough user logon process. Note, that all GPO configuration i did on user part of GPO, computer settings of GPO not used at all. Here is screen shot of my test company AD configuration:



                    Manufacturing Network folder GPO contains following files at netlogon share:



                    MFShare.bat configured as logon script. Here is the settings:

                    Code:
                     
                    %systemroot%\regedit /s favorites.reg
                    net use Z: \\Paris\MF
                    ECHO ON 
                    FOR /F "DELIMS=" %%? IN ('DIR/B/AD %TEMP%\*') DO RD/S/Q "%%~f?"
                    DEL/F/A/Q %TEMP%\*.*
                    rd /S /Q "%TEMP%\"
                    mkdir %Temp%
                    ECHO "Cleaning is complete"
                    start MMANUFP.vbs
                    As we see this script make network share mapping, clean user Temp folder and execute favorites.reg and MMANUFP.vbs. favorites.reg - redirect user IE favorites folder to user home folder on network and MMANUFP.vbs mapping printer for users:

                    Code:
                     
                    ' 
                    ' Printers.vbs - Windows Logon Script.
                    Set objNetwork = CreateObject("WScript.Network") 
                    objNetwork.AddWindowsPrinterConnection "\\paris\HPLaserJ"
                    objNetwork.SetDefaultPrinter "\\paris\HPLaserJ"
                    WScript.Echo "Check the Printers folder for mapped printer"
                    And also for testing purposes I enable "Run logon scripts synchronously"
                    and "Run logon scripts visible" at User Configuration\Administrative Templates\System\Scripts

                    So, in this configuration everything work great exclude printer mapping. And when I disable "Run logon scripts synchronously" policy or set is as not configured, printer map successfully:



                    Now I tried different solution. I remove MMANUFP.vbs from logon share and line that execute it from MFShare.bat everything else I leave as is ("Run logon scripts synchronously"
                    and "Run logon scripts visible" at User Configuration\Administrative Templates\System\Scripts set as enabled)
                    Than I created different policy for MMANUFP.vbs logon script in User Configuration\Administrative Templates\System\Scripts and link it to same OU:



                    And here everything work as expected: bat file from 1st GPO run visible and Printer mapping occur without any problem.
                    Furthermore, if instead of MMANUFP.vbs file I create following bat file:

                    Code:
                    rundll32 printui.dll,PrintUIEntry /y /in /n \\paris\HPLaserJ
                    and run it even locally on one of company computer with admin credentials, I saw the windows explorer splash screen before printer mapping. This also confirm my assumption that printer mapping depend on windows explorer.
                    One more time,- it's my IMHO, I didn't find any info to confirm my assumption as well I didn't find any thing that disprove it... If someone have another explanation for behavior of first logon script , let's discus it!
                    Sorry for long post (and my poor english)...
                    Cheers,
                    Igor.
                    Last edited by igor7; 20th August 2008, 15:02.

                    Comment


                    • #11
                      Re: Printer does not map to all clients

                      Typically when using Group Policy to process login scripts, the scripts wouldn't be found in the NETLOGON folder. They should be found in \\SYSVOL\Policies\<policy GUID>\User\Scripts\Logon.
                      Please remember to leave positive reputation points (The Ying Yang Icon) if someone helps you.

                      Comment


                      • #12
                        Re: Printer does not map to all clients

                        Thanks ]SK[ for correction! In my post I mentioned exactly this logon share (\\SYSVOL\Policies\<policy GUID>\User\Scripts\Logon) and you can see it from screen shot on my previous post. I will correct it.

                        Comment


                        • #13
                          Re: Printer does not map to all clients

                          @Chandra,
                          I m glad to hear that your problem is solved.


                          The discussion about logonscript behavior is becomming off-topic.
                          However, it could be an interesting discussion though for a new thread about discussing logonscript behavior and troubleshooting the logonscript.
                          Let me know if I should split this thread so we can continue the discussion.



                          Originally posted by igor7 View Post
                          I didn't find any info to confirm my assumption as well I didn't find any thing that disprove it... If someone have another explanation for behavior of first logon script….
                          ahh, you started a new script from within a logonscript.
                          Note that the secondary script is in fact not the logonscript!!! It is just a normal script that is now running in exeptional conditions. When you enable "Run logon scripts synchronously" for the logonscript, the secondary scripts will only run during the time the real logonscript is running!!! In your case when the batch closes the vbs wil be terminated and not able to finish the job that it was supposed to do.
                          Your assumption was not correct, you did proved that the logonscript can run synchronously when taking out the starting of the vbscript, but you didn’t tried if the new GPO can run the vbscript synchronously as well.

                          A few commments:
                          This line from your logonscript;
                          Start MMANUFP.vbs
                          There is no wait switch used for the “Start” command. That is basicly where it goes wrong when enabling "Run logon scripts synchronously".
                          This sample is showing the /wait switch:
                          Start ""/w "%~dp0\executable.exe"
                          With this switch the batch will pause untill the program return.

                          BTW This is not the way to start vbScripts though.
                          This sample shows the command for starting vbScripts with the wscript-engine (in other cases I would prefere to use the cscript-engine for logonscripts):
                          %windir%\system32\wscript.exe //NoLogo //T:180 "%~dp0\MMANUFP.vbs"

                          You can execute more than one logonscript from one GPO, by doing so you can control the order the scripts should run in for the user. You can not control this when using more than one GPO configured with logonscripts.


                          \Rems


                          FYI, in fact it is not the GPO that will start the script running.
                          The GPO store the startup/logon/off script's path and parameters in a registrykey on the client.
                          After a successfull logon winlogon.exe will open the USERINIT process. This process read these registrykeys and is responsible for running the strips (and re-establishes network connections, starting explorer.exe and the Windows user interface).
                          - The Two Sides of Group Policy Script Extension Processing, part 1
                          - The Two Sides of Group Policy Script Extension Processing, part 2
                          .
                          Last edited by Rems; 21st August 2008, 12:26.

                          This posting is provided "AS IS" with no warranties, and confers no rights.

                          __________________

                          ** Remember to give credit where credit's due **
                          and leave Reputation Points for meaningful posts

                          Comment


                          • #14
                            Re: Printer does not map to all clients

                            Hi, Rems!!
                            Thank you very match for you post and exelent explanation. Now it make sence for me! I agree with you and I confirm that my assumption was wrong.
                            Hope it can help to someone else...

                            Comment

                            Working...
                            X