none
WOL RRS feed

  • Question

  • I am reading the mac, ip and subnet from SCCM server. I am using udpclient.send but the computer is not waking up. Here is my code:

      Dim udpClient As New UdpClient
            'Ports to send magic packet to.
            Dim Port As Integer = 7
            Dim AltPort As Integer = 9
            Dim strSMSServer = "SCCM Server"
            Dim strSiteCode = "Sitecode"
            Dim sccmLocator = CreateObject("WbemScripting.SWbemLocator")
            Dim sccmService = sccmLocator.ConnectServer(strSMSServer, "root\sms\site_" & strSiteCode)
            Dim query = sccmService.ExecQuery("select SMS_R_System.MACAddresses, SMS_R_System.IPAddresses,SMS_R_System.IPSubnets from  SMS_R_System where SMS_R_System.Name ='" & txtName.Text & "'")
            For Each macaddress In query
                txtStatus.Text = ("IP Address: " & macaddress.IPAddresses(0) & " " & vbNewLine & "Subnet Mask: " & macaddress.IPSubnets(0) & " " & vbNewLine & "Mac Address: " & macaddress.MACAddresses(0))

                Dim mac As String = macaddress.MACAddresses(0)
                Dim arr As Byte() = mac.Split(":"c).[Select](Function(x) Convert.ToByte(x, 16)).ToArray()
                Dim address As IPAddress = IPAddress.Parse(macaddress.IPAddresses(0))
                Dim myIpEndPoint = New IPEndPoint(address, Port)
                Dim Gateway = macaddress.IPSubnets(0)
                udpClient.Send(arr, arr.Length, myIpEndPoint)

    Please help me. 


    Freddy91761_1

    Thursday, January 25, 2018 8:09 PM

All replies

  • I am reading the mac, ip and subnet from SCCM server. I am using udpclient.send but the computer is not waking up. Here is my code:

      Dim udpClient As New UdpClient
            'Ports to send magic packet to.
            Dim Port As Integer = 7
            Dim AltPort As Integer = 9
            Dim strSMSServer = "SCCM Server"
            Dim strSiteCode = "Sitecode"
            Dim sccmLocator = CreateObject("WbemScripting.SWbemLocator")
            Dim sccmService = sccmLocator.ConnectServer(strSMSServer, "root\sms\site_" & strSiteCode)
            Dim query = sccmService.ExecQuery("select SMS_R_System.MACAddresses, SMS_R_System.IPAddresses,SMS_R_System.IPSubnets from  SMS_R_System where SMS_R_System.Name ='" & txtName.Text & "'")
            For Each macaddress In query
                txtStatus.Text = ("IP Address: " & macaddress.IPAddresses(0) & " " & vbNewLine & "Subnet Mask: " & macaddress.IPSubnets(0) & " " & vbNewLine & "Mac Address: " & macaddress.MACAddresses(0))

                Dim mac As String = macaddress.MACAddresses(0)
                Dim arr As Byte() = mac.Split(":"c).[Select](Function(x) Convert.ToByte(x, 16)).ToArray()
                Dim address As IPAddress = IPAddress.Parse(macaddress.IPAddresses(0))
                Dim myIpEndPoint = New IPEndPoint(address, Port)
                Dim Gateway = macaddress.IPSubnets(0)
                udpClient.Send(arr, arr.Length, myIpEndPoint)

    Please help me. 

                

    Freddy91761_1

    Wrong Forum


    • Edited by Freddy91761_1 Thursday, January 25, 2018 8:07 PM Wrong Forum
    • Merged by Fei Hu Friday, January 26, 2018 8:08 AM The same question
    Thursday, January 25, 2018 8:00 PM
  • I am reading the mac, ip and subnet from SCCM server. I am using udpclient.send but the computer is not waking up.

    Pleas ensure you respond appropriately to your previous post on the same topic before movong onto the next part of the task.
    https://social.msdn.microsoft.com/Forums/en-US/6a05c0ff-61bd-4797-b8cd-f7de0e60800a/vbnet-wake-on-lan-reading-from-sccm?forum=vbgeneral

    Thursday, January 25, 2018 8:37 PM
  • Are you sure that computer is able to wake-on-LAN and is configured to do so?  Do you have a UDP server listening on port 7 on that machine, or are you just hoping the random packet will wake it?

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Friday, January 26, 2018 12:59 AM
  • Hi Freddy9176_1,

    Is there some error message here? You said that your computer is not waking up, your mean that the computer is asleep? If yes, you would need to turn this feature off in the power settings. Or checked to see if a firewall is blocking this.

    Here is the same thread that you can take a look:

    http://www.dreamincode.net/forums/topic/326734-wake-on-lan-code-not-working-packet-not-waking-up/

    Best Regards,

    Cherry


    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.

    Friday, January 26, 2018 6:37 AM
    Moderator
  • You know how to debug. 

    Click in front of the row to set a breakpoint (if that does not go right click and breakpoint) depending on your colorscheme a brown dot appears. 

    Now you click on F5 to start. With F10 you can step through your code. By hoovering over an item you see its value. 


    Success Cor

    Friday, January 26, 2018 11:10 AM