09-20-2012 03:10 AM
Hello everybody,
i would like to know if there is any function that allow me to shutdown another computer in a Lan.
THANKS for your help.
09-20-2012 04:54 AM
The easiest way I can think of is to issue a shutdown command with the proper syntax. This can be used with system () or LaunchExecutable () in CVI.
09-21-2012 04:18 AM
i tried to follow your advice.
what about this code, could it function???
sprintf(str,"net use \\%s /user:%s %s", PCname, UserName, Password);
LaunchExecutableEx(str, 0 , &handle);
if(ExecutableHasTerminated(handle)==0)
{
sprintf(str,"shutdown -s -f -t %d -m \\%s", secondswait, PCname);
LaunchExecutableEx(str, 0 , &handle);
}
09-26-2012 04:14 AM
Hi Jimmy, did you manage to do that?
Thank you.
09-26-2012 05:11 AM
yes i did.
but sometimes i have the problem with "net use" authentication:
it gives me "system error 53".
i think it gives me that error because the user doesn't have administrator privileges.
but i'm not sure, so i'm working on it...
if somebody knows the solution , please post it.
09-26-2012 05:33 AM
Yeah, maybe that's a problem of admin privileges.
To change these privileges you can open the control panel, select the administrative tools, and then the local security policy.
Here you can find the menu called user rights assignment, and you can adjust the settings for the shutdown of the system.
Hope it's useful,
have a nice day.
FBM
09-26-2012 06:10 AM - edited 09-26-2012 06:26 AM
Just out of curiosity, what's "net use" command aimed to?
I tried in my network and was able to shutdown a remote PC using only shutdown command.
EDIT It is to be noted that since the syntax of the command requires a valid UNC name in the form \\hostname, the CVI command requires 4 backslashes, as each pair translates in a single backslash
sprintf (str, "shutdown -s -f -t %d -m \\\\%s", secondswait, PCname);
09-27-2012 02:18 AM
i tried to use only shutdown command, but it gives me the following error:
"PC_name: the computer name is not valid or the remote shutdown is not supported in the destination computer."