FAQ по Microsoft Windows Server 2003


Как организовать переименование рабочих станций в домене удаленно - часть 4


WScript.Echo "Rebooting..." set objWSHShell = WScript.CreateObject("WScript.Shell") objWSHShell.Run "rundll32 shell32.dll,SHExitWindowsEx 2"

Вариант 2:

Dim RegKeyCompName, RegKeyTCPIP, WSHShell, ComputerName, HostName, DomainName, FQDN, ADRootDSE, ADSysInfo, ADComputerName, ADRenameOK, ADRNewName, vStartRenameCA, NewNAmeU, NewNameL, vStartRenameAD

On Error Resume Next

'###### READ IN EXISTING COMPUTERNAME AND FQDN ######

RegKeyCompName = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\" RegKeyTCPIP = "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\"

Set WSHShell = CreateObject("WScript.Shell")

ComputerName = WSHShell.RegRead (RegKeyCompName & "ComputerName\ComputerName") Hostname = WSHShell.RegRead (RegKeyTCPIP & "Hostname") DomainName = WSHShell.RegRead (RegKeyTCPIP & "Domain") FQDN = HostName & "." & DomainName

Set ADRootDSE = GetObject("LDAP://RootDSE") If Err.Number <> 0 then ADComputerName = "Unable to determine this information" ADOU = "Unable to determine this information" ADRenameOK = "0" else Set ADSysInfo = CreateObject("ADSystemInfo") ADComputerName = ADSysInfo.ComputerName 'Get DN of local computer ADRenameOK = "1" ADOU = Mid(ADComputerName, InStr(ADComputerName, "=") + 1) 'Strip off just after the first = sign ADOU = Mid(ADOU, InStr(ADOU, "=") - 2) 'Strip off at 2 before the second = sign ComputerPath = "LDAP://" & ADComputerName OUPath = "LDAP://" & ADOU End if

'###### ASK USER FOR NEW DETAILS ###########

MsgBox "This script renames this computer and its active directory account" & vbCr & vbCr & "Name: " & ComputerName & vbCr & "FQDN: " & FQDN & vbCr & vbCr & "AD DN: " & ADComputerName & vbCr & "AD OU: " & ADOU, 0, "Information"




- Начало -  - Назад -  - Вперед -