Page 1 of 1 1
Topic Options
#121954 - 2004-06-29 12:00 PM Setsystemstate and shutdown problems...
Xmine Offline
Fresh Scripter

Registered: 2004-06-29
Posts: 10
im having an automated installation script using kix (v.4.22). What im trying to do is to run an installation without the user beeing able to interupt it. I thought of using "setsystemstate(0)" (which works exellent). What i would like to do is to run a reboot when installation is done using the shutdown command.. this seems to fail when using the shutdown command after the setsystemstate command, when initiating the shutdown command (using it with a timer) before the setstystemstate its no problem.

Any suggestions to solution ?

Regards
X-mine

Top
#121955 - 2004-06-29 01:28 PM Re: Setsystemstate and shutdown problems...
Rory Daniels Offline
Getting the hang of it

Registered: 2003-02-25
Posts: 64
Loc: Bristol, UK
THIS SHOULD DO FOR 2000 and XP machines but not NT unless you have the optional WMI package loaded.

Code:
 Function WMIRemoteReboot(Optional $Hostname)
?
? "WMIRemoteReboot: Start"
If $hostname = ""
$hostname = @WKSTA
EndIf
$WMIReboot = GetObject("winmgmts:{impersonationLevel=impersonate,(Shutdown)}!\\$Hostname\root\cimv2")
If @ERROR = 0
$OperatingSystems = $WMIReboot.ExecQuery("Select * from Win32_OperatingSystem")
For Each $OperatingSystem in $OperatingSystems
? "WMIRemoteReboot: Rebooting " + $Hostname
$OperatingSystem.Reboot()
Next
$WMIRemoteReboot = 0
Else
$WMIRemoteReboot = 1
EndIf
? "WMIRemoteReboot: Stop"
EndFunction



Rory

Top
#121956 - 2004-06-30 04:48 AM Re: Setsystemstate and shutdown problems...
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You should rather run the installation script through the Task Scheduler under an administrative account. This is explained in the FAQ Forum. And the UDF Forum already contains numerous Task Scheduler and Shutdown UDFs.
_________________________
There are two types of vessels, submarines and targets.

Top
#121957 - 2004-07-01 10:17 AM Re: Setsystemstate and shutdown problems...
Xmine Offline
Fresh Scripter

Registered: 2004-06-29
Posts: 10
OK.. thanks for the reply both of you.. Ill look into it and find the best solution for my needs...

Regards
X-mine


Edited by Xmine (2004-07-01 10:29 AM)

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.059 seconds in which 0.029 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org