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;"

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

2017-02-24

Windows 10 Language Packs 多國語言字型問題

Windows 10 對多國語言的支援比較完善了
不過只安裝語言包對於使用非 Unicode 撰寫的程式仍然顯示不良
因為預設沒有諸如 Big5、GB2312 等的地區字型
所以還必須要再安裝補充字型 (Language Capabilities) 才行

語言包安裝指令
dism /Online /Add-Package /PackagePath:D:\langpacks\zh-tw\lp.cab

安裝補充字型前必須確定你的 Windows 10 電腦能連到 Microsoft Update

再進 Settings -> System -> Apps & features -> Manage Optional Fetures 裡面
確認將各語言的補充字型 (Supplemental Fonts) 手動選取安裝進去

或者你也可以使用 PowerShell
dism /online /Get-Capabilities
以下列出常用的: 繁體中文、簡體中文及日文的補充字型安裝 Powershell Command

2017-02-15

憑證格式 .pfx 轉 .pem

憑證格式 .pfx 轉 .pem: http://support.citrix.com/article/ctx106028
安裝 OpenSSL for Win32 http://slproweb.com/products/Win32OpenSSL.html
要先裝 Visual C++ 2008 Redistributables (搭配 Win32OpenSSL 或 Win64OpenSSL)
Microsoft Visual C++ 2008 Redistributable Package (x86) http://www.microsoft.com/en-us/download/confirmation.aspx?id=29
Microsoft Visual C++ 2008 Redistributable Package (x64) http://www.microsoft.com/en-us/download/details.aspx?id=15336

以下是轉換操作步驟