(Explorerのサービスは停止しても自動で起動します)
$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' Set-ItemProperty $key HideFileExt 0 Stop-Process -processname explorer
$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' Set-ItemProperty $key HideFileExt 0 Stop-Process -processname explorer
# IPアドレス、サブネットマスク、DNSサーバ、デフォルトゲートウェイを設定します。
$IpAddress = "192.168.24.32"
$SubNetMask = "24"
$DnsServer = "192.168.24.1"
$DefaultGateway = "192.168.24.1"
# IPv4でDHCPでIPアドレスを取得しているインターフェースを取得します。
$IPv4Interface = Get-NetIPAddress | ? {$_.PrefixOrigin -eq "Dhcp" -and $_.AddressFamily -eq "IPv4" }
# 取得できたインターフェースが1つだけの場合はネットワーク情報を設定します。
if ($IPv4Interface.Count -lt 2) {
$NicInterfaceIndex = $IPv4Interface.InterfaceIndex
New-NetIPAddress `
–InterfaceIndex $NicInterfaceIndex `
–IPAddress $IpAddress `
-PrefixLength $SubNetMask `
-DefaultGateway $DefaultGateway
Set-DnsClientServerAddress `
-InterfaceIndex $NicInterfaceIndex `
-ServerAddresses $DnsServer
}