Imports System
Imports System.Text
Imports Microsoft.Win32
Module ChangeIP
Sub Main()
Dim regKey As RegistryKey
Dim strServiceName As String
' Open the key to read the network card details
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\1")
' Save the 'ServiceName' value
strServiceName = regKey.GetValue("ServiceName")
regKey.Close()
' Open the 'Tcpip' key for this service
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\" & strServiceName & "\Parameters\Tcpip", True)
' Set the value of the IP address, writing the bytes and NOT the string
regKey.SetValue("IPAddress", Encoding.ASCII.GetBytes("10.1.1.1\0\0"))
regKey.Close()
End Sub
End Module
Imports System.Text
Imports Microsoft.Win32
Module ChangeIP
Sub Main()
Dim regKey As RegistryKey
Dim strServiceName As String
' Open the key to read the network card details
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\1")
' Save the 'ServiceName' value
strServiceName = regKey.GetValue("ServiceName")
regKey.Close()
' Open the 'Tcpip' key for this service
regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\" & strServiceName & "\Parameters\Tcpip", True)
' Set the value of the IP address, writing the bytes and NOT the string
regKey.SetValue("IPAddress", Encoding.ASCII.GetBytes("10.1.1.1\0\0"))
regKey.Close()
End Sub
End Module
تعليقات
إرسال تعليق