FAQ по Microsoft Windows Server 2003


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


NewName = InputBox("Enter the new computer name below and click OK to continue","Rename: Step 1") NewNameU = UCase(NewName) NewNameL = LCase(NewName) NewNameUCN = "CN=" & NewNameU

if NewName = "" then wscript.echo "The computer name has not been changed" else vStartRenameCA = MsgBox ("Continue and rename computer to: " & NewName,vbYesNo or vbExclamation,"Rename: Step 2") if vStartRenameCA = 6 then With WSHShell .RegDelete RegKeyTCPIP & "Hostname" .RegDelete RegKeyTCPIP & "NV Hostname" .RegWrite RegKeyCompName & "ComputerName\ComputerName", NewNameU .RegWrite RegKeyCompName & "ActiveComputerName\ComputerName", NewNameU .RegWrite RegKeyTCPIP & "Hostname", NewNameL .RegWrite RegKeyTCPIP & "NV Hostname", NewNameL End With wscript.echo "The computer name and FQDN have been changed" elseif vStartRenameCA = 7 then wscript.echo "The computer name and FQDN have NOT been changed" end if

if ADRenameOK = 1 then vStartRenameAD = MsgBox ("Continue and rename AD Account to: " & NewName,vbYesNo or vbExclamation,"Rename: Step 3") if vStartRenameAD = 6 then Set objItem = GetObject(ComputerPath) objItem.Put "dNSHostName", NewNameL & DomainName objItem.SetInfo objItem.Put "displayName", "DESKTOP_" & NewNameU & "$" objItem.SetInfo objItem.Put "sAMAccountName", NewNameU & "$" objItem.SetInfo

Set objNewOU = GetObject(OUPath) Set objMoveComputer = objNewOU.MoveHere _ (ComputerPath, NewNameUCN) wscript.echo "The active directory computer account has been changed" elseif vStartRenameAD = 7 then wscript.echo "The computer account in AD has NOT been changed" End If else wscript.echo "Insufficient information to rename AD account"

End If

End if

Если предоставленной информации оказалось недостаточно для решения вашей задачи вы можете

задать вопрос в этой теме форума OSZone.net.




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