Jump to content



Recommended Posts

We are in the process of setting up the connection to the servers via RDP. We are experiencing a problem when trying to connect. PasswordStats changes username to hostname\username.

After analyzing the PSLaucher.ps1 file I found the block that was causing the problem.
How can we deactivate it, knowing that every time I modify this file the RDP session no longer starts?


    if($UserName -like '*.\*' -or $AccountType -eq 'Windows')
        #User account in this space is a local Windows Account, and is not supported to work with a Remote Desktop Gateway. Therefore, no need to set a Windows Credential for this type of account
        $NewUserName = $HostName + '\' + $UserName.replace('.\', '')
        #add generic credential (TERMSRV)
		cmdkey /generic:TERMSRV/$HostName /user:$NewUserName /pass:"""$Password"""

        #In this block, we are using a domain account, so if user is passing Remote Gateway commands to the session, we will add a Windows Credential **Gateway requires a Windows Credential to be passed, not a TERMSRV (generic) credential**
        if ($rdGatewayAddr) #this IF statement checks the variable has any value other then null
        #add Windows Credential
        cmdkey /add:$rdGatewayAddr /user:$UserName /pass:"""$Password"""
        #add generic credential (TERMSRV)
		cmdkey /generic:TERMSRV/$HostName /user:$UserName /pass:"""$Password"""




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...