[wpkg-users] WPKG on Windows 7

Denis Witt denis.witt at concepts-and-training.de
Wed Sep 12 12:03:28 CEST 2012


On Wed, 12 Sep 2012 11:13:53 +0200
Luca Manganelli <luca_manganelli at comune.trento.it> wrote:

> Interesting. Can you show us your script?

Hi Luca,

it's a bit complex but here's a summary:

logon.bat:

-----------------------------------------------------------------------

@echo off
cls
\\192.168.1.21\netlogon\scripts\deploy.exe
exit

-----------------------------------------------------------------------


deploy.exe (Auto IT):

-----------------------------------------------------------------------

See https://cantbuyit.com/pastebin/view/0ec0161b (will be available the
next 4 weeks)

-----------------------------------------------------------------------

Line 4-6:

$domain = "DOMAIN"
$user = "ADMINISTRATOR"
$pw = "PASSWORD"

has to be set to corresponding values for you Administrator Account. I
use the AutoIT-Crypt function to scramble the password. This is not
really necessary as the script will be compiled. If you don't want to
scramble the password just remove the line 34 ("$pw = _StringEncrypt(0,
$pw, "0")") and put $pw in clear text.

Line 14-17:

The script checks if it could access the logon.bat. If not it will
exit. This should also not be necessary as the script will not be
launched if to logon share isn't available.

Line 19-29:

After this check a Messagebox appears an the user has 60 Seconds to
cancel the installation process (if he's in a meeting for example). If
he click OK or just wait 60 Seconds the installation process will start.

Line 31 (and 73-85):

Afterwards the free disk space is checked. If there is less than 25%
free space a warning will be shown.

Line 33-45:

The first step is to check for the Computer-Name:
If StringInStr(@ComputerName, "-PC") Then

If it ends on "-PC" some Batchfiles will be run to copy some template
files from a template share into some directories which the user
usually has no write access (if you just want to run WPKG you can omit
this part).

Line 48-50:

The next step is to run WPKG itself. The progress bar will not advance
while WPKG is running. You might want to use a fake progress bar which
will run continuously instead if you omit the other tasks in the script.

Line 52-60:

When WPKG is finished an the logged on user is your $user WSUS will be
run (see http://www.wsusoffline.net/ for details).

Line 63-69:

As last step some Tools will be executed:

progressRunWait("net TIME /SET /Y", "Systemuhr wird gesetzt.")

Set the system time.

progressRunWait("\\192.168.1.21\wpkg\WinAuditu.exe /r=sopmdM /o=csv /f=\\192.168.1.21\wpkg\audit\",
"SystemInfos werden gesammelt.")

Run WinAudit (see http://www.pxserver.com/WinAudit.htm for details) to
gather some system informations (Hardware) and write them to a log
file.

progressRunWait("\\192.168.1.21\wpkg\regread.exe", "Logfile wird
geschrieben.") 

regread is another AutoIT-Script which collect Uninstall-Informations
from the registry I use to uninstall software via WPKG.
https://cantbuyit.com/pastebin/view/3f8be865

Functions:

Line 87-121:

progressrun will launch a command using the $user and $pw credentials
without waiting for the progress to finish. When the function is done
the progress bar will be updated. If you omit steps or add some new you
might have to change the $progressstep value (10).

progressrunwait will put the script on hold until the process has been
finished.

runifexists/runifexistswait is just a convenience function for 32/64
path differences.

If there are any questions feel free to ask.

Best regards
Denis Witt



More information about the wpkg-users mailing list