[Windows] How to Restart / Shutdown machine use CMD prompt

**Restart**
C:\> shutdown.exe /m \\{FQDN或IP} /r /f /t 0 /c “add HOTFIX KBxxxxx"

**Shutdown**
C:\> shutdown.exe /m \\{FQDN或IP} /s /f /t 0 /c “face-out machine

**啟用互動式**
C:\> shutdown.exe /i
shutdown-i.jpg

 

(參數說明)
shutdown /[r|s] /m \\ComputerName /c “Comment" /d [u|p] <xx>:<yy>

Value Description
/r Restarts the remote computer.
/s Shuts down the remote computer.
/m \\ComputerName Specifies the destination computer.
/c “Comment Enables you to comment in detail about the reason for the shutdown. You can use a maximum of 511 characters. Comments must be enclosed in quotation marks.
/d [u|p] xx:yy Lists the reason for the system restart or shutdown, where xx specifies a major reason number from 0 through 255, and yy specifies a minor reason number from 0 through 65,535.
/force Forces the computer to shut down if other users are logged in. If this is not used and other users are logged in to the remote computer, the computer will not shut down or restart.

Important
If you force the computer to shut down or restart, logged in users will not have the opportunity to save their work.
/t xxx Sets the time-out period before the system shuts down or restarts to xxx seconds. The valid range is 0-600, with a default of 30. Using the /t flag implies the /force option.

[Windows] View Who Is Logged On Machine

method#1.
c:\> qwinsta.exe  /server:{FQDN或IP}

(參數)
顯示遠端桌面服務工作階段的資訊。

QUERY SESSION [sessionname | username | sessionid]
[/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM]

sessionname 識別名稱為 sessionname 的工作階段。
username 以使用者 username 來識別工作階段。
sessionid 以識別碼 sessionid 來識別工作階段。
/SERVER:servername 要查詢的伺服器 (預設值是目前的伺服器)。
/MODE 顯示目前的線路設定值。
/FLOW 顯示目前的流量控制設定值。
/CONNECT 顯示目前的連線設定值。
/COUNTER 顯示目前遠端桌面服務計數器的資訊。
/VM 顯示虛擬機器中工作階段的相關資訊。

 

Method#2
c:\> query.exe /server:{FQDN或IP}

(參數)
QUERY { PROCESS | SESSION | TERMSERVER | USER }

Method#3 (GUI)
工作管理員 > 使用者

[Windows]如何讓Windows 2012 / 2016 工作管理員 – 效能 – 磁碟出現

在Windows 8開始在工作管理員 > 效能 都有監看磁碟效能;即使到了Windows 10依舊還是有的。眼尖的各位應有發現在Windows Server 2012 (伺服器版本)居然沒有 !! 真正有夠夭壽骨…

別急著生氣話說微軟說開啟會影響伺服器效能會被拖累..如下圖所示.
diskperf-source-info.png

既然這樣預設關閉,總是能開啟對吧^O^

Solution :

step01. cmd.exe (以系統管理人員身份執行)

step02. diskperf -Y (無需重新開機 ; 建議在查看磁碟效能需求再開啟它;用完建議關掉它吧)

diskperf.png


Reference :

  1. Microsoft TechNet – Diskperf
  2. Step-By-Step: Enabling Disk Performance Counters in Windows Server 2012 R2 Task Manager
  3. Server & Tools Blogs > Windows 8 / Windows Server 2012: The New Task Manager

[Windows] 更換’命令提示列(cmd.exe) / PowerShell美美字體

打開 cmd.exe 輸入 chcp 會秀出系統預設Big5 (CP950 ; Code Page 950 ) ;若要用UTF-8;Unicode(65001) 則輸入 chcp 65001

那拜讀到The Will Will Web 保哥 編改了 微軟雅黑字體 ( Microsoft YaHei Mono) 放置他的專案GitHub 字型 下載字型。

再開啟cmd.exe / powershell 順道將’預設值’及’內容’都把字型改成下載保哥編改過的Microsoft YaHei Mono字型即可看看美美字體。


Reference :

The Will Will Web 保哥 – ‘讓你的命令提示字元或 WSL 擁有一個美麗等寬的字型設定’

[Windows] Meltdown & Specture Patch software for Windows 10

step00.
前提 Windows 10 1709已安裝了微軟 KB4056892

step01.
press “PowerShell"

step02.
PS:\> Set-ExecutionPolicy ByPass

step03.
PS:\> Install-Module SpeculationControl

step04.
PS:\> Get-SpeculationControlSettings // 若有警告表示該主機未升級相對應BIOS/UEFI

step05.
PS:\> Set-ExecutionPolicy Restrict

Done.

(補充) Windows cmd.exe
查看機器序號  > wmic bios get serialnumber 或 wmic csproduct list full
查看機器BIOS版本  > wmic bios get smbiosbiosversion

 


 

Reference:

How to Check and Update Windows Systems for the Meltdown and Spectre CPU Flaws

[Windows] Windows Client disable SMB1.0

** Windows 8.1、Windows 10、Windows 2012 R2 和 Windows Server 2016 **
method#1 GUI
Windows 功能 > (V)取消打勾 “SMB 1.0/CIFS 檔案共用支援"

method#2 CLI (PS)
PS C:\> Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
(啟用)
PS: C:\> Enable-WindowsOptionalFeature -Online -FeatureName smb1protocol

 

** Windows 7 **
PS C:\>Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 0 -Force
(啟用)
PS C:\> Set-ItemProperty -Path “HKLM:\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" SMB1 -Type DWORD -Value 1 -Forcehttps://flic.kr/p/23eXCDz

 

windows10-stop-smb1

 

Reference :

Microsoft 如何在 Windows 和 Windows Server 中偵測、啟用及停用 SMBv1、SMBv2 和 SMBv3

[NetApp] Microsoft Windows Server 2012 use NFSv3 mount volume ,error “Network error – 53”

因客戶反應今日Windows Server 2012 R2 用NFSv3 掛載 NetApp FAS2552A 有錯誤訊息 “Network error – 53 "

當下確認幾點 :

1. Client with storage eachother ping > OK

2. confirm create temporary LIFs role belong ‘Data’

3.confirm SVMs options allowed-protocols have ‘nfs’

4.confirm export-policy & export-policy rule is OK

5.confirm Cluster-Mode ONTAP over than 8.3.x (PS: C-mode 8.3.1 just support NFSv3)

最後都沒問題原來是有幾個參數需調整這樣Windows NFSv3 mount才能運作

solution

step01.

::> set -privilege diagnostic

step02.

::*>vserver nfs show -vserver {SVM} -fields v3-ms-dos-client,enable-ejukebox,v3-connection-drop

(註)

v3-ms-dos-client (預設 disabled)

enable-ejukebox (預設 true)

v3-connection-drop (預設 enabled)

step03.

vserver nfs modify -vserver {SVM} -v3-ms-dos-client enabled -enable-ejukebox false -v3-connection-drop disabled

step04.

*Windows Client*

mount -o mtype=hard \\NetApp-NFS-LIF-IP\Volume Z:\

大功告成囉^O^

 

 

Stop Microsoft remind Windows 10 upgrade

workaround :

1. notepad create name ‘ stop-win10-remind.bat ‘
——————————————————————–
@echo on
taskkill /f /im GWX.exe
taskkill /f /im GWXUX.exe
cd/d C:WindowsSystem32
takeown /f GWX
cacls GWX /e /g everyone:f
rd/q/s GWX
pause
———————————————————————

2.save

3. run as administrator this script

Remind : 只要有更新微軟pach即需再執行這script一次唷


Reference:

http://mrmad.pixnet.net/blog/post/199378854-%5B%E6%95%99%E5%AD%B8%5D10%E7%A7%92%E5%85%A7%E6%B0%B8%E4%B9%85%E7%A7%BB%E9%99%A4windows10%E6%8F%90%E9%86%92%E5%85%8D%E8%B2%BB%E5%8D%87%E7%B4%9A%E8%A8%8A

Windows 10 無限重開機 兼 修復 ?

 

step01. 疑難排解 -> 高級選項 > 命令提示字元

step02. bcdedit // show resumeobject {GUID} then copy it

step03. bcdedit /set {GUID} recoveryenabled No

step04. chkdsk /r c:

step05. sfc /scannow

step06.reboot

done.

 

若是有如下狀況

—————————————————————-

 

The boot configuration data store can not be opened.

The requested system device cannot be found.
無法打開啟動配置數據存儲。
—————————————————————-

Solution :

step01. bcdedit /enum // 確認已讀取不到開機記錄設定

step02. chkdsk /r

step03. sfc /scannow

step04. bootrec /scanos

step05. bootrec /fixmbr

step06. bootrec /fixboot

step07. bootrec /rebuildbcd

step08. bcdedit /enum // 確認已可以讀取到開機資訊

step09. reboot

Done.