0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WOL & MicrosoftRemoteDesktopを1クリックで接続(Mac)

Last updated at Posted at 2021-05-29

Macから1クリックで、スリープ状態のWindowsを起動してリモート接続

  1. WOLのスクリプト実行
  2. MicrosoftRemoteDesktopアプリを選択
  3. マシンを選んで接続

追記 23/11/25

Windows11にしたせいか、
WOLなしで、MicrosoftRemoteDesktopを使って呼び出した時
勝手にスリープ解除されるようになったので、必要なくなりました。

(Windows11を入れ直したら、スリープ解除が自動で行われる事を確認できなかったので、別の要因と思われます。25/2/15)


慣れてくると面倒

他のアプリケーションなら自由が利くけれども、オプションみたいなものが見当たらない。ショートカットを作ってもパスワードを毎回入力しなければならない。

Automatorで解決

事前準備

brew install wakeonlan

Automator

ファイル>新規>アプリケーションを選択

AppleScriptを実行

on run {input, parameters}


	do shell script "/usr/local/bin/wakeonlan <Macアドレス>"
	delay 1
	tell application "Microsoft Remote Desktop"
		activate
		delay 0.5
		tell application "System Events"
			keystroke "k" using {command down}
			delay 0.5
			key code 36
		end tell
	end tell

	return input
end run

アプリケーションとして保存します。
delayは調整して下さい。
「セキュリティとプライバシー」で、アクセシビリティの権限を与える必要があります。

ここで"Command+K"を入力しているのは
PC Quick Connectを実行するためです。
スクリーンショット 2021-05-29 18.41.08.png

なので、アカウント等の接続設定はクリックして事前に行っておいて下さい。
Dockに追加しておくと、ポチって少し待つだけで接続できます。
この例ではPCはローカルネットワークに存在しています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?