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?

キッティング時に使用するPowershellスクリプト

Last updated at Posted at 2024-10-11

ICMP(Ping)応答するコマンド

icmp_allow.ps1
# 変数に確認したいルール名を格納
$ruleName = "A_ICMPv4_Allow"

# 指定したルール名が存在するか確認
$existingRule = Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue

# ルールが存在しない場合にのみ作成
if (-not $existingRule) {
    New-NetFirewallRule -Name ICMPv4 -DisplayName AsuzacFoodsICMPv4_Allow -Description キッティング時に設定されるPing応答コマンド -Profile Any -Direction Inbound -Action Allow -Protocol ICMPv4 -Program Any -LocalAddress Any -RemoteAddress Any
    Write-Host "ファイアウォールルール '$ruleName' を作成しました。"
} else {
    Write-Host "ファイアウォールルール '$ruleName' は既に存在しています。"
}

自動ログイン コマンド

auto_login.bat

echo 自動ログインレジストリ設定
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultPassword" /t "REG_SZ" /d "MyPassword" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "DefaultUserName" /t "REG_SZ" /d "User1" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "AutoAdminLogon" /t "REG_SZ" /d "1" /f

RDP許可 コマンド

remote_desktop.bat

echo リモートログイン許可設定
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
echo リモートデスクトップ用FireWall作成
netsh advfirewall firewall add rule name="remoteDesktopShadow TCP IN" dir=in action=allow protocol=TCP
netsh advfirewall firewall add rule name="remoteDesktopModeUser TCP IN" dir=in action=allow protocol=TCP localport=3389
netsh advfirewall firewall add rule name="remoteDesktopModeUser UDP IN" dir=in action=allow protocol=UDP localport=3389

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?