Can I log in to a remote computer from the command line?

Sancha Herrera, Emilio 20 Reputation points
2023-03-09T15:41:31.17+00:00

Hello!

I have a computer at work that performs scheduled tasks as long as it is logged in, sometimes it restarts and if we do not log in again those tasks are not executed, which causes us a problem.

Would it be possible to log in from another computer, from the command line without having to open "Remote Desktop"?

If it were feasible we could, from another computer and automatically, periodically check if it is logged in and if not open it.

I have searched and all I have found is to open remote desktop from command line, but the session has to be opened manually and that solution does not help me.

Thank you very much.

Regards

Emilio

Translated with www.DeepL.com/Translator (free version)

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2023-03-10T02:00:43.5866667+00:00

    Hi,

    Please open Windows PowerShell and run Enable-PSRemoting to configure WinRM, then you can start an interactive session with a remote computer using Enter-PSSession like this

    Enter-PSSession -ComputerName Server01

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enable-psremoting?view=powershell-7.3

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enter-pssession?view=powershell-7.3

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sancha Herrera, Emilio 20 Reputation points
    2023-03-10T09:54:43.83+00:00

    Great answer, and I think it may be the solution to my problem, unfortunately the company policies do not allow me to access, I'm afraid I will have to continue as before, logging in from "Remote Desktop".

    Thank you very much for your solution

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.