Windows Vista Forums

Generic error problem.
  1. #1


    Mark Guest

    Generic error problem.

    Hello,

    I have a script to create an A-record in a zone and if the zone doesn't
    exist it creates a zone as well. This is my script:

    Param
    ( [String] $ZoneName = $(Throw "You must enter a zone name"),
    [String] $RecordName = $(Throw "You must enter a record name"),
    [string] $ip = $(Throw "You must enter an ip address")
    )

    $zone=get-wmiobject -namespace root\microsoftDNS -class MicrosoftDNS_Zone
    -comp ZVW-MIRA -filter "name='$zonename'"
    if (!$zone) {
    $Type = 0
    # AD Integration (only valid on Active Directory Domain Controllers)
    $IsDSIntegrated = $False
    # FileName (Optional and only valid for zones with AD integrated set to
    $False)
    # File must exist if specified and have size greater than 0b.
    $Filename = $Null
    # Master IP (Optional and only valid for Secondary, Stub and Forwarder zones)
    $MasterIP = $Null
    # AdminEmail (Optional and only valid for Primary zones, writes into SOA
    record)
    $AdminEmail = "domains.ordina.nl"

    $NewZone =
    ([WMIClass]"\\ZVW-MIRA\root\MicrosoftDNS:MicrosoftDNS_Zone").CreateZone( `
    $ZoneName, $Type, $IsDSIntegrated, $FileName, $MasterIP, $AdminEmail)
    }


    $rec = [WmiClass]"\\ZVW-MIRA\root\MicrosoftDNS:MicrosoftDNS_AType"
    $rec | gm
    $server = "ZVW-MIRA"
    $class = 1
    $ttl = 3660

    $rec.CreateInstanceFromPropertyData($server, $ZoneName, $RecordName, $class,
    $ttl, $ip)


    It creates the zone and record correctly but it still gives this error:

    Exception calling "CreateInstanceFromPropertyData" : "Generic failure "
    At C:\dnsscript2.ps1:31 char:36
    + $rec.CreateInstanceFromPropertyData( <<<< $server, $ZoneName, $RecordName,
    $class, $ttl, $ip)



    Does anyone know what this means and what I can do? I'd prefer this error to
    be gone.
    I'm really new in the scripting so if you can give me the script with the
    changes I can see what is different so I can understand it better.

    Thanks in advance.

      My System SpecsSystem Spec

  2. #2


    Mark Guest

    RE: Generic error problem.

    I found it out. The hostname should be www.name.com instead of something
    else. I always typed test as parameter but it should be www.test.com by
    example.

    "Mark" wrote:

    > Hello,
    >
    > I have a script to create an A-record in a zone and if the zone doesn't
    > exist it creates a zone as well. This is my script:
    >
    > Param
    > ( [String] $ZoneName = $(Throw "You must enter a zone name"),
    > [String] $RecordName = $(Throw "You must enter a record name"),
    > [string] $ip = $(Throw "You must enter an ip address")
    > )
    >
    > $zone=get-wmiobject -namespace root\microsoftDNS -class MicrosoftDNS_Zone
    > -comp ZVW-MIRA -filter "name='$zonename'"
    > if (!$zone) {
    > $Type = 0
    > # AD Integration (only valid on Active Directory Domain Controllers)
    > $IsDSIntegrated = $False
    > # FileName (Optional and only valid for zones with AD integrated set to
    > $False)
    > # File must exist if specified and have size greater than 0b.
    > $Filename = $Null
    > # Master IP (Optional and only valid for Secondary, Stub and Forwarder zones)
    > $MasterIP = $Null
    > # AdminEmail (Optional and only valid for Primary zones, writes into SOA
    > record)
    > $AdminEmail = "domains.ordina.nl"
    >
    > $NewZone =
    > ([WMIClass]"\\ZVW-MIRA\root\MicrosoftDNS:MicrosoftDNS_Zone").CreateZone( `
    > $ZoneName, $Type, $IsDSIntegrated, $FileName, $MasterIP, $AdminEmail)
    > }
    >
    >
    > $rec = [WmiClass]"\\ZVW-MIRA\root\MicrosoftDNS:MicrosoftDNS_AType"
    > $rec | gm
    > $server = "ZVW-MIRA"
    > $class = 1
    > $ttl = 3660
    >
    > $rec.CreateInstanceFromPropertyData($server, $ZoneName, $RecordName, $class,
    > $ttl, $ip)
    >
    >
    > It creates the zone and record correctly but it still gives this error:
    >
    > Exception calling "CreateInstanceFromPropertyData" : "Generic failure "
    > At C:\dnsscript2.ps1:31 char:36
    > + $rec.CreateInstanceFromPropertyData( <<<< $server, $ZoneName, $RecordName,
    > $class, $ttl, $ip)
    >
    > Does anyone know what this means and what I can do? I'd prefer this error to
    > be gone.
    > I'm really new in the scripting so if you can give me the script with the
    > changes I can see what is different so I can understand it better.
    >
    > Thanks in advance.

      My System SpecsSystem Spec

Generic error problem. problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
generic error with Get-WmiObject Jeff PowerShell 2 11 Sep 2009
Generic Volume Driver Error CyberZeus Drivers 7 17 Jun 2009
Generic Run-time error Erica .NET General 0 03 Jun 2009
Generic error from Winss Frustrated Momma Vista performance & maintenance 0 25 Apr 2008
Generic McAfee Problem Message in Vista Problem Reports cyberbuff53 Vista performance & maintenance 0 01 Dec 2007