コマンドプロンプトの画面ログを取る
仕事でWindowsのコマンドプロンプトを使うときに画面ログを取りたいときがある。
(いままでその都度で表示内容をコピペしたり、PrintScreenを取ったりしており効率が悪かった)
PowerShellを使えばログを取る方法があるっぽいが何かと面倒臭そう…
PsExecを使ってSSHログイン可能にする方法もあるけど勝手にソフトはインストールできなかったりする。
そんな時、Windowsの標準機能にTelnetサーバーがあることを知り、TeratermからループバックでTelnetログインできれば簡単にログが取れるのでは?
と、思いついたのでやってみた。
環境はWindows7 (Home Premium)
[rtoc_mokuji title=”” title_display=”” heading=”h3″ list_h2_type=”” list_h3_type=”” display=”” frame_design=”” animation=””]
Telnetサーバーの有効化
コントロールパネルから辿っていきTelnetサーバー機能を有効化する。




しばらく待つと有効化される。
Telnetサーバー起動
次にTelnetサーバーを起動する。
[Windowsボタン + R ] で services.mscを実行しサービス管理を開く。

Telnetを選択してプロパティを開きスタートアップの種類を”手動”に変更する。


プロパティ変更後にTelnetを開始する。

ここでTelnet接続ができるか試してみるが、何やら接続拒否されてしまう。
メッセージの内容を見るとTelnetClientsグループなるものにユーザを追加する必要があるらしい。

Access Denied: Specified user is not a member of TelnetClients group.
Server administrator must add this user to the above group.
Telnet Server has closed the connection
TelnetClientsグループの設定
コマンドプロンプト or PowerShellを管理者で起動し下記コマンドを打つ。

# TelnetClientsグループを新規作成
net localgroup TelnetClients /add
# TelnetClientsグループに<ログインユーザ>を追加
net localgroup "TelnetClients" "<ログインユーザ>" /add
これで準備が完了。念のためTelnetサーバーを再起動する。
Telnetログイン
再度、Telnetで接続しログインできれば成功!
文字コードはSJISに設定しておく。


Telnetなのでセキュリティ的に外部からの接続は拒否推奨。
コメント