Как я могу вводить команды на сервере Minecraft, который был запущен удаленно, с помощью команды invoke-command PowerShell на локальном компьютере? - PullRequest
2 голосов
/ 19 апреля 2019

Я использую сервер Minecraft со своего ноутбука, поскольку у него i7 и больше оперативной памяти, чем у моего рабочего стола.Я хочу видеть командную строку сервера на своем рабочем столе и вводить команды, когда сервер фактически работает на моем ноутбуке.Я смог увидеть командную строку, настроив удаленный доступ и выполнив команду

Invoke-Command -ComputerName 10.0.0.53 -Credential Admin -ScriptBlock { & "RUNSERVER.bat"}

Это позволило мне увидеть, что сервер выводит в окно PowerShell на рабочем столе иСервер работает на ноутбуке, как и должно быть, но я все еще не могу ввести какие-либо команды.Я довольно неопытен с PowerShell, поэтому я не очень уверен, куда идти дальше.Кто-нибудь знает, как я могу отредактировать это так, чтобы я мог вводить команды из окна PowerShell на моем рабочем столе?

[localhost] Connecting to remote server localhost failed with the following error message : WinRM cannot process the request. The following error with
errorcode 0x8009030d occurred while using Negotiate authentication: A specified logon session does not exist. It may already have been terminated.
 Possible causes are:
  -The user name or password specified are invalid.
  -Kerberos is used when no authentication method and no user name are specified.
  -Kerberos accepts domain user names, but not local user names.
  -The Service Principal Name (SPN) for the remote computer name and port does not exist.
  -The client and remote computers are in different domains and there is no trust between the two domains.
 After checking for the above issues, try the following:
  -Check the Event Viewer for events related to authentication.
  -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
 Note that computers in the TrustedHosts list might not be authenticated.
   -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting
Help topic.
    + CategoryInfo          : OpenError: (localhost:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : 1312,PSSessionStateBroken
[localhost] Connecting to remote server localhost failed with the following error message : The WinRM client cannot process the request. CredSSP authentication
is currently disabled in the client configuration. Change the client configuration and try the request again. CredSSP authentication must also be enabled in
the server configuration. Also, Group Policy must be edited to allow credential delegation to the target computer. Use gpedit.msc and look at the following
policy: Computer Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Credentials.  Verify that it is
enabled and configured with an SPN appropriate for the target computer. For example, for a target computer name "myserver.domain.com", the SPN can be one of
the following: WSMAN/myserver.domain.com or WSMAN/*.domain.com For more information, see the about_Remote_Troubleshooting Help topic.
    + CategoryInfo          : OpenError: (localhost:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : -2144108126,PSSessionStateBroken
2019-04-19 20:00:08,630 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2019-04-19 20:00:08,631 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

Ответы [ 2 ]

2 голосов
/ 19 апреля 2019

Enter-PSSession -Computername "Портативный компьютер"

Вы сейчас находитесь на удаленном сеансе PowerShell на компьютере, который вы определили с помощью параметра имени компьютера.

Некоторые сведения, о которых следует знать.Если вы делаете это в рабочей группе, а не в домене, вам придется бороться с передачей учетных данных.Вы должны передать их как объект учетных данных в PS.Так что это выглядит примерно так:

$Creds = Get-Credential
enter-pssession -ComputerName 10.0.0.53 -Credential $Creds

для учетных данных введите имя пользователя и PW, которые существуют на удаленном компьютере.

Брандмауэр на удаленном хосте также необходимо настроить для разрешения входящего трафика Windows Remote Management Framework с вашего локального хоста.

0 голосов
/ 20 апреля 2019

РЕДАКТИРОВАЛ ОРИГИНАЛЬНЫЙ ОТВЕТ, ЧТОБЫ ОТРАЖАТЬ МОЙ ПОСЛЕДНИЙ ОТВЕТ:

Здесь Windows не справится с подобными вещами.Windows по умолчанию не поддерживает псевдотерминал (PTY).

Традиционно в системах типа * NIX вы можете запустить опцию ssh -t для доступа к экранному режиму (принудительно TTY).

Возможно, вам повезет больше, если вы воспользуетесь этим модулем powershell и выполните следующие инструкции: https://github.com/PowerShell/Win32-OpenSSH/wiki/TTY-PTY-support-in-Windows-OpenSSH

...