Object NotFound Command not found
i don't know scripting or powershell, can find simple scripts , modify them environment.
i found script:
$dns="dnsserver"
$zone="zone"
import-csv adddns.csv | foreach {
dnscmd $dns /recordadd $zone $($_.name) $($_.ip)
}
this need, have 250 static entires need make in dns.
i put name of dns server between quotes in place of dnsserver
i put name of zone file between quotes zone.
i have csv file named adddns.csv
i saved file adddns.ps1 directory , put csv file in same directory. i try run script powershell, , doesn't work.
the error message is:
"the term 'adddns.ps1' not recognized name of cmdlet, function, script file, or operable progrma. check spelling of name, or if path included, verify path correct , try again,
at line:1 char:19
+ adddns.ps1 <<<<
+categoryinfo :objectnotfound: (adddns.ps1:string) []
commandnotfoundexception
+fullyqualifiederrorid :commandnotfoundexception
can explain in layman's terms i'm doing wrong?
thank you, simple, trying run script, except i'm getting invalid parameter.
i know should simple, using dnscmd create record, although found out want pointer record created well. do add additional switch of /createptr?
so if can see parameter have invalid, , proper syntax using createptr, appreciate help.
thank you
to create ptr record need have last value (or byte can say) of ip address i.e if ip address 192.168.1.10 , need .10 reverse lookup zone has first 3 values of ip address and fqdn name of host.
eg - c:\reverse.csv
ip name
==== ======
10 client1.ad.com
11 client2.ad.com
ultimately need prepare 1 more csv file contains data in above format.
below code ,
$dns = "dnsservername" $zone = "ad.com" $reversezone = "1.168.192.in-addr.arpa" #creating host records import-csv c:\dns.csv | %{dnscmd $dns /recordadd $zone $($_.name)a $($_.ip)} #creating ptr records import-csv c:\reverse.csv | %{dnscmd /recordadd $reversezone $($_.ip)ptr $($_.name)}
this way of doing it. not sure if others can come better way
hope helps
regards,
_prashant_
mcsa|mcitp sa|microsoft exchange 2003 blog - http://prashant1987.wordpress.com disclaimer: posting provided as-is no warranties/guarantees , confers no rights.
Windows Server > Windows PowerShell
Comments
Post a Comment