DNS Clientes

08/08/2006 - 11:17 por ZIDAC | Informe spam
Hola, después de actualizar un dominio de NT a 2003, los DNS de los clientes
necesitan apuntar al DC.

En un escenario sin DHCP, ¿Cómo puedo configurar las DNS en los clientes
para que apunten al DC y se puedan loguear?

GRACIAS,
ZIDAC

Preguntas similare

Leer las respuestas

#6 ZIDAC
10/08/2006 - 08:18 | Informe spam
Tienes razón Ramón, a veces me precipito y no busco lo suficiente.

Gracias por responderme, no obstante, accedo a estas news vía web, así que
no puedo ver lo que me has enviado, si no te importa pégalo en el mismo post.

MUCHAS GRACIAS DE NUEVO,
ZIDAC
Respuesta Responder a este mensaje
#7 Ramon Jimenez [MVP]
10/08/2006 - 09:27 | Informe spam
Hola Zidac,

Copia y pega lo que hay entre las líneas INICIO y FIN en un script (ej:
CambiaDNS.vbs)

-INICIO

'+--+--+
'| Copyright (C) 2006 Ramon Jiménez
|
'+--+--+
'| File: | ZIDAC.VBS
|
'| Purpose: | Ejecutar una función/script en estaciones remotas
|
'+--+--+
'| Author: | Ramon Jimenez
|
'| Date: | Aug 9, 2006
|
'+--+
'| Parameters | None
|
'+--+
'| Requirements | 1. The user must be logged on with
|
'| | administrative credentials on target systems
|
'| |
|
'| | 2. A file Called "WorkStations.txt" containing target
servers|
'| | must exist in current directory.
|
'| |
|
'+--+--+
'| Version | 1.0
|
'+--+--+
'| File History:
|
'|
+-+-++
|
'| Name: Ramon Jimenez
|
'| Date: Aug 9, 2006
|
'| Desc: Creation and version 1.0
|
'|
+-+-++
|
'+--+

Option Explicit
CONST StrTargetWorkStations = "WorkStations.txt"
CONST StrLogFile = "Results.log"
CONST sWindowTitle = "ZIDAC Script"
CONST ForReading = 1
CONST OverwriteExisting = True

Dim objIE, objProgressBar, objTextLine1, objTextLine2, objQuitFlag,
objProgBar
Dim oFile, objInputFile, oFileLog, objLogFile, strWorkStationName,
nWorkStations

CheckLocalRequirements
InitializeLogFile
ProcessSourceFile

Sub ProcessSourceFile()
Dim intCount
intCount = 1
OpenSourceFile
StartIE sWindowTitle
While not objInputFile.AtEndOfStream
strWorkStationName = Trim(objInputFile.ReadLine)
SetLine1 "Proccessing WorkStation...: " & strWorkStationName
GetIP(strWorkStationName)
intCount = intCount +1
UpdatePBar intCount, nWorkStations
Wend
objLogFile.Close
SetLine1 "Process Ended"
SetLine2 ""
DeleteProgressbar
End Sub

Sub GetIP(strTargetWorkStation)
Dim strCurrentIP, objWMIService, IPConfigSet, IPConfig, i
strCurrentIP = ""
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strTargetWorkStation &
"oot\cimv2")
Set IPConfigSet = objWMIService.ExecQuery ("Select * from
Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
strCurrentIP = strCurrentIP & IPConfig.IPAddress(i) & " ,"
Next
End If
Next
objLogFile.WriteLine( strTargetWorkStation & " : " & strCurrentIP)

End Sub

Sub InitializeLogFile
Set oFileLog = CreateObject("Scripting.FileSystemObject")
Set objLogFile = oFileLog.CreateTextFile(".\\" & StrLogFile)
If Err.Number Then
Print "Error 0X" & CStr(Hex(Err.Number)) & " creating LogFile " &
strLogFile
If Err.Description <> "" Then
Print "Error dascription: " & Err.Description & "."
End If
objLogFile.Close
WScript.Quit
End If
'Putting header in Log File
objLogFile.WriteLine(CStr(nWorkStations) & " WorkStations Processed")
objLogFile.WriteLine("--")
End Sub

Sub OpenSourceFile()
Set oFile = CreateObject("Scripting.FileSystemObject")
Set objInputFile = oFile.OpenTextFile(".\\" & StrTargetWorkStations)

If Err.Number Then
Print "Error 0X" & CStr(Hex(Err.Number)) & " trying to open" &
StrTargetWorkStations
If Err.Description <> "" Then
Print "Error description: " & Err.Description & "."
End If
objInputFile.Close
WScript.Quit
End If
End Sub

Private Sub StartIE(strTitel)
Dim objDocument
Dim objWshShell

Set objIE = CreateObject("InternetExplorer.Application")
objIE.height = 230
objIE.width = 400
objIE.menubar = False
objIE.toolbar = false
objIE.statusbar = false
objIE.addressbar = false
objIE.resizable = False
objIE.navigate ("about:blank")

' Wait till Browser is loaded
While (objIE.busy)
wend

set objDocument = objIE.document

' Writing content...
InitializeObjects objDocument, strTitel

' Once browser is available, object definition...
set objTextLine1 = objIE.document.all("txtMilestone")
set objTextLine2 = objIE.document.all("txtRemarks")
Set objProgressBar = objIE.document.all("pbText")
set objProgBar = objIE.document.all("objProgress")
objTextLine1.innerTEXT = ""
objTextLine2.innerTEXT = ""

objIE.visible = True

' We set focus on Browser
Set objWSHShell = WScript.CreateObject("WScript.Shell")
objWshShell.AppActivate(sWindowTitle)
End Sub


Private Function CloseIE()
On Error Resume Next
Wscript.Quit
objIE.quit
End Function


Private sub SetLine1(sNewText)
On Error Resume Next
objTextLine1.innerTEXT = sNewText
End Sub


Private sub SetLine2(sNewText)
On Error Resume Next
objTextLine2.innerTEXT = sNewText
End Sub


Private Sub DeleteProgressbar()
On Error Resume Next
objProgBar.className="vis2"
End Sub

Private Sub UpdatePBar(nCompt, nMaxim)
Dim nSteps
On Error Resume Next
nSteps = Cint((nCompt * 34) / nMaxim)
objProgressBar.value = String(nSteps,"n")
End Sub

Private Sub InitializeObjects(objDocument, strTitel)
objDocument.Open
objDocument.Writeln "<title>" & strTitel & "</title> "
objDocument.Writeln "<style>"
objDocument.Writeln " BODY {background: Silver} BODY { overflow:hidden }"
objDocument.Writeln " .vis1 {visibility: visible}"
objDocument.Writeln " .vis2 {visibility: hidden}"
objDocument.Writeln " P.txtStyle {color: Navy; font-family: Verdana; " & "
font-size: 10pt; font-weight: bold; margin-left: 10px } "
objDocument.Writeln " input.pbStyle {color: Navy; font-family: Wingdings;
" & " font-size: 10pt; background: Silver; height: 20px; " & " width:
340px } "
objDocument.Writeln "</style>"


' Defining Text lines...
objDocument.Writeln "<P id=txtMilestone class='txtStyle'
style='margin-left: 10px'> </P>"
objDocument.Writeln "<P id=txtRemarks class='txtStyle'
style='margin-left: 10px' ></P>"
objDocument.Writeln "<CENTER>"

' Progress bar
'objDocument.Writeln "<input type='text' id='pbText' class='pbStyle'
value='' >"
objDocument.Writeln "<div id=""objProgress"" class=""vis1""><input
type='text' id='pbText' class='pbStyle' value='' ></div>"
objDocument.Writeln "<br><br>" ' space down a little

objDocument.Writeln "<SCRIPT LANGUAGE='VBScript' >"

objDocument.Writeln "Sub Window_OnLoad()"
objDocument.Writeln "theleft = (screen.availWidth -
document.body.clientWidth) / 2"
objDocument.Writeln "thetop = (screen.availHeight -
document.body.clientHeight) / 2"
objDocument.Writeln "window.moveTo theleft,thetop"
objDocument.Writeln "End Sub"
objDocument.Writeln "</SCRIPT>"
objDocument.Close
End Sub

Private Sub CheckLocalRequirements()
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists(".\" & StrTargetWorkStations) Then
Msgbox "The source file containing target workstations does not exist
in current directory. Please check ensure that all requirements are met", 0,
"Local requirements error"
ShowLocalRequirements
Wscript.quit
End If
nWorkStations = CountNumberOfLines(StrTargetWorkStations)
If nWorkStations = 0 Then
MsgBox "There are no WorkStations to process. Check source file and
populate it with workstations to process", 0, "Local requirements error"
ShowLocalRequirements
Wscript.quit
End If

End Sub

Private sub ShowLocalRequirements()
MsgBox "The following requirements have to be met: " & vbcrlf & vbcrlf &
_
"1. The user must be logged on with administrative credentials on
target systems" & vbcrlf & vbcrlf & _
"2. The workstations.txt file containing target workstations must
exist in current directory", 0, "Local requirements error"
End Sub

Function CountNumberOfLines(strFile)
Dim nLineCount, sReadLine, ObjFSO, objFile
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(StrFile, ForReading)
CountNumberOfLines = 0
On Error Resume next
nLineCount = 1
sReadLine = objFile.ReadLine
If err = 0 Then
Do While Not objFile.AtEndOfStream
sReadLine = objFile.ReadLine
nLineCount = nLineCount + 1
loop
set sReadLine = Nothing
ObjFile.Close
Set ObjFSO = Nothing
Set ObjFile = Nothing
CountNumberOfLines = nLineCount
End If
End Function
FIN

El fichero auxiliar "Workstations.txt" debe contener, en cada linea, el
nombre de la estación remota.

Workstation1
Workstation2
Workstation3
...
...

Y te aconsejo que utilices Outlook Express u otro lector para leer y
escribir en las News.

Ramon

"ZIDAC" wrote in message
news:
Tienes razón Ramón, a veces me precipito y no busco lo suficiente.

Gracias por responderme, no obstante, accedo a estas news vía web, así que
no puedo ver lo que me has enviado, si no te importa pégalo en el mismo
post.

MUCHAS GRACIAS DE NUEVO,
ZIDAC

Respuesta Responder a este mensaje
#8 ZIDAC
11/08/2006 - 13:57 | Informe spam
Ramón, te aseguro que he seguido tus instrucciones al pie de la letra e
incluso he intentado arreglarlo por mi cuenta, pero no doy con la tecla.

Lo único que hace este script es crear un txt (results.log) con los
siguientes datos:

nombre_pc: dirección_IP

es decir, que si en el archivo workstation.txt pongo el nombre de dos
equipos: PC-a y PC-b, el resultado de la ejecución del script es un
results.log:

PC-a: 192.168.0.45
PC-b: 192.168.0.50

Pero..
¿Me falta algo?
¿Dónde pongo en el script la IP de los server DNS que quiero poner?

GRACIAS OTRA VEZ,
ZIDAC
Respuesta Responder a este mensaje
#9 ZIDAC
11/08/2006 - 14:00 | Informe spam
Buscando, buscando, también he encontrado esto, pero me da error en el código:

http://www.freevbcode.com/ShowCode.asp?IDH86

GRACIAS,
ZIDAC
Respuesta Responder a este mensaje
#10 Ramon Jimenez [MVP]
11/08/2006 - 14:12 | Informe spam
¿Tu te has leido bien mi correo?

En el te decía que era a modo de ejemplo y que solo había que cambiar la
rutina GetIP por otra que se llame como quieras y que lo haga. Te puse
además el nombre del script de ScriptCenter para que lo buscases...

si buscas bienencuentras este enlace
http://www.microsoft.com/technet/sc...x?mfr=true

que te dice como hacerlo...

Si unes a y b obtienes ab.

Ramon


"ZIDAC" wrote in message
news:
Ramón, te aseguro que he seguido tus instrucciones al pie de la letra e
incluso he intentado arreglarlo por mi cuenta, pero no doy con la tecla.

Lo único que hace este script es crear un txt (results.log) con los
siguientes datos:

nombre_pc: dirección_IP

es decir, que si en el archivo workstation.txt pongo el nombre de dos
equipos: PC-a y PC-b, el resultado de la ejecución del script es un
results.log:

PC-a: 192.168.0.45
PC-b: 192.168.0.50

Pero..
¿Me falta algo?
¿Dónde pongo en el script la IP de los server DNS que quiero poner?

GRACIAS OTRA VEZ,
ZIDAC
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una pregunta AnteriorRespuesta Tengo una respuesta
Search Busqueda sugerida