none
I cant connect anymore to remote host without specifying the FQDN RRS feed

  • Question

  • Hi guys, 

    I've a strange behavior when working with remote hosts ( create or enter a new pssesion, or invoke-command) :

    It used to work with netbios name, but now i have to specify the FQDN of the remote host.

    This doesnt seems related to DNS and the problem is on my workstation only. Does anyone have a clue ?

    I'm running windows7 64bits entreprise with powershell v4

    Here are some testing (domain hidden for confidentiality) :

     

    • nslookup OK

    PS>nslookup rodc-mridf                                                                                    
    Serveur :   rodc-mridf.xxx.com                                                                
    Address:  10.110.1.13                                                                                                                                                                                            
    Nom :    rodc-mridf.xxx.com                                                                   
    Address:  10.110.1.13                                                                                     

     

    • New session with netbios name -> not OK

    PS>New-PSSession -cn rodc-mridf                                                                           
    New-PSSession : [rodc-mridf] La connexion au serveur distant rodc-mridf a échoué avec le message d'erreur 
    services Web et a obtenu une réponse indiquant que l'URL HTTP n'était pas disponible. Cette réponse est ha
    Gestion des services Web. Pour plus d'informations, voir la rubrique d'aide about_Remote_Troubleshooting. 
    Au caractère Ligne:1 : 1                                                                                  
    + New-PSSession -cn rodc-mridf                                                                            
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                            
        + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession
        + FullyQualifiedErrorId : URLNotAvailable,PSSessionOpenFailed                                         
    Microsoft.PowerShell.Core\FileSystem::\\web-mridf\powershell ---------------------------------------------

    • new session with FQDN -> OK

     PS>New-PSSession -cn rodc-mridf.xxx.com                                                       

                                                                                                              
     Id Name            ComputerName    State         ConfigurationName     Availability                      
     -- ----            ------------    -----         -----------------     ------------                      
      4 Session4        rodc-mridf.x... Opened        Microsoft.PowerShell     Available       

    • pinging netbios name OK

    PS>ping rodc-mridf                                                                                                                     Envoi d'une requête 'ping' sur RODC-MRIDF.xxx.com [10.110.1.13] avec 32 octets de données :   
    Réponse de 10.110.1.13 : octets=32 temps=1 ms TTL=128                         
    Statistiques Ping pour 10.110.1.13:                                                                       
        Paquets : envoyés = 1, reçus = 1, perdus = 0 (perte 0%),                                              
    Durée approximative des boucles en millisecondes :                                                        
        Minimum = 1ms, Maximum = 1ms, Moyenne = 1ms                

     

    Thanks

     

    Wednesday, August 6, 2014 8:18 AM

Answers

  • I've found it ! :)

    I had to modify the default pssession option and set the proxy to 'No proxy' instead of 'none'

    so I added this line in my profile :

    $PSSessionOption = New-PSSessionOption -ProxyAccessType NoProxyServer  

    From technet :

    None The proxy access type is not specified. This means that proxy information, such as the access type, authentication mechanism, and credential, is not passed to the Web Services for Management (WSMan) protocol service. This field is introduced in Windows PowerShell 2.0.
    NoProxyServer No proxy server is used when configuring proxy settings. This mechanism resolves all the host names locally. This field is introduced in Windows PowerShell 2.0.

    • Marked as answer by Loïc MICHEL Thursday, August 7, 2014 6:44 AM
    Thursday, August 7, 2014 6:44 AM

All replies

  • Try:

    New-PSSession -cn "rodc-mridf"                                                             


    ¯\_(ツ)_/¯

    Wednesday, August 6, 2014 8:29 AM
  • same issue
    Wednesday, August 6, 2014 8:42 AM
  • I've enabled windows remote management analytical logfile... i dont even see the connection when i use netbiosname, the request doesnt seem to be transmit to the remote host.
    Wednesday, August 6, 2014 8:54 AM
  • [system.net.DNS]::GetHostByName('rodc-mridf')


    ¯\_(ツ)_/¯

    Wednesday, August 6, 2014 9:04 AM
  • Yes, i use these functions as a workaround, but i'd like to know why this is suddenly happened 

    function resolve-hostname{                                                                       
            param($computername)                                                                     
            [System.Net.Dns]::GetHostEntry($computername) |select -ExpandProperty hostname           
    }                                                                                                
                                                                                                     
    function nsn{                                                                                    
            param($computername)                                                                     
            $cn=resolve-hostname $computername                                                       
            new-pssession -cn $cn                                                                    
    }                                                                                                
                                                                                                     
    function etsn{                                                                                   
            param($computername)                                                                     
            $cn=resolve-hostname $computername                                                       
            enter-pssession -cn $cn                                                                  
    }                                                                                                   

                                                                                           

    Wednesday, August 6, 2014 11:41 AM
  • Did you try the addrss test I posted?

    My suggestion is that you have an issue with name resolution either on the machine or on the domain.  It is not a scripting issue.  Ther eis nothing in your scritp that can cause this.


    ¯\_(ツ)_/¯

    Wednesday, August 6, 2014 1:26 PM
  • yes this is ok (similar to my workaround) :

    PS>[system.net.DNS]::GetHostByName('rodc-mridf')                                                                                                                                                                                                                                                
    HostName                             Aliases                                AddressList     
    --------                           -------                                 -----------     
    rodc-mridf.xxx.com                  {}                                    {10.110.1.13}   

    Wednesday, August 6, 2014 2:22 PM
  • So that shows that the net framework can resolve the FQDN from the NBname.  This leaves your script and your mach9ine.  Now try this from another machine.  I suspect you are either missing patches or have some network or system corruption.  None of these issues are script relevant. If you cannot do this in the PowerShell CLI (not ISE) with a two line script then there is something wrong with your system.  Perhaps you have your locale or character set set wrong.


    ¯\_(ツ)_/¯


    • Edited by jrv Wednesday, August 6, 2014 2:32 PM
    Wednesday, August 6, 2014 2:32 PM
  • I've found it ! :)

    I had to modify the default pssession option and set the proxy to 'No proxy' instead of 'none'

    so I added this line in my profile :

    $PSSessionOption = New-PSSessionOption -ProxyAccessType NoProxyServer  

    From technet :

    None The proxy access type is not specified. This means that proxy information, such as the access type, authentication mechanism, and credential, is not passed to the Web Services for Management (WSMan) protocol service. This field is introduced in Windows PowerShell 2.0.
    NoProxyServer No proxy server is used when configuring proxy settings. This mechanism resolves all the host names locally. This field is introduced in Windows PowerShell 2.0.

    • Marked as answer by Loïc MICHEL Thursday, August 7, 2014 6:44 AM
    Thursday, August 7, 2014 6:44 AM
  • That tells us that you have the proxy settings set wrong on this system as the default is to use the platform settings.  You have effectively turned them off for PS.

    As I suspected this is not  scripting issue at all.  It would be best to find what is set wrong.  This can indicate that a Trojan has redirected you date through a remote proxy.  It can also be caused by a Winsock binding failure.

    Try resetting the Winsock bindings first.

    netsh winsock reset

    restart system.  This is a benign reset that just forces the Winsock layers to rebind in the correct order.  This can fix  minor corruption that effects the network and name resolution.


    ¯\_(ツ)_/¯

    Thursday, August 7, 2014 11:22 AM
  • @jrv Thank you for your responses, as i only connect to "local" stations it's ok for me to let this setting to NoProxyServer.
    Thursday, August 7, 2014 12:36 PM
  • @jrv Thank you for your responses, as i only connect to "local" stations it's ok for me to let this setting to NoProxyServer.

    It still says your system needs to be fixed.  If it isn't winsock then you may well have a Trojan.

    ¯\_(ツ)_/¯

    Thursday, August 7, 2014 12:38 PM
  • I dont think so, i have a ...special proxy config ;)
    Friday, August 8, 2014 8:55 PM
  • I dont think so, i have a ...special proxy config ;)

    Then you know what you problem is.  Special usually means broken or third party not NT compatible.  Have seen that many times.

    Not a scripting issue.


    ¯\_(ツ)_/¯

    Friday, August 8, 2014 8:58 PM