WindowsServerに対して、Serverspecを実行する場合に、Windows側にWinrm(Windowsリモート管理)を有効にする必要がある。
※Serverspecの実行をWindowsでやる手順ではない。
簡単だが、設定しないとServerspecでのテスト出来ないのでメモ。
手順
psの実行ポリシー変更(デジタル署名のないスクリプトの実行許可)
※管理者権限で、powershellを起動
set-executionpolicy remotesigned -Force
下記でwinrmを有効化
ps1形式で保存して、スクリプト実行すると楽!!
winrm_enable.ps1
# リモートアクセスを有効にする
Enable-PSRemoting -Force
# タイムアウト設定
Set-Item -Path "WSMan:\localhost\MaxTimeoutms" 1800000
Get-Item -Path "WSMan:\localhost\MaxTimeoutms"
# 暗号化されていない接続を許可
Set-Item -Path "WSMan:\localhost\Service\AllowUnencrypted" "true"
Get-Item -Path "WSMan:\localhost\Service\AllowUnencrypted"
# Basic認証許可
Set-Item -Path "WSMan:\localhost\Service\Auth\Basic" "true"
Get-Item -Path "WSMan:\localhost\Service\Auth\Basic"