You can use a UNC name with WMI.  So just take the VBscript here:

http://www.freevbcode.com/ShowCode.asp?ID=7693

...translate it to Perl, and Bob's your uncle.

I do not have time to do this for you (sorry), but for a simple
example on invoking WMI from Perl see
http://unattended.sourceforge.net/apps.php#setenv

 - Pat

On Feb 7, 2008 10:02 AM, Mathew Shember <[EMAIL PROTECTED]> wrote:
> Looks like it wants a name and UNC will not work.......
>
> *InitiateSystemShutdown function*
>
> Initiates a shutdown and optional restart of the specified computer.
>
> /*Syntax*/
>
> InitiateSystemShutdown($MachineName,$Message,$Timeout,$ForceAppsClosed,$RebootAfterShutdown);
>
>
> $MachineName    String that specifies the network name of the computer to
> shut down. No unc.
> $Message        String that specifies a message to display in the shutdown
> dialog box. This parameter can be NULL if no message is required.
> $Timeout        Specifies the time (in seconds) that the dialog box should be
> displayed. While this dialog box is displayed, the shutdown can be
> stopped by the AbortSystemShutdown function.If zero, the computer shuts
> down without displaying the dialog box, and the shutdown cannot be
> stopped by AbortSystemShutdown.
> $ForceAppsClosed        Specifies whether applications with unsaved changes
> are to be forcibly closed. If this parameter is TRUE, such applications
> are closed. If this parameter is FALSE, a dialog box is displayed
> prompting the user to close the applications.
> $RebootAfterShutdown    Specifies whether the computer is to restart
> immediately after shutting down. If this parameter is TRUE, the computer
> is to restart.
>
> */Example/*
>
> use Win32;
>
> Win32::InitiateSystemShutdown ('MONTY_PYTHON',300,0,0);
>
> $! = Win32::GetLastError();
>
> if ($!) then {
>         print "Can't get it down : $! \n"; }
> else {
>         print "on is way ...\n"; }
>
> */Remarks/*
>
> This function only works with NT. I just can't get this function
> shutting down a local computer. To shut down a remote computer, the
> calling process must have the REMOTE_SHUTDOWN privilege on the remote
> computer.
>
>
>
>
_______________________________________________
Perl-Win32-Admin mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to