Category Archives: Windows

Windows shutdown เพราะ Evaluation หมดอายุ

เปิด Powershell As Administrator

slmgr -dlv

ดูตรง Remaining Windows rearm count: คือจำนวนครั้งที่ยังต่อได้

slmgr -rearm

จากนั้น restart เครื่อง จะใช้ได้อีก 180 วัน และค่า Remaining Windows rearm count จะลดลง

Windows Core ติดตั้ง Feature on Demand

ติดตั้ง FOD บน Windows Server Core เพื่อใช้ Feature เหล่านี้ได้

  • Microsoft Management Console (mmc.exe)
  • Event Viewer (Eventvwr.msc)
  • Performance Monitor (PerfMon.exe)
  • Resource Monitor (Resmon.exe)
  • Device Manager (Devmgmt.msc)
  • File Explorer (Explorer.exe)
  • Windows PowerShell (Powershell_ISE.exe)
  • Disk Management (Diskmgmt.msc)
  • Hyper-V Manager (virtmgmt.msc)
  • Task Scheduler (taskschd.msc)

คำสั่งนี้ใช้ Internet เพื่อติดตั้ง

Add-WindowsCapability -Online -Name ServerCore.AppCompatibility~~~~0.0.1.0

หลังจากเสร็จแล้ว Restart 1 ครั้ง ก็จะเรียกใช้ Command ขึ้นมาใช้งานได้

ข้อมูลเพิ่มเติม: https://learn.microsoft.com/en-us/windows-server/get-started/server-core-app-compatibility-feature-on-demand

Windows Core ติดตั้ง SSH

Get-WindowsCapability -Online | ? Name -like ‘OpenSSH*’

Name : OpenSSH.Client~~0.0.1.0 
State : Installed

Name : OpenSSH.Server~~0.0.1.0
State : NotPresent

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Path :
Online : True
RestartNeeded : False

Start-Service -Name “sshd”
Set-Service -Name “sshd” -StartupType Automatic
Get-Service -Name “sshd” | Select-Object *

Name : sshd
RequiredServices : {}
CanPauseAndContinue : False
CanShutdown : False
CanStop : True
DisplayName : OpenSSH SSH Server
DependentServices : {}
MachineName : .
ServiceName : sshd
ServicesDependedOn : {}
ServiceHandle : SafeServiceHandle
Status : Running
ServiceType : Win32OwnProcess
StartType : Automatic
Site :
Container :

ค่า Default Shell เป็น CMD ต้องเปลี่ยนเป็น Powershell ก่อนถึงจะ SSH เป็น Powershell ได้

New-ItemProperty -Path “HKLM:\SOFTWARE\OpenSSH” -Name DefaultShell -Value “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” -PropertyType String -Force

Windows Core Error Failed to release DHCP lease

ดู Interface ที่ต้องการแก้ไขด้วย command

Get-NetAdapter

ตัวอย่างลบ Config ที่ Ethernet0

Remove-NetIPAddress -InterfaceAlias Ethernet0 -confirm:$False

Fixed IP Address ด้วย command

New-NetIPAddress -InterfaceAlias Ethernet0 -IPAddress 172.16.1.2 -PrefixLength 24 -DefaultGateway 172.16.1.1

ถ้า Error: Instance DefaultGateway already exists ให้ใช้ Command นี้ก่อน แล้ว Fixed IP Address ใหม่อีกครั้ง

Remove-NetRoute -InterfaceAlias Ethernet0