#76318 - 2003-08-17 08:10 PM
Re: Wake-on-LAN combined with SUS, using KiXtart scripts
|
Eduard
Fresh Scripter
Registered: 2003-08-09
Posts: 16
Loc: Amsterdam
|
OK, I think I have a working version using WRITEPROFILESTRING and READPROFILESTRING. Thanks again Radimus, for pointing me to this.
See the two new versions of the scripts below: sustatus.kix code:
;2003-08-17, sustatus.kix version 2.0, created by Ed van Balen. ;This script checks for the status of SUS AutoUpdate on shutdown, ;writes the AU-status to a cumulative log file, ;and sets the WOL-trigger in an initialization file if the AU-status = ”5” (Install pending).
$AUState = READVALUE('HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update','AUState') OPEN(1,'\\server-name\WOL$\sustat.log',5) WRITELINE(1,@DATE+','+@TIME+','+$AUState+','+@WKSTA+@CRLF) CLOSE(1) IF $AUState <> 5 $AUState = '' ENDIF WRITEPROFILESTRING('\\server-name\WOL$\suswol.ini','SUSWOL',JOIN(SPLIT(@IPADDRESS0,' '),'')+@ADDRESS,$AUState)
wol.kix code:
;2003-08-17, wol.kix version 2.0, created by Ed van Balen. ;This script reads the WOL-trigger ini file, starts the applicable PC's, ;and writes this action to a cumulative log file.
OPEN(1,'\\server-name\WOL$\suswol.log',5) FOR EACH $PC IN SPLIT(READPROFILESTRING('\\server-name\WOL$\suswol.ini','SUSWOL',''),CHR(10)) $IP = LEFT($PC,LEN($PC)-12) $MAC = RIGHT($PC,12) IF $MAC > 0 RUN 'poweroff.exe wol -ip $IP -subnet 255.255.255.0 -mac $MAC' WRITELINE(1,@DATE+','+@TIME+','+$MAC+','+$IP+@CRLF) SLEEP 1 ENDIF NEXT
More background info can temporarily be found here: SUSWOL version 2 .
I had to fiddle a little with the WRITEPROFILESTRING parameters to get it working. The IF / ENDIF sequence in the wol.kix script appeared to be necessary because the last output from SPLIT(READPROFILESTRING) is always an empty line, and PowerOff cannot handle that.
Ed
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 778 anonymous users online.
|
|
|