Followers

DNS zone files in Powershell

dim filesys
set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists("" &Server.MapPath("\Domene\admin\Oppdater_servere\Zoner\orginal.txt")&"") Then
   filesys.CopyFile "" &Server.MapPath("\Domene\admin\Oppdater_servere\Zoner\orginal.txt")&"", "" &Server.MapPath("\Domene\admin\Oppdater_servere\Zoner\" & domene & ".hosts")&""
set FileSysObj = CreateObject("Scripting.FileSystemObject")
txtFile= "" &Server.MapPath("\Domene\admin\Oppdater_servere\Zoner\" & domene & ".hosts")&""
set File = FileSysObj.OpenTextFile(txtFile, 2, TristateFalse)

line10 = "$ttl " & dm_ttl & " " & vbLf & "" & _
           "" & domene & ".  IN  SOA  " & ns01 & ". hostmaster.domain.no. (" & vbLf & "" & _
           "      " & dm_serienr & "" & vbLf & "" & _
           "      3600" & vbLf & "" & _
           "      900" & vbLf & "" & _
           "      2419200" & vbLf & "" & _
           "      3600 )" & vbLf & ""
File.write line10

(Loop start):
linje20 = "" & sd_navn &"    " & sd_ttl & "    IN    " & sd_rr_type & "    " & sd_pri & "    " & sd_weight & "    " & sd_port & "    " & sd_adresse & "" & vbLf & ""
File.write linje20
objRS2.Movenext
Loop
File.close

Published By
S.G.Godwin Dinesh.MCA
Sr.System Administrator

No comments:

Post a Comment