none
GPO Script not working in windows XP but works in windows 7

    Question

  • Hi,

    I have a simple GPO startup script linked to OU to install inventory agent. In windows 7, inventory agent installed fine, however in windows XP the exe file got copied to c:\windows\temp folder but installation did not happen. Below is the script using for GPO startup script.

    _____________________________________________

    Dim objFSO, strSourceFile, strTargetFile, booOverWrite, strResult

    Set objShell = CreateObject("WScript.Shell")
        strCommand =  "sc query INVClient"   
        Set objExecObject = objShell.Exec(strCommand)  
        strText = objExecObject.StdOut.ReadAll()
       
        'WScript.Echo strText
       
        If Instr(strText, "RUNNING") > 0 Then   
        'WScript.Echo "Agent is Running"
      
        ElseIf Instr(strText, "STOPPED") > 0 Then
        'WScript.Echo "Agent is Stopped"

        objShell.run "sc start INVClient"

      
        Else
        'WScript.Echo "Installing Agent..."
        strSourceFile = "\\domain\netlogon\INVClient.exe"
        strTargetFile = "c:\windows\temp\"
        Set objFSO = CreateObject("Scripting.FileSystemObject")
          booOverWrite = vbTrue
          objFSO.CopyFile strSourceFile, strTargetFile, booOverWrite
       'WScript.Echo "Installing Agent..."
        objShell.run "c:\windows\temp\INVClient.exe"
       
        End If

    _______________________________________________________________________

    any reason why this script does not installing agent in windows XP ? Script copied "INVClient.exe" to c:\windows\temp folder but the installation did not happen. However this works fine in windows 7 ( INVClient.exe copied to c:\windows\temp folder and installed agent as well ).

    -Subramani


    Subramani

    Tuesday, June 26, 2012 9:30 AM

Answers

  • Hi,

    I don't know what "invclient" is, but generally software installation on computers is best managed by a GPO-managed MSI installer (or alternatively, some applications provide a "push install" method). I don't have any suggestions on why your script doesn't work the way you expect.

    Bill

    Tuesday, June 26, 2012 3:13 PM
    Moderator

All replies

  • Hi,

    It's not recommended to install software using logon scripts as software installations typically require elevated permissions, but logon scripts run using the user's credentials. Usually software vendors recommend an alternative method - typically this is installation via GPO or via some kind of "push" method.

    Bill

    Tuesday, June 26, 2012 2:05 PM
    Moderator
  • Hi,

    The installation file is 4mb and GPO configured as computer settings > startup script. so the script executes in system administrator permission. This script works fine in windows 7 but not on windows xp. Script copied exe file to c:\windows\temp folder and windows xp but somehow the installation did not triggered.

    -Subramani


    Subramani

    Tuesday, June 26, 2012 2:59 PM
  • Hi,

    I don't know what "invclient" is, but generally software installation on computers is best managed by a GPO-managed MSI installer (or alternatively, some applications provide a "push install" method). I don't have any suggestions on why your script doesn't work the way you expect.

    Bill

    Tuesday, June 26, 2012 3:13 PM
    Moderator
  • I don't have a solution, but do have some troubleshooting questions that might help pinpoint the problem:

    1. Have you tried a manual install on an XP machine, copying the file from the share and then trying to install it from the command line?  Did that work?  If not check question 2.
    2. Is the executable a 32 bit or 64 bit application?  If it is 64 bit, are your XP clients also 64 bit editions?
    3. Have you tried running the script on an XP machine manually at the command prompt to see how it behaves?

    As it is, I don't see enough information to permit a person to make a clear diagnoses.


    Tom Lavedas

    Tuesday, June 26, 2012 3:19 PM
    Moderator
  • Hi,

    I manually executed GPO script on same XP machines and script works fine. script able to copy file to temp folder and started installing. This executable supports both 32 and 64 bit compatible. wondering why it is not triggered installation after copied via GPO !!!!!

    Subramani


    Subramani

    Tuesday, June 26, 2012 3:38 PM
  • Hi,

    That's what we are saying - we can't see your screen or your event logs, etc. so there is not a way for us to know the answer to your question.

    Bill

    Tuesday, June 26, 2012 3:43 PM
    Moderator
  • Try this batch

    sc query INVClient

    for /f "tokens=4 delims= " %i in ('sc query INVClient ^| findstr /i "state"') do;  set agent=%i&&call :subr0

    :subr0

    if %agent% == "RUNNING" (

    echo "Agent is Running"&&goto :EOF

    ) if

    %agent% == "STOPPED" (

    echo "Agent stopped"&& sc start INVClient&&goto :install

    )

    :install

    echo "Installing Agent"

    copy \\domain\netlogon\INVClient.exe c:\windows\temp /y

    start /w c:\windows\temp\INVClient.exe

    if errorlevel 1 (

    echo Failed installing agent

    ) ELSE (

    echo Installation OK

    )

    exit 0

    :EOF

    echo The Agent is UP and running, installation aborted

    exit 0


    If you find this post helpful, spend a second to vote up. Smoking~~




    • Edited by SuperUzer Wednesday, June 27, 2012 2:37 PM
    Wednesday, June 27, 2012 2:24 PM
  • Hi,

    I wouldn't recommend that approach. If the service is already running, why run the installer again?

    In any case, I would recommend rolling out the package using the vendor's recommended method.

    Bill

    Wednesday, June 27, 2012 2:33 PM
    Moderator
  • correct.

    edited the code


    If you find this post helpful, spend a second to vote up. Smoking~~

    Wednesday, June 27, 2012 2:38 PM
  • Unfortuanaely if this is an MSI package wrpped in an EXE the star/w will not work.  The installer always runs asynch to teh bootstrap.  You need to monitor the log file to knwo what is happening.

    In this case the OP needs to review the installer logs and eventlogs.

    There should be little diffrence between XP and Win7 on a startup script but the timing can be different.

    Other questions to add to Tom's:

    1. What is in the log files?

    2.  Are all systems in the same OU - if not are the policies different?  Asynch versus synch GP settings can cause this kind of failure.

    Run RSOP on the two machines (7 v XP) and check the differences.


    ¯\_(ツ)_/¯

    Wednesday, June 27, 2012 3:31 PM
  • As there has been no activity in this thread for a few days, we assume the issue is resolved. We will mark it as "answered" to assist others in similar situations. If you disagree, please reply with further information. You can unmark the answer if you wish. If a reply helped answer your question, please mark it as the answer.


    Richard Mueller - MVP Directory Services

    Saturday, July 14, 2012 10:28 PM
    Moderator