CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 11 of 11
  1. #1
    Join Date
    Jun 2008
    Posts
    34

    [RESOLVED] help ( detect pc that is on and shutdown it)

    Dear friends, I'm developing internt kiosk program. I'm using vb.net 2008 and windows vista sp1. Is there anyone know the code where we can see which computer that is already turn on?

    Example the client is pc 1 until pc 10
    and the ip adress of each is 192.168.0.1 until 192.168.0.10

    can I know/view which computer that is already turn on from server form?
    if can, what is the code?

    can anyone help me?

    One more thing, Can I shutdown the computer from server?
    For example: It's already closing time and if we are turn off computer one by one. It'll takes time and not efficient. So, can I just turn off the client computer from server? If can, can you give me the code?

    Thanks for your help.......

  2. #2
    Join Date
    Aug 2005
    Location
    Spain!
    Posts
    149

    Talking Re: help ( detect pc that is on and shutdown it)

    You can ping the host you want to know if up with

    http://msdn.microsoft.com/en-us/libr...tion.ping.aspx

    If you are using tcp/ip client/server, then after you checked that client is up, you can send a string command like "Shutdown" or similar and when the client receives this, shutdown the pc.

    I've read something similar before in
    http://www.codeproject.com/KB/vb/RemoteShutdownX.aspx

    Hope it helps

  3. #3
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: help ( detect pc that is on and shutdown it)

    This might help on the shutdown...

    http://www.eggheadcafe.com/tutorials...rt-or-log.aspx

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: help ( detect pc that is on and shutdown it)

    If you doing the Kiosk software you can implement everything within the app.. You already have the IP linkup, and can use this to check if the client system is still online, and then you can use the ShutDown API call in the client part ..

    Gremmy..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: help ( detect pc that is on and shutdown it)

    I'd use Terminal Server for the kiosk's. It can connect and run software securely
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: help ( detect pc that is on and shutdown it)

    I like dglienna's suggestion for terminal servers.
    This works very well, using the API to call the command:


    Code:
    Const SW_SHOWNORMAL As Int32 = 1
    Private Declare Function apiWinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Int32) As Int32
    
    
    apiWinExec("tsshutdn /server:" & RemoteName.Text & " /powerdown", SW_SHOWNORMAL)
    All you need to know is the name of the remote computer to shut down.
    But I know that there are several ways to do it.

  7. #7
    Join Date
    Jun 2008
    Posts
    34

    Question Re: help ( detect pc that is on and shutdown it)

    Quote Originally Posted by TT(n)
    I like dglienna's suggestion for terminal servers.
    This works very well, using the API to call the command:


    Code:
    Const SW_SHOWNORMAL As Int32 = 1
    Private Declare Function apiWinExec Lib "kernel32" Alias "WinExec" (ByVal lpCmdLine As String, ByVal nCmdShow As Int32) As Int32
    
    
    apiWinExec("tsshutdn /server:" & RemoteName.Text & " /powerdown", SW_SHOWNORMAL)
    All you need to know is the name of the remote computer to shut down.
    But I know that there are several ways to do it.
    Do we need to import anything in the vb.net (for example import system.data.oledb when we want to connect to Acsess database)?

    Do The Remote Name is the computer Name ?

    What about if we use the ip address, is the code will be the same???

  8. #8
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: help ( detect pc that is on and shutdown it)

    No
    I don't think you'd need an import, if the computer shows up in the task "View workgroup computers", in the "My Network" window.

    Yes
    If a computer name/s is showing then, you can shut that computer down.

    No
    Use the computer name with this example.
    Other examples suggested may use the ip address, and the port number.

  9. #9
    Join Date
    Jun 2008
    Posts
    34

    Question Re: help ( detect pc that is on and shutdown it)

    Quote Originally Posted by TT(n)
    No
    I don't think you'd need an import, if the computer shows up in the task "View workgroup computers", in the "My Network" window.

    Yes
    If a computer name/s is showing then, you can shut that computer down.

    No
    Use the computer name with this example.
    Other examples suggested may use the ip address, and the port number.
    Can you give example with the ip address and port number
    Thanks for your help

  10. #10
    Join Date
    Jun 2004
    Location
    NH
    Posts
    678

    Re: help ( detect pc that is on and shutdown it)

    This link has already been posted.
    Remote Shutdown
    Please read the links that members have posted, when they try to answer your question.

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: help ( detect pc that is on and shutdown it)

    just replace the servername with the server ip address. you don't need to specify a port. i shut down my server that way.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured