當 User 密碼輸入錯誤超過 GPO 中設定的次數限制時
AD 會將該 User Account Lockdown 避免被暴力破解等可能的風險
但其實多半的原因都是 User 改密碼後忘記, 或因為有記住的密碼未清除的問題造成
先前都是用微軟官方提供的 這個程式 直接在 DC 上面去處理 Unlock
但最近發現如果在非 DC 上面, 用 Runas 的方式去跑這個程式時
Unlock 選項會是灰色的, 無法進行解鎖
但如果透過 PowerShell 下指令卻又可以解鎖, 揪竟是為什麼真是令人費解
無奈下只好寫了一個 PowerShell Script 來處理這件事情
以下為程式碼, 只要修改最前面的 $Script:SearchDomain 就可以適用於各環境
即使是跨 TrustDomain , 只要有權限都可以用
2017-09-28
2017-07-18
Windows 2000 實體機轉 Hyper-V 的虛擬化作業
有一台老掉牙的 Windows 2000 Server
由於上面的系統已經沒有人會維護了, 而該系統能轉的功能也都已經轉到別的系統上但仍有一些資料無法轉出, 需要在上面查詢, 故不能下線也不能壞掉
但是也無法移機, 因為那個系統早已沒有簽維護, 廠商也早已不支援那古代的版本
所以唯一避免他一步一步走上硬體損壞的絕路之前能做的僅有虛擬化一途
由於 Windows 2000 不支援 Volume Shadow Copy, 所以不能線上用 Disk2vhd 來轉
如果從光碟開機進一般的 WinPE 等工具系統, 也因為 RAID Card Driver 的關係沒辦法讀到磁碟
在這困難重重的情況下還好仍有一線生機
雖然自己常用的是 Hyper-V, 但對 VMWare 也是不排斥的
此時祭出 VMware vCenter Converter Standalone 來進行線上移轉是再適合不過了
畢竟在那個年代, VMWare 絕對是虛擬化技術的王者
果然一切順利地轉到 VMWare vSphere 免費板上面去一點問題也沒有
為了利用便宜的即時移轉、複寫等功能, 我們的虛擬化平台 95% 都是 Hyper-V
所以接下來的挑戰就是再從 VMWare 轉到 Hyper-V
在這裡吃足了苦頭, 以下是實戰說明:
2017-05-04
效能監視器 Performance Monitor 基本 Counter 設定
Performance Monitor 可以用來監控一個系統的效能狀況
但因為 Counter 太多常常搞不清楚究竟要用哪些
以下筆記列出常用基本 Counter, 可以快速瞭解系統最基本的狀況
微軟指出, 為了避免 Performance Monitor 影響被監視主機的效能表現
最好使用其他機器透過網路進行遠端 Monitor
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
$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
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
Labels:
Let's Encrypt,
PowerShell,
VDI,
Windows Server
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
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 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 中看到了不同之處
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 中看到了不同之處
Labels:
DFS,
DFSR,
PowerShell,
Windows AD 管理,
Windows Server
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
}
$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
}
訂閱:
文章 (Atom)

