How to shutdown Pc from my commuter in Same Network RRS feed

  • Question

  • Hello I am trying to write a code for VB.net to shutdown Pc in same network. I am trying the following code but its not working . Its showing the Error code = 5

            Dim proc = Process.Start("shutdown", "/s /m \\NSU")
            If proc.ExitCode <> 0 Then
                MsgBox("Failed - Code = " & proc.ExitCode)
            End If

    Thanks with Regards 

    Shafiqul Alam 


    Shafiqul Alam

    Wednesday, April 22, 2020 9:11 PM

All replies

  • See error codes 


    It could be one of many reasons, the first would be permissions to do a shutdown and if so you need to talk to the network admin.

    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    profile for Karen Payne on Stack Exchange

    Wednesday, April 22, 2020 9:42 PM
  • Hi,

    Do you have all of the needed permissions and set the windows firewall to accept the incoming requests?

    Perhaps this is the key to the problem. Please check it again.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 23, 2020 1:43 AM
  • You need some privileges, explained in the remark section of InitiateSystemShutdownExW
    Thursday, April 23, 2020 6:19 AM
  • Oh All are my PC So I can Set the permissions how I want. I just want to make a panel where I can Close all computer what I want 

    Shafiqul Alam

    Saturday, April 25, 2020 11:00 PM