Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Changing current credentials in a command prompt

Options
  • 24-01-2013 11:39am
    #1
    Registered Users Posts: 7,498 ✭✭✭


    If i launch a cmd.exe command prompt and try a remote command such as:
    qwinsta /server:192.168.1.2
    

    This will attempt to connect to the remote server using my current windows credentials. However the remote server doesnt allow my current username and password but i have different credentials which will work on that server.

    There is no switch on this executable to use certain credentials.
    How can i get the command prompt to use these credentials or prompt me to use them?


Comments

  • Registered Users Posts: 37,485 ✭✭✭✭Khannie


    According to this, you just stick your username in before the server directive.

    e.g. qwinsta <username> /server:192.168.1.2


  • Registered Users Posts: 2,809 ✭✭✭Gone Drinking


    (Create a command prompt short cut if needed)

    Hold shift > right click CMD.exe > Run as > enter domain/username/password


  • Registered Users Posts: 7,498 ✭✭✭BrokenArrows


    Khannie wrote: »
    According to this, you just stick your username in before the server directive.

    e.g. qwinsta <username> /server:192.168.1.2

    That just returns the information that qwinsta supplies for just that user rather than all user sessions on the remote server


  • Registered Users Posts: 7,498 ✭✭✭BrokenArrows


    (Create a command prompt short cut if needed)

    Hold shift > right click CMD.exe > Run as > enter domain/username/password

    Doesnt work as the remote user doesnt have and shouldnt have privleges to open and run files on my local computer.


  • Closed Accounts Posts: 5,835 ✭✭✭Torqay


    Maybe this trick will work for you:
    Only, there was ONE little trick that I had to pull off. Since I was connecting via VPN, I wasn't a member of the remote domain - in fact, my login to the remote box was limited to only one machine (a SQL Server). So qwinsta wouldn't work - as I didn't have permission to access it.

    The solution? Simple: open up Windows Explorer to \\remoteMachineName\c$ (or some other share). In order to connect to a share you have to pass in credentials and get a Kerberos ticket. Once that's in place, it's good for roughly 10 hours in most cases... and once you have that ticket it then gets bundled with your subsequent requests with qwinsta and rwinsta. (Okay... so maybe that's not hacking... but it does solve the issue of qwinsta and rwinsta not letting you pass in optional credentials.)

    Source


  • Advertisement
  • Registered Users Posts: 2,809 ✭✭✭Gone Drinking


    Try

    Type "Psexec \\servername –u username –p password –c cmd"
    Type "qwinsta"

    Source: http://www.dotnetheaven.com/article/qwinsta-command-in-windows-server-2008


  • Closed Accounts Posts: 5,835 ✭✭✭Torqay


    Try

    Type "Psexec \\servername –u username –p password –c cmd"
    Type "qwinsta"

    Source: http://www.dotnetheaven.com/article/qwinsta-command-in-windows-server-2008

    Download it here. ;)


  • Registered Users Posts: 7,498 ✭✭✭BrokenArrows


    I was aware of the mapping a drive trick but not all servers have it enabled.

    I'll give the psexec a go tomorrow.

    Thanks


  • Registered Users Posts: 7,498 ✭✭✭BrokenArrows


    Try

    Type "Psexec \\servername –u username –p password –c cmd"
    Type "qwinsta"

    Source: http://www.dotnetheaven.com/article/qwinsta-command-in-windows-server-2008

    Bingo. Works like a charm but just dont need the -c

    -c tries to copy cmd.exe from my computer to the remote computer!


Advertisement