.:++ Me+MySelf & I ++:.

dari dalam diri seorang aku..

Join Domain Script [revised] June 13, 2007

Filed under: Windows — asriey @ 6:31 pm

Selepas membuat beberapa pembaharuan, ini adalah versi yang terkini. Apa yang skrip ni bleh buat ialah:

  1. Rename PC
  2. Masukkan description
  3. Join Domain

Dim objWMIService, colComputers, objComputer, strComputer, objRegistry
Dim strKeyPath, strValueName, strDescription
Dim strDomain, strPassword, strUser, namaPc
Dim NewName, Result

set objNetwork = CreateObject("Wscript.Network")
namaPc=objNetwork.ComputerName
NewName = InputBox("Enter a new name for this computer:","Rename Computer", namaPc)

NewName = Trim(NewName)
If NewName = "" Then WScript.Quit(10)

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!root\cimv2")

Set colComputers = objWMIService.ExecQuery _
("SELECT * FROM Win32_ComputerSystem")

For Each objComputer in colComputers
WScript.Echo "Renaming " & objComputer.Name & " to " & NewName
Result = objComputer.Rename(NewName)
If Result = 0 Then
WScript.Echo "Rename Successful."
Else
WScript.Echo "Failed, error " & Result & "."
End If
Next

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set objRegistry = GetObject _
("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "System\CurrentControlSet\Services\lanmanserver\parameters"
strValueName = "srvcomment"
strDescription = InputBox("Masukkan Diskripsi Komputer Ini")

objRegistry.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strDescription

Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144

strDomain = "nama-domain"
strPassword = "password-ler"
strUser = "user"

Set objNetwork = CreateObject("WScript.Network")

strComputer = objNetwork.ComputerName


Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)


If Result = 0 Then
WScript.Echo "Join Domain Successful."
Else
WScript.Echo "Failed, error " & Result & "."
End If
WScript.Quit(Result)

just copy dan paste ke notepad, kemudian save as .vbs. pastu double klik je kalau nak guna. function rename tu bleh buang kalau tak perlu. ianya ada kat situ sbb lepas ghost pc, mesti la nak tukar nama sebelum join domain. kalau pc baru, tak perlu.

Advertisements
 

Xtvt Hujung Minggu

Filed under: Personal — asriey @ 5:52 pm

Hasil plan hentam sajalah, maka hujung minggu lepas terisi dengan aktiviti yang melenguhkan urat2 sendi tangan. Ya! bermain bowling. selepas tu ke Lata Sungai Tekala. Saksikan gelagat orang2 bujang dalam gambar kat bawah ni.


Takkan keciwa tak dapat cecah 150 kot..


Apapun gaya mesti mau ada..


Mamat yang paling bergaya..


Cover album juara gang starz season akan datang.. [sori arr meor, gambo hang terselindung sket]


Aikkk? ada ahli baru?


Ketenangan dan kedamaian tasik..