ここで、BRIVWTDC2は私のDCです
$rec = [WmiClass]"\\BRIVWTDC2\root\MicrosoftDNS:MicrosoftDNS_ResourceRecord"
$rec | get-member -membertype method
私に与える:
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, ...
と
$rec.CreateInstanceFromTextRepresentation
私に与える:
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
だからなぜ私はできないのですか
$rec.CreateInstanceFromTextRepresentation("BRIVWTDC2", "stage.testdmc.com", "SECARC in CNAME BRIVWTARC2.stage.testdmc.com")
ここで、argはDC、arg 2はゾーン、arg3はテキスト表現です=RIVWTARC2.stage.testdmc.comのSECARCというエイリアスを作成してください
私はただ得る:
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
それは私が根本的に愚かなことをしていると言っています...
ヘルプ