先用 Standard / Enterprise 版產生 ConfigurationFile.INI
*. Express 版本安裝 GUI 沒有一個 (Ready to Install 的步驟可以停下來產生 .ini 檔)
取得 ConfigurationFile.INI 後進行以下變更
2019-02-27
有關磁碟機 Drive 的一些 PowerShell 指令
指定光碟機為 Z:
Get-WmiObject -Class Win32_volume -Filter 'DriveType=5' | Select-Object -First 1 | Set-WmiInstance -Arguments @{DriveLetter='Z:'}
改好後須 Reboot (或有什麼 Command 可以移除舊的 Drive Letter?)
將 Disk Online
Get-Disk | where {$_.OperationalStatus -eq "Offline"} | Set-Disk -IsOffline $False
變更分割區磁碟代號
Get-Disk -Number 1 | Get-Partition -PartitionNumber 2 | Set-Partition -NewDriveLetter D
Get-WmiObject -Class Win32_volume -Filter 'DriveType=5' | Select-Object -First 1 | Set-WmiInstance -Arguments @{DriveLetter='Z:'}
改好後須 Reboot (或有什麼 Command 可以移除舊的 Drive Letter?)
將 Disk Online
Get-Disk | where {$_.OperationalStatus -eq "Offline"} | Set-Disk -IsOffline $False
變更分割區磁碟代號
Get-Disk -Number 1 | Get-Partition -PartitionNumber 2 | Set-Partition -NewDriveLetter D
2019-02-21
KMSHost Install
Windows Server
slmgr.vbs /ipk KMS-Key
slmgr /ato
Office 2010
https://www.microsoft.com/en-us/download/confirmation.aspx?id=25095
slmgr.vbs /ipk KMS-Key
Office 2010: slmgr /ato BFE7A195-4F8F-4F0B-A622-CF13C7D16864
Office 2013
https://www.microsoft.com/de-ch/download/details.aspx?id=49164
slmgr.vbs /ipk KMS-Key
slmgr /ato 2E28138A-847F-42BC-9752-61B03FFF33CD
Office 2016
https://www.microsoft.com/de-ch/download/details.aspx?id=49164
slmgr.vbs /ipk KMS-Key
slmgr /ato 98EBFE73-2084-4C97-932C-C0CD1643BEA7
Office 2019
https://www.microsoft.com/de-ch/download/details.aspx?id=57342
slmgr.vbs /ipk KMS-Key
slmgr /ato 70512334-47B4-44DB-A233-BE5EA33B914C
Office 2010 KMS Host Package 無法安裝在 Windows Server 2016 以上版本的解決:
執行後在 C:\Program Files (x86)\MSECache\OfficeKMS 取得 kms_host.vbs
修改後直行即可
Search: If (Ver(0) = "6" And Ver(1) >= "2") Or (Ver(0) >= "7") Then
Replace: If (Ver(0) = "6" And Ver(1) >= "2") Or (Ver(0) >= "7") Or (Ver(0) => "10") Then
slmgr.vbs /ipk KMS-Key
slmgr /ato
Office 2010
https://www.microsoft.com/en-us/download/confirmation.aspx?id=25095
slmgr.vbs /ipk KMS-Key
Office 2010: slmgr /ato BFE7A195-4F8F-4F0B-A622-CF13C7D16864
Office 2013
https://www.microsoft.com/de-ch/download/details.aspx?id=49164
slmgr.vbs /ipk KMS-Key
slmgr /ato 2E28138A-847F-42BC-9752-61B03FFF33CD
Office 2016
https://www.microsoft.com/de-ch/download/details.aspx?id=49164
slmgr.vbs /ipk KMS-Key
slmgr /ato 98EBFE73-2084-4C97-932C-C0CD1643BEA7
Office 2019
https://www.microsoft.com/de-ch/download/details.aspx?id=57342
slmgr.vbs /ipk KMS-Key
slmgr /ato 70512334-47B4-44DB-A233-BE5EA33B914C
Office 2010 KMS Host Package 無法安裝在 Windows Server 2016 以上版本的解決:
執行後在 C:\Program Files (x86)\MSECache\OfficeKMS 取得 kms_host.vbs
修改後直行即可
Search: If (Ver(0) = "6" And Ver(1) >= "2") Or (Ver(0) >= "7") Then
Replace: If (Ver(0) = "6" And Ver(1) >= "2") Or (Ver(0) >= "7") Or (Ver(0) => "10") Then
2019-01-30
IIS Reverse Proxy with HTTPS over SSL Cert + Auto Renew IIS Site Binding Let's Encrypt by Powershell
原本的網站沒有走 https 且很難處理
故利用前端 IIS + ARR 來做 Reverse Proxy with HTTPS over SSL Cert
後端的 Server 都不用動,只需要檢查原始碼將有寫 http 絕對連結的 html tag 改掉就好
這樣也可以將 https 加解密的 Loading 從 Web Server 移到 Reverse Proxy 這台來
方法很簡單,只要用 Binding Host Header 的方式掛上憑證就可以了
麻煩的是 Let's Encrypt 需要每三個月更新憑證
查了很久最後找到正確的語法並寫成 Powershell Script
$BindingURL 是憑證的主要名稱
$PublishedURLs 是陣列,填入 IIS Site 所 Binding 的多個 Host Header
*. Let's Encrypt 有提供用一張憑證包含多個 Alternative FQDN 的功能
**. 如果你的憑證存放在 Personal 容器中
就搜尋 Cert:\LocalMachine\WebHosting
改成 Cert:\LocalMachine\My
故利用前端 IIS + ARR 來做 Reverse Proxy with HTTPS over SSL Cert
後端的 Server 都不用動,只需要檢查原始碼將有寫 http 絕對連結的 html tag 改掉就好
這樣也可以將 https 加解密的 Loading 從 Web Server 移到 Reverse Proxy 這台來
方法很簡單,只要用 Binding Host Header 的方式掛上憑證就可以了
麻煩的是 Let's Encrypt 需要每三個月更新憑證
查了很久最後找到正確的語法並寫成 Powershell Script
$BindingURL 是憑證的主要名稱
$PublishedURLs 是陣列,填入 IIS Site 所 Binding 的多個 Host Header
*. Let's Encrypt 有提供用一張憑證包含多個 Alternative FQDN 的功能
**. 如果你的憑證存放在 Personal 容器中
就搜尋 Cert:\LocalMachine\WebHosting
改成 Cert:\LocalMachine\My
2019-01-19
Dino Line@ API System Version 2.0 Demo
以下文章為 Demo 影片的備忘搞,可以直接觀看影片:
https://youtu.be/ovm9YfX8Z4k (建議使用 1.5x 倍速播放)
今天要來跟大家介紹最近在開發的 Line@ 生活圈 Message API 系統
有在接觸 Chat BOT 聊天機器人或是訊息傳遞行銷的人應該知道這是什麼,就不多做解釋,今天只對於我開發中的系統作介紹
首先來瞭解一下 Line@ 生活圈的方案
最便宜的方案每個月 798,可以用廣播訊息和一對一聊天功能,沒有分眾群發訊息的功能
當然如果多付一點錢的話你可以有目標群眾的群發功能
但是只能依照 Line 官方提供的性別、年齡層、手機系統是 Android 或 iOS、職業等等來分類
不能依照自己經營的情況將用戶分組
http://at-blog.line.me/tw/feature/targetingmessage-sp.html
如果你想要經營一種有區分會員等級之類的平台,當你要發訊息給某特定 100 個人的時候
你就必須要用一對一交談功能發 100 次,萬一你想發訊息又想發圖片的話,就得發 200 次,因為文字訊息跟圖片訊息得分開發
那你如果發現剛剛的訊息需要更正或補充的話,就要再發 100 次
http://at-blog.line.me/tw/messaging_api_intro
https://youtu.be/ovm9YfX8Z4k (建議使用 1.5x 倍速播放)
今天要來跟大家介紹最近在開發的 Line@ 生活圈 Message API 系統
有在接觸 Chat BOT 聊天機器人或是訊息傳遞行銷的人應該知道這是什麼,就不多做解釋,今天只對於我開發中的系統作介紹
首先來瞭解一下 Line@ 生活圈的方案
最便宜的方案每個月 798,可以用廣播訊息和一對一聊天功能,沒有分眾群發訊息的功能
當然如果多付一點錢的話你可以有目標群眾的群發功能
但是只能依照 Line 官方提供的性別、年齡層、手機系統是 Android 或 iOS、職業等等來分類
不能依照自己經營的情況將用戶分組
http://at-blog.line.me/tw/feature/targetingmessage-sp.html
如果你想要經營一種有區分會員等級之類的平台,當你要發訊息給某特定 100 個人的時候
你就必須要用一對一交談功能發 100 次,萬一你想發訊息又想發圖片的話,就得發 200 次,因為文字訊息跟圖片訊息得分開發
那你如果發現剛剛的訊息需要更正或補充的話,就要再發 100 次
http://at-blog.line.me/tw/messaging_api_intro
2018-12-17
取得 Hyper-V Host 上 VM 的 CPU、Memory、HDD Size 等基本資訊
取得 Hyper-V Host 上 VM 的 CPU、Memory、HDD Size 等基本資訊
$VMs = Get-VM
$Result = "Hyper-V Host,VM Name,CPU Count,Mem Min (MB),Mem Max (MB),HDD Path,HDD FileSize (MB),HDD Size (MB)`r`n";
foreach ($VM in $VMs) {
$CPU = $VM | Get-VMProcessor
$Mem = $VM | Get-VMMemory
$HDDs = $VM | Select-Object VMId | Get-VHD | select path,filesize,size
foreach ($HDD in $HDDs) {
$Result += $env:computername+","+$VM.Name+","+$CPU.Count+","+$Mem.Minimum/1024/1024+","+$Mem.Maximum/1024/1024+","+$HDD.path+","+$HDD.filesize/1024/1024+","+$HDD.size/1024/1024+"`r`n";
};
};
$Result | Out-File -filepath "$env:computername VMs.txt"
$VMs = Get-VM
$Result = "Hyper-V Host,VM Name,CPU Count,Mem Min (MB),Mem Max (MB),HDD Path,HDD FileSize (MB),HDD Size (MB)`r`n";
foreach ($VM in $VMs) {
$CPU = $VM | Get-VMProcessor
$Mem = $VM | Get-VMMemory
$HDDs = $VM | Select-Object VMId | Get-VHD | select path,filesize,size
foreach ($HDD in $HDDs) {
$Result += $env:computername+","+$VM.Name+","+$CPU.Count+","+$Mem.Minimum/1024/1024+","+$Mem.Maximum/1024/1024+","+$HDD.path+","+$HDD.filesize/1024/1024+","+$HDD.size/1024/1024+"`r`n";
};
};
$Result | Out-File -filepath "$env:computername VMs.txt"
2018-12-06
利用 Firebase Javascript PHP 做訊息推播
利用 Firebase Javascript PHP 做訊息推播
以下為簡單 Code
測試環境為 Apache with Let's Encrypt SSL 網站,不確定沒 SSL 能不能運作
*. 還在研究怎麼對離線 Device 補傳訊息(應該有這個方法)
首先到 Firebase 網站 https://console.firebase.google.com/ 新增專案
專案名稱自取,建立好之後點選【專案設定】
2018-11-05
Apach Web Server 限制存取 IP
<Directory "D:/WebSite/www.contoso.com">
Options FollowSymLinks
AllowOverride All
Order Deny,Allow
Deny From All
Allow From 192.168.0.0/24 192.168.1.0/24 192.168.2.0/24
</Directory>
2018-10-01
Veeam 備份 Replicated VMs 時遇到的問題與迂迴的解決辦法
朋友使用 Veeam Backup & Replication 做 Hyper-V 的 VM 備份, 卻遇到了一個解不開的問題
先說他的備份環境大致是這樣:「所有 Production 的 Hyper-V Hosts 先將 VM Replica 到一台肚子超大的 Server 裡, 然後再用 Veeam 去備份這些副本 VM」
聽起來這個策略沒什麼問題, 在副本 Host 上備份根本理所當然, 不會去影響到 Production 的效能
但當備份到容量較大的 VM, 尤其是 SQL Server 的時候卻產生了問題
Full Backup 時總會遇到以下錯誤:
Processing Mercury Error: Failed to call wmi method 'DestroySnapshot'. Wmi error: '32775' Failed to delete VM snapshot, snapshot path '%2'.
Failed to create VM recovery checkpoint (mode: Crash consistent) Details: Failed to call wmi method 'CreateSnapshot'.
Wmi error: '32775' Failed to create VM recovery snapshot,VM ID 'ooooooooooooooooooo'.
Retrying snapshot creation attempt (Failed to create production checkpoint.)
Task has been rescheduled
Queued for processing at [Date Time]
Unable to allocate processing resources. Error: Failed to call wmi method 'CreateSnapshot'.
Wmi error: '32775' Failed to create VM recovery snapshot, VM ID 'ooooooooooooooooooo'.
在備份的 Repository 裡面的確有看到 vbk 檔案, 看起來很像有備份成功
但上述錯誤發生後該 VM 會卡在 Applying Changes, 後續複寫則全部失敗
且 Hyper-V Virtual Machine Management Service 無法 Stop, 重開機指令下去後要等待兩小時左右才能重開機成功
一步一步來, Workaround 的方式如下:
先說他的備份環境大致是這樣:「所有 Production 的 Hyper-V Hosts 先將 VM Replica 到一台肚子超大的 Server 裡, 然後再用 Veeam 去備份這些副本 VM」
聽起來這個策略沒什麼問題, 在副本 Host 上備份根本理所當然, 不會去影響到 Production 的效能
但當備份到容量較大的 VM, 尤其是 SQL Server 的時候卻產生了問題
Full Backup 時總會遇到以下錯誤:
Processing Mercury Error: Failed to call wmi method 'DestroySnapshot'. Wmi error: '32775' Failed to delete VM snapshot, snapshot path '%2'.
Failed to create VM recovery checkpoint (mode: Crash consistent) Details: Failed to call wmi method 'CreateSnapshot'.
Wmi error: '32775' Failed to create VM recovery snapshot,VM ID 'ooooooooooooooooooo'.
Retrying snapshot creation attempt (Failed to create production checkpoint.)
Task has been rescheduled
Queued for processing at [Date Time]
Unable to allocate processing resources. Error: Failed to call wmi method 'CreateSnapshot'.
Wmi error: '32775' Failed to create VM recovery snapshot, VM ID 'ooooooooooooooooooo'.
在備份的 Repository 裡面的確有看到 vbk 檔案, 看起來很像有備份成功
但上述錯誤發生後該 VM 會卡在 Applying Changes, 後續複寫則全部失敗
且 Hyper-V Virtual Machine Management Service 無法 Stop, 重開機指令下去後要等待兩小時左右才能重開機成功
一步一步來, Workaround 的方式如下:
- 遇到問題後先將 Hyper-V Virtual Machine Management Service 改為手動啟動, 不要讓他開機自動啟動
- Stop Hyper-V Virtual Machine Management Service
- 下指令 taskkill /f /im vmms.exe 將 Process Kill 掉
- 重開機就不需要等兩小時
- 開好機後在 net start vmms 指令之後緊接著快速地連續下達以下指令
Get-VM "YourVMName" | Get-VMCheckpoint -SnapshotType Recovery | Remove-VMCheckpoint - 步驟 5 最好是多開幾個視窗, 連續下指令, 錯誤沒關係, 就怕來不及, VM 又進入了卡在 Apply Changes 的狀態
- 這樣做完後可以至少將 VM 的狀態復原, 後續再嘗試備份
2018-09-30
Line@ BOT Login / Messaging API with Apache / PHP / MySQL System
這陣子對 Line@ 生活圈有興趣
試用後發現不能自己將某些人設為一個群組, 只對這些人發訊息
只能廣播給所有加入 Line@ 好友的人
或是付更多費用取得分眾發訊的功能
但該功能似乎只能針對性別、年齡等資訊去分, 依然不能自己設群組廣播
於是興起了自己寫後台的想法
目前開發完成的功能:
1. 將在 Line@ 申請好的 Channel 資訊填入即可建立 BOT
2. 具有 Log 功能, 可將 1on1、Room、Group 的對話全部 Log 下來, 包含文字、圖片、音訊、視訊、檔案、地點等等
3. 可打開 Chat Window 進行對話
4. Chat Window 會自動 Refresh 取得最新訊息
*. 收到 Line Official Event 會檢查 HTTP header 確認身份, 也會驗證 Json 的簽章, 安全性檢查無虞
試用後發現不能自己將某些人設為一個群組, 只對這些人發訊息
只能廣播給所有加入 Line@ 好友的人
或是付更多費用取得分眾發訊的功能
但該功能似乎只能針對性別、年齡等資訊去分, 依然不能自己設群組廣播
於是興起了自己寫後台的想法
目前開發完成的功能:
1. 將在 Line@ 申請好的 Channel 資訊填入即可建立 BOT
2. 具有 Log 功能, 可將 1on1、Room、Group 的對話全部 Log 下來, 包含文字、圖片、音訊、視訊、檔案、地點等等
3. 可打開 Chat Window 進行對話
4. Chat Window 會自動 Refresh 取得最新訊息
*. 收到 Line Official Event 會檢查 HTTP header 確認身份, 也會驗證 Json 的簽章, 安全性檢查無虞
訂閱:
文章 (Atom)

