in reply to Change IP-address and computer name on Win32
You did not specify what's your OS. Anyway did you look whether Win32::AdminMisc or Win32::Lanman support this?
To restart the computer you might
(See perldoc Win32) or (if you insist on using that call):use Win32; Win32::InitiateSystemShutdown(Win32::NodeName(), "", 0, 0, 1);
(The code's untested, but it should work.)use Win32::API; sub EWX_LOGOFF () {0} sub EWX_SHUTDOWN () {0x00000001} sub EWX_REBOOT () {0x00000002} sub EWX_FORCE () { 0x00000004} sub EWX_POWEROFF () {0x00000008} sub EWX_FORCEIFHUNG () {0x00000010} $ExitWindows = new Win32::API ('kernel32','ExitWindowsEx', ['L','L'], +'L'); $ExitWindows->Call(EWX_REBOOT,0);
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature
|
|---|