2017-05-04

效能監視器 Performance Monitor 基本 Counter 設定

Performance Monitor 可以用來監控一個系統的效能狀況
但因為 Counter 太多常常搞不清楚究竟要用哪些
以下筆記列出常用基本 Counter, 可以快速瞭解系統最基本的狀況

微軟指出, 為了避免 Performance Monitor 影響被監視主機的效能表現
最好使用其他機器透過網路進行遠端 Monitor

Performance Monitor 大概長這樣:

2017-05-03

Google Chrome Extension: IC 之音 AOD 聆聽幫手 (IC975)

Google Chrome Extension:  IC 之音 AOD 聆聽幫手 (IC975)
第一次寫 Chrome Extension
因為想把 IC 之音 AOD 音檔抓下來, 發現可以從原始碼直接看到下載連結
但是如果一個節目一個節目去看原始碼實在太花時間, 所以研究了一下寫出這個 Extension
已經太久沒寫 Code, 所以應該可以寫得更簡潔的地方並沒有處理, 能用就好

以下是原始碼:

manifest.json

2017-04-26

利用 Let's Encrypt 來佈署 Remote Desktop Gateway

本教學利用 Let's Encrypt 來佈署 Remote Desktop Gateway
2018.08.29 更新重寫

有關取得 LetsEncryptWinSimple 的方式請參考以下這篇文章的前半部
Exchange 2016 採用 Let's Encrypt 憑證的方法與 Auto Renew

Auto Renew 的部份:


$PublishedURL = "RDG.Contoso.com"
$LetsEncryptWinSimplePath = "C:\LetsEncryptWinSimple.v1.9.11.2\"
$PFXPath = "C:\ProgramData\win-acme\httpsacme-v01.api.letsencrypt.org\"

cd $LetsEncryptWinSimplePath
$DateTimeString = Get-Date -format yyyyMMdd_HHmmss
$TranscriptLog = (Get-Item -Path ".\" -Verbose).FullName + "\Logs\" + ("CertRenew_" + $DateTimeString + ".log")
start-transcript -path $TranscriptLog

2017-04-12

以 Command 管理 WiFi Profile

View wireless adapter settings
Netsh WLAN show interfaces

View wireless network profiles saved on your PC
netsh wlan show profiles
Netsh WLAN show profiles interface="Interface_Name"

Recover network security key from any wireless profile stored on your PC
netsh WLAN show profile name="Profile_Name" key=clear

Stop connecting automatically to a wireless network out of range
Netsh WLAN set profileparameter name="Profile_Name" connectionmode=manual
Netsh WLAN set profileparameter name=" Profile_Name" connectionmode=auto

Delete wireless network profiles stored on your PC
netsh wlan delete profile name="TempGuest"

Export and import wireless network profiles
Netsh WLAN export profile key=clear folder="Folder_Path"
Netsh WLAN export profile name="Profile_Name" key=clear folder="Folder_Path"
Netsh WLAN add profile filename="File_Path.XML"
Netsh WLAN add profile filename="Path_With_Filename.xml" Interface="Wireless Network Connection" user=current

2017-04-07

資料夾存在卻無法刪除的問題

在 File Server 發生刪除資料夾時顯示 "The system could not find the file specified."
這些資料夾的共同特性是名稱最後有一個空白
並且這些資料夾也無法被重新命名
資料夾內容的安全性 ACL 顯示:

在這裡找到的刪除的語法:

2017-04-06

長檔名/路徑在 Windows 10 / Windows Server 2016 獲得解決

長檔名/路徑預設長度只能在 260 字元以內, 可經過 Policy 修改來支援 260 字元以上
Windows 10 可利用修改 Local Computer Policy
Windows Server 2016 可利用 GPO

位置: Computer Policies > Administrative Templates > System > Filesystem
項目: Enable Win32 long paths

當然, 這個設定在 Windows 10 / Windows Server 2016 才有作用

DC 非 Windows Server 2016 可以更新 Administrative Templates (.admx) 來設定
Administrative Templates (.admx) for Windows 10 and Windows Server 2016

下載解開後複製到 SYSVOL\domain\Policies\PolicyDefinitions 就行了 (放這裡才會 Replica)

也可以直接改註冊機碼:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]
"LongPathsEnabled"=dword:00000001

DFS-R 某些檔案不複寫的問題排除

DFS 是分散式檔案系統
DFS-R 是分散式檔案系統的複寫功能

一直以來我都覺得 Domain 環境下 DFS 相當好用
可以給 User 一個固定的連線 UNC Path, 即使 File Server 異動也不會影響到 User 既有的習慣
再加上可以使用複寫功能, 能達到備援的目的 (備援不是備份, 切記!)

但使用一陣子過後總會偶爾發現就那某些檔案無法被複寫
原因不明, 不管是改檔名或複製一份, DFS-R 都完全無動於衷, 完全沒有想要複寫的意思
剛開始, 覺得問題一定是出在 DFS-R 機制上面, 微軟一定有 Bug
在 C:\Windows\Debug 有 Dfsr00xxx.log 的 Log File 可以查看
發現不能複寫的檔案會顯示這樣的訊息
UsnConsumer::TombstoneOrDelete LDB Deleting ID Record
UsnConsumer::TombstoneOrDelete ID record deleted from USN_RECORD
但是完全沒有幫助, 找不到任何相關資訊

接著往檔案資訊去想, 在檔案資訊的 Attributes 中看到了不同之處


2017-03-14

指定 VDI Golden Image VHDX 到 SSD Tier

$Path = "D:\VDI"

$Files = ((Get-ChildItem -path $Path -R) | where {$_.Name -like "*.vhdx"}).FullName
$SSDTier = (Get-StorageTier | where {$_.MediaType -eq 'SSD' -and $_.Size -gt 0} | Select FriendlyName).FriendlyName
foreach ($File in $Files) {
    Write-Host
    Write-Host "Move ""$File"""
    Write-Host " to  ""$SSDTier"""
    Write-Host
Set-FileStorageTier -FilePath $File -DesiredStorageTierFriendlyName $SSDTier
}

2017-03-02

Software List Remote (Enhanced Version)


' ----- 參數設定開始 -----

ADDomain = "contoso"
TargetFilePath = "D:\Info\Data\*.dbd"
GapString = "=====Gap====="
InfoString = "=====Info====="

' 除厝模式: (派送用戶端執行應設為 0)
' 0: 不顯示訊息
' 1: 顯示錯誤訊息
DebugMode = 0

' 資料取得方式 (此參數會在 DB Record 中註記):
' 1: Local - Client Push 檔案給 Server 讀取
' 2: Remote - Server 主動連線取得資料產生檔案
InfoDataType = 2

' 如果資料取得方式是 2: Server 主動連線取得資料產生檔案
' 此處給予客戶端有可能使用的管理員帳號密碼
AuthUserNameString = "contoso\Administrator;administrator;administrator;"
AuthPasswordString = "password;P@$$w0rd;P@$$P@##w0rd;"

' ----- 參數設定結束 -----