Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:20:22+00:00 2026-06-10T06:20:22+00:00

where BRIVWTDC2 is my DC $rec = [WmiClass]\\BRIVWTDC2\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord $rec | get-member -membertype method Gives

  • 0

where BRIVWTDC2 is my DC

$rec = [WmiClass]"\\BRIVWTDC2\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord"
$rec | get-member -membertype method

Gives me:

   TypeName: System.Management.ManagementClass#ROOT\MicrosoftDNS\MicrosoftDNS_ResourceRecord

Name                                 MemberType Definition
----                                 ---------- ----------
CreateInstanceFromTextRepresentation Method     System.Management.ManagementBaseObject CreateInstanceFromTextRepresentation(System.String DnsServe...
GetObjectByTextRepresentation        Method     System.Management.ManagementBaseObject GetObjectByTextRepresentation(System.String DnsServerName, ...

and

$rec.CreateInstanceFromTextRepresentation

Gives me:

PS C:\Windows\system32> $rec.CreateInstanceFromTextRepresentation


MemberType          : Method
OverloadDefinitions : {System.Management.ManagementBaseObject CreateInstanceFromTextRepresentation(System.String DnsServerName, System.String Contain
                      erName, System.String TextRepresentation)}
TypeNameOfValue     : System.Management.Automation.PSMethod
Value               : System.Management.ManagementBaseObject CreateInstanceFromTextRepresentation(System.String DnsServerName, System.String Containe
                      rName, System.String TextRepresentation)
Name                : CreateInstanceFromTextRepresentation
IsInstance          : True

So why can’t I do

$rec.CreateInstanceFromTextRepresentation("BRIVWTDC2", "stage.testdmc.com", "SECARC in CNAME BRIVWTARC2.stage.testdmc.com")

where arg is is DC, arg 2 is zone and arg 3 is textual representation = make me an alias called SECARC for RIVWTARC2.stage.testdmc.com

I just get:

Exception calling "CreateInstanceFromTextRepresentation" : "Generic failure "
At line:1 char:42
+ $rec.CreateInstanceFromTextRepresentation <<<< ("BRIVWTDC2", "stage.testdmc.com", "'SECARC' in CNAME 'BRIVWTARC2.stage.testdmc.com'")
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WMIMethodException

Which says I am doing something fundamentally stupid….

help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:20:24+00:00Added an answer on June 10, 2026 at 6:20 am

    It is permissions, we need to be someone who can change DNS ( Heads and Brick Walls 🙁 )
    the following example creates a DNS Alias, must be run as Admin or a a user who can change DNS

    # DnsChanger.ps1
    # Change the DNS Entries for Arbitrary Servers
    # version 0.1 15/08/2012
    # Paddy Carroll 
    # 2 arguments (1) physical server name (2) server alias
    # 
    
    # setup event source
    
    if (! [System.Diagnostics.EventLog]::SourceExists("DnsManager"))
    {
    "Administrative script to create event source has not been run: DnsManager.ps1"
    # which is just [System.Diagnostics.EventLog]::CreateEventSource("DnsManager", "Application")
    throw 'error'
    }
    
    # initialise event
    
    $evt=new-object System.Diagnostics.EventLog("Application")
    $evt.Source="DnsManager"
    $errevent=[System.Diagnostics.EventLogEntryType]::error
    $infoevent=[System.Diagnostics.EventLogEntryType]::information
    
    
    # set up variables
    
    $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name  
    
    # get arguments
    
    if($args.count -lt 2)
    {
       "Script requires two parameters, a physical server name and an alias. FDQN names will be truncated and the current domain will be appended"
       $evt.WriteEntry("Wrong number of arguments supplied to DnsManager " ,$errevent,2)
       throw 'error'
    }
    
    $phys = $args[0].split('.')[0]
    $alias = $args[1].split('.')[0]
    $filter = "ContainerName = " + [char]34 + $domain + [char]34 
    
    $filter
    
    # test for existence of CNAMEType alias
    
    try{
       $rec = Get-WmiObject -Namespace 'root\MicrosoftDNS' -Class MicrosoftDNS_CNAMEType -filter $filter
       if (!$rec)
          {
        # if it doesnt exist, get all AType aliases
             $rec = Get-WmiObject -Namespace 'root\MicrosoftDNS' -Class MicrosoftDNS_AType -    filter $filter
          }
       }catch{
          $type = $_.Exception.getType().FullName
          $detail = $_.Exception.ErrorDetails().toString()
          $evt.WriteEntry("Problem getting DNS Namespace for " + $domain  ,$errevent,3)
          throw 'error'
       }
    
    
    # create the alias
    
    try{
    $rec[0].CreateInstanceFromTextRepresentation($domain,$domain,$alias + '.' + $domain + ' IN     CNAME ' + $phys + '.'+$domain)
    }catch{
        $type = $_.Exception.getType().FullName
        $detail = $_.Exception.ErrorDetails().toString()
        $evt.WriteEntry("Problem creating Alias for " + $phys + " as " + $alias + " : " +    $type + " : " + $detail,$errevent,1)
        throw 'error'
       }
    $evt.WriteEntry("Alias created for " + $phys + " as " + $alias ,$infoevent,1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.