2019-03-05

踩雷系列: Windows Server 2019 網卡設定 發生錯誤: Windows cannot access the specified device path or file

新式的設定視窗中

Settings -> Ethernet -> Change adapter options

顯示:

Windows cannot access the specified device, path or file. You may not have the appropriate permission to access the item.

















事實上如果開檔案總管自己輸入 Control Pannel 到舊式的網卡設定是沒問題的

解決辦法參考:

2019-02-27

Install SQL on Server Core

先用 Standard / Enterprise 版產生 ConfigurationFile.INI
*. Express 版本安裝 GUI 沒有一個 (Ready to Install 的步驟可以停下來產生 .ini 檔)
取得 ConfigurationFile.INI 後進行以下變更


有關磁碟機 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

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

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

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

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"

2018-12-06

利用 Firebase Javascript PHP 做訊息推播


利用 Firebase Javascript PHP 做訊息推播

以下為簡單 Code
測試環境為 Apache with Let's Encrypt SSL 網站,不確定沒 SSL 能不能運作

*. 還在研究怎麼對離線 Device 補傳訊息(應該有這個方法)



首先到 Firebase 網站 https://console.firebase.google.com/ 新增專案
專案名稱自取,建立好之後點選【專案設定】


中下方點擊: 【將 Firebase 加入您的網路應用程式】

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>