Berikut caranya :
1. Buat project baru di VB.net (Saat ini penulis menggunakan vb 2010 express)
2. Tambahkan Reference ( Project , add Reference )
System.Management3. Ketik atau copy paste Source berikut
System.Management.Instrumentation
Imports System.Management
Imports System.Management.ManagementPath
Class Form1
Dim A As String = "newComputerName"
Public Sub ubah_compname()
Dim myPath As New ManagementPath
myPath.Server = System.Net.Dns.GetHostName
myPath.NamespacePath = "root\CIMV2"
myPath.RelativePath = "Win32_Computersystem.Name='" & myPath.Server &"'"
Dim myObj As New ManagementObject(myPath)
Dim myParams() As Object = {A}
myObj.InvokeMethod("Rename", myParams)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call ubah_compname()
MsgBox("Computer name anda adalah " & A, MsgBoxStyle.Information, "khaest")
Close()
End Sub
End Class
Silahkan di modifikasi untuk merubah banyak computer name client #eh
Nb. Penulis sudah mencobanya di OS Win XP sp2 dan sp3
0 comments:
Post a Comment