LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Remote shutdown

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. 

0 Kudos
Message 1 of 8
(3,747 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 8
(3,742 Views)

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);
 }

 

 

0 Kudos
Message 3 of 8
(3,717 Views)

Hi Jimmy, did you manage to do that?

 

Thank you.

 

 

0 Kudos
Message 4 of 8
(3,674 Views)

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.

0 Kudos
Message 5 of 8
(3,668 Views)

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

0 Kudos
Message 6 of 8
(3,662 Views)

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);     



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 8
(3,657 Views)

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."

0 Kudos
Message 8 of 8
(3,629 Views)