我很少使用 PowerShell,但我想使用Set-DnsClientServerAddress
。直接运行它告诉我需要导入模块 DnsClient。运行时Import-Module DnsClient
我得到下面的输出。发生了什么事?我当然没有弄乱这些 Windows 文件。我在 Windows 8 上运行 PS v4。
PS C:\> Import-Module DnsClient
VERBOSE: Loading module from path 'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsClient.psd1'.
VERBOSE: Loading 'TypesToProcess' from path
'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsCmdlets.Types.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path
'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsConfig.Types.ps1xml'.
VERBOSE: Loading 'TypesToProcess' from path
'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsClientPSProvider.Types.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsCmdlets.Format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsConfig.Format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path
'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\DnsClientPSProvider.Format.ps1xml'.
VERBOSE: Loading module from path 'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\dnslookup.dll'.
VERBOSE: Importing cmdlet 'Resolve-DnsName'.
VERBOSE: Loading module from path 'C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\MSFT_DnsClient.cdxml'.
Import-Module : Cannot process Cmdlet Definition XML for the following file:
C:\windows\system32\WindowsPowerShell\v1.0\Modules\DnsClient\MSFT_DnsClient.cdxml. At line:374 char:13
+ $__cmdletization_exceptionHasBeenThrown = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Executable script code found in signature block.
At line:375 char:13
+ throw
+ ~~~~~
Executable script code found in signature block.
At line:380 char:9
+ $__cmdletization_exceptionHasBeenThrown = $false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Executable script code found in signature block.
At line:383 char:13
+ __cmdletization_BindCommonParameters $__cmdletization_objectModelWra ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Executable script code found in signature block.
At line:384 char:13
+ $__cmdletization_objectModelWrapper.BeginProcessing()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Executable script code found in signature block.
At line:388 char:13
+ $__cmdletization_exceptionHasBeenThrown = $true
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Executable script code found in signature block.
At line:389 char:13
+ throw
+ ~~~~~
Executable script code found in signature block.
At line:381 char:9
+ try
+ ~~~
Executable script code found in signature block.
At line:399 char:5
+ $__cmdletization_queryBuilder = $__cmdletization_objectModelWrapper.GetQuery ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Executable script code found in signature block.
At line:400 char:66
+ if ($PSBoundParameters.ContainsKey('InterfaceIndex') -and (@('ByName') -cont ...
+ ~~~~~~~~
Executable script code found in signature block.
Not all parse errors were reported. Correct the reported errors and try again.
At line:1 char:1
+ Import-Module DnsClient
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], XmlException
+ FullyQualifiedErrorId : System.Xml.XmlException,Microsoft.PowerShell.Commands.ImportModuleCommand
PS C:\>