Board logo

标题: [转载代码] [PowerShell每日技巧]使用完整主机名(20140213) [打印本页]

作者: DAIC    时间: 2014-2-19 14:51     标题: [PowerShell每日技巧]使用完整主机名(20140213)

When you try PowerShell Remoting, you may run into connection errors just because your machine name was not fully qualified. Kerberos authentication may or may not needs this, depending on your DNS configuration.

So maybe you get errors when you try and connect like this:
  1. Enter-PSSession -ComputerName storage1
复制代码
When that happens, try and ask DNS for the fully qualified name:
  1. [System.Net.DNS]::GetHostByName('storage1').HostName
复制代码
Then, try this name instead. If remoting is enabled and set up correctly, you should now be able to connect.

http://powershell.com/cs/blogs/tips/archive/2014/02/13/using-fully-qualified-names-in-remoting.aspx
作者: Batcher    时间: 2014-2-21 13:22

  1. $env:COMPUTERNAME + '.' + $env:USERDNSDOMAIN
复制代码





欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2