返回列表 发帖

[转载代码] [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

  1. $env:COMPUTERNAME + '.' + $env:USERDNSDOMAIN
复制代码
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

返回列表