Stefan, 

To answer your question on how we push out software to our users, I have 
attached three scripts. So initially, I run the UpdateScript64.bat script. I 
choose to input the IP for the computer I want to push the updates to. If the 
computer does not currently have wpkg on it, it will run the InstallWPKG_64.bat 
script, then follow up with the updatescript64.bat. If the computer already has 
wpkg client already installed, it only runs the updateworkstation.py script. 

I have gone ahead and removed/replaced things relating to my company in these 
scripts. Please take a look through if you'd like. Once again, the problem is 
that on 64 bit computers I HAVE to reinstall the wpkg client before I can 
update a user again (after that user restarts his/her machine). On 32 bit 
computers, I can just keep running the update script and there are no issues. 
What would cause 64bit computers to mess up the client after a restart? 

I had to rename the attachments to .txt to send. 

Regards, 

Kyle Conti , IT Engineer 
Boston Engineering Corporation 
300 Bear Hill Rd. | Waltham, MA 02451 | 781-314-0753 

----- Original Message -----
From: "Stefan Pendl" <stefan.pendl...@gmail.com> 
To: wpkg-users@lists.wpkg.org 
Sent: Saturday, August 11, 2012 5:28:57 AM 
Subject: Re: [wpkg-users] Problem with 64bit version of WPKG on WinXP 64 

Am 10.08.2012 18:49, schrieb Kyle Conti: 
> Stefan, 
> 
> I wasn't aware you can execute the wpkg.js and install programs without 
> having the wpkg client installed. Anyway, I'd still like WPKG client to 
> stay working without having to reinstall since our current scripts 
> install the client remotely and then update the system that way. I do 
> not have the time to rewrite our scripts. As i've said before, this 
> works perfectly fine on 32-bit systems with no reinstalls needed. Very 
> strange. Any ideas on why this would happen? 
> 

So we would need more information about how your environment is set up. 

Currently I am not sure how you are using WPKG. 

A detailed step-by-step description would be handy. 
Any scripts and settings that aren't easy to describe would be handy too. 

BTW, always use "reply to all" so you are also replying to the group not 
just to the individual. 
This makes sure that more people get involved, since it is likely that 
someone uses a similar set up and can point out the cause of your 
problems directly. 


-- 
Stefan P. 

Top-posting: 
A: Because it messes up the order in which people normally read text. 
Q: Why is top-posting such a bad thing? 
A: Top-posting. 
Q: What is the most annoying thing in e-mail? 
------------------------------------------------------------------------- 
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/ 
_______________________________________________ 
wpkg-users mailing list 
wpkg-users@lists.wpkg.org 
http://lists.wpkg.org/mailman/listinfo/wpkg-users 
#!/usr/bin/python
#######################################################################
# 
#######################################################################
#
# File:          c:\scripts\updateWorkstations.py
# Description:
#
#
# Return Values:
# 0 = Success
#
# Changelog:
# * 2009/02/25 
# - Initial file
#######################################################################

#************************************************#
# Imports
#************************************************#
import sys
import ldap
import time
import re
import win32con
import logging, logging.config
from optparse import OptionParser
import subprocess
from threading import Thread
import threading


#************************************************#
# Local Classes
#************************************************#
class UpdateSystemThread(Thread):
    import subprocess
    logger = logging.getLogger()
    def __init__ (self, computer, failurefile):
        Thread.__init__(self)
        self.computer = computer
        self.failurefile = failurefile
        self.status = -1
        
    def run(self):
        logger.debug("Running update on %s..." % (self.computer))
        retval = subprocess.call('psexec \\\\%s -u DOMAIN\USER -p password 
WPKG_Force_Update.bat' % (self.computer))
        if retval <> 0:
            logger.error("Update failed on %s. Return value of %s." % 
(self.computer, retval))
            self.failurefile.write("%s %s\n" % (self.computer, retval))
        else:
            logger.info("Updated %s. %s" % (self.computer, retval))
                                                   
#************************************************#
# Local Vars
#************************************************#
ldapServer = "SERVERNAME"
baseDN = "ldap dn info"
runTypes = ('all', 'workstations', 'laptops', 'computer', 'file')

#************************************************#
# Inputs
#************************************************#
usage = "usage: %prog -t [-c] [-v]"
version = "%prog $Revision: 1.4 $"
parser = OptionParser(usage=usage, version=version)
parser.add_option("-t", "--type", dest="runType", default="all",
    help="Type of update to run" + " ".join(runTypes), metavar="all")

parser.add_option("-c", "--computer", dest="computer", default="",
    help="computer to run on in single run type.", metavar="192.168.X.X")

parser.add_option("-f", "--file", dest="file", default="",
    help="file to read in")

parser.add_option("-v", "--verbose", dest="debug", default="NA",
    help="Turn on debug mode")

(options, args) = parser.parse_args()

#************************************************#
#Sanitize Inputs
#************************************************#
hasErrors = False

# options.runType
if options.runType not in runTypes:
    print >> sys.stderr, "Invalid type. Please use one of the following: " + " 
".join(runTypes)
    hasErrors = True
else:
    runType = options.runType

# options.computer
if options.runType == 'computer':
    if options.computer == '':
        print >> sys.stderr, "You must supply a computer in single mode."
        hasErrors = True
computer = options.computer

# options.file
if options.runType == 'file':
    if options.file == '':
        print >> sys.stderr, "You must a file."
        hasErrors = True
workstationsToUpdatePath = options.file

# options.debug
debugON = False
if options.debug <> 'NA':
   logLevel = logging.INFO
else:
   logLevel = logging.DEBUG

if hasErrors:
    print >> sys.stderr, "Your input has error run with -h or --help to see " +\
        " input options."
    sys.exit(2)

#************************************************#
#Main script start
#************************************************#
logger = logging.getLogger()
logger.setLevel(logLevel)
hdlr = logging.FileHandler('./remote-updater.log')
ch = logging.StreamHandler()
ch.setLevel(logLevel)
hdlr.setLevel(logLevel)
formatter = logging.Formatter("%(asctime)s [%(module)s] %(levelname)s: 
%(message)s")
ch.setFormatter(formatter)
hdlr.setFormatter(formatter)
logger.addHandler(ch)
logger.addHandler(hdlr)

logger.debug("DEBUG logging is active.")

computersfailedlog = 
open('\\\\PATH\\wpkg\\UpdateClient\\logs\\computersfailed-%s.txt' % 
time.time(), 'w')

if runType == "computer":
    logger.info("Attempting to updating %s..." % (computer))
    #retval = subprocess.call('psexec \\\\%s -u DOMAIN\USER -p PASSWORD ping 
localhost' % (computer))
    retval = subprocess.call('psexec \\\\%s -u DOMAIN\USER -p PASSWORD 
WPKG_Force_Update.bat' % (computer))
    print  computer + " " + str(retval)
    sys.exit(retval)
elif runType == "file":
    workstationsToUpdateFile = open(workstationsToUpdatePath)
    updateSystemThread = []
    for line in workstationsToUpdateFile:
        line = line.replace('\n','')
        current = UpdateSystemThread(line, computersfailedlog)
        updateSystemThread.append(current)
        current.start()
else:
    try:
        logger.debug("Logging into LDAP server...")    
        ldapConn = ldap.open(ldapServer)
        ldapConn.simple_bind('', '')
    except ldap.LDAPError, e:
                print e

    searchScope = ldap.SCOPE_SUBTREE
    retrieveAttributes = None

    searchFilter = "(|(uid=ws*)(uid=lt*))"
    if runType == "workstations":
        logger.debug("Setting search string to workstations only...")
        searchFilter = "uid=ws*"
    elif runType == "laptops":
        logger.debug("Setting search string to laptops only...")
        searchFilter = "uid=lt*"
    try:
        ldap_result_id = ldapConn.search(baseDN, searchScope, searchFilter, 
retrieveAttributes)
        result_set = []
        while 1:
            result_type, result_data = ldapConn.result(ldap_result_id, 0)
            if (result_data == []):
                break
            else:
                if result_type == ldap.RES_SEARCH_ENTRY:
                    result_set.append(result_data)
    except ldap.LDAPError, e:
        print e
    updateSystemThread = []
    for i in range(len(result_set)):
        for entry in result_set[i]:
            cn = entry[1]['cn'][0].replace('$', '') #+ ".dhcp.DOMAIN.com"
            current = UpdateSystemThread(cn, computersfailedlog)
            updateSystemThread.append(current)
            current.start()
            while threading.activeCount() > 10:
                logger.debug("Max concurrent threads. Waiting for active 
threads to complete...")
                time.sleep(1)
:choice
@ECHO 1.) Enter a Range of IP Addresses
@ECHO 2.) Manually Enter IP Addresses
@ECHO 3.) Load failure File 
@ECHO OFF
        set /p choice=
        if %choice% gtr 3 goto invalid
        goto number%choice%

:invalid
        ECHO Invalid Choice!
        goto choice

:number1
        set loop = loop1
        setLocal EnableDelayedExpansion
        ECHO Enter the Start 4th Octet IP Address
                set /p IPStart=
        ECHO Enter the End 4th Octet IP Address
                set /P IPEnd=
        goto loop1
        
:loop1
        set /a IPStart+=1
        if !IPStart! gtr !IPEnd! goto :eof
        ping 192.168.2.%IPStart% -w 1 -n 1
        if %ERRORLEVEL%==0 goto updatecomp
        goto loop1

:number2
        setLocal EnableDelayedExpansion
        goto loop2
        
:loop2
        ECHO Enter the 4th Octet IP Address
        set /p IPStart=  
        if %IPStart% == 0 goto :eof
        ping 192.168.2.%IPStart% -w 1 -n 1
        if %ERRORLEVEL%==0 goto updatecomp
        goto loop2
        
:number3
        ECHO UNDER CONSTRUCTION! Going to Manually Enter IP Addresses
        goto number2
        
:updatecomp
        if not exist 
\\192.168.2.%IPStart%\c$\WINDOWS\system32\WPKG_Force_Update.bat goto newcomp
        start cmd.exe /K \\Samba\netlogon\Python26\python.exe 
\\samba2\data\software\wpkg\UpdateClient\updateWorkstations.py -t computer -c 
192.168.2.%IPStart%
        goto loop%choice%

:newcomp
        ECHO Please wait to continue this script until WPKG is installed
        %windir%\system32\runas.exe /user:DOMAIN\USER 
\\PATH\WPKG\RemoteInstall\InstallFiles\InstallWPKG_64.bat
        pause
        goto updatecomp
        
:: RUN AS ROOT!
:number1
@ECHO off
set InstallRoot=\\PATH\WPKG\RemoteInstall\InstallFiles

@ECHO Enter the 4th Octet of the computer you would like to install WPKG on.
set /p HOSTCOMP=

:: Copy Installation Files to Host
copy "%InstallRoot%\WPKG Client 1.3.14_x64.msi" "\\192.168.2.%HOSTCOMP%\c$\"
copy "%InstallRoot%\settings.xml" "\\192.168.2.%HOSTCOMP%\c$\"

:: Copy JS Fix Files
copy "%InstallRoot%\jsFix.bat" "\\192.168.2.%HOSTCOMP%\c$\"
copy "%InstallRoot%\xp_js_fix.reg" "\\192.168.2.%HOSTCOMP%\c$\"

:: Install WPKG Through PSEXEC 
PSEXEC \\192.168.2.%HOSTCOMP% -i msiexec /i "C:\WPKG Client 1.3.14_x64.msi" /qn 
SETTINGSFILE=C:\settings.xml

:: Disable WPKG Service
PSEXEC \\192.168.2.%HOSTCOMP% -s sc config WpkgService start= disabled

:: Fix JavaScript association
PSEXEC \\192.168.2.%HOSTCOMP% -i C:\jsFix.bat

copy %InstallRoot%\WPKG_Force_Update.bat 
\\192.168.2.%HOSTCOMP%\c$\Windows\System32\

:: Delete Installation Files
del "\\192.168.2.%HOSTCOMP%\c$\WPKG Client 1.3.14_x64.msi"
del "\\192.168.2.%HOSTCOMP%\c$\settings.xml"
del "\\192.168.2.%HOSTCOMP%\c$\jsFix.bat"
del "\\192.168.2.%HOSTCOMP%\c$\xp_js_fix.reg"

-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
wpkg-users@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users

Reply via email to