2019-10-24

Windows 清除剪貼簿中已複製 (Control-C) 的內容

建立一個捷徑
內容為:

C:\Windows\System32\cmd.exe /c echo off | clip

或著可以加入滑鼠右鍵選單
以下為註冊機碼,可存成 ClearClip.reg 直接註冊


2019-09-17

Line Notify 發訊 with PHP


流程:
  1. 使用者必須先將 Line Notify 加入為好友
  2. 使用者瀏覽一個網頁,網頁中告知【點擊這裡】將您的帳號與 Line Notify 的本服務連結
  3. 瀏覽器導向 Line Notify 網站
  4. 使用者點擊後登入 Line 帳號並選擇要連結的聊天室或 1 對 1 聊天室
  5. Line Notify 網站 Call Back 回你的網站並交付 Access Token
  6. 使用該 Access Token 向 User Push Message

2019-05-09

使用 Let's Encrypt 來作為 VDI - RDCB 憑證時更新 GPO 派送 Thumbprints 的處理

連接 RemoteAPP 或 VM 的時候會跳出以下訊息
A website is trying to run a RemoteApp Program. Make sure that you trust the publisher before you connect to run the program
This Remoteapp program could harm your local or remote computer.



已知這個必須以 GPO 派送 RDCB 憑證的 Thumbprints
GPO 設定路徑如下:
Windows Components\Remote Desktop Services\Remote Desktop Connection Client
>> Specify SHA1 thumbprints of certificates representing trusted .rdp publishers
但要使用 Let's Encrypt 這種兩、三個月就要更換一次憑證的免費方案的話
還要手動更新 GPO 設定中的指紋太麻煩了,於是找到相關的 PowerShell 指令可以用

搭配服用: 使用 PowerShell 自動佈署基於 Let's Encrypt 公開憑證的 Microsoft RDS (VDI/RemoteApp) 環境

2019-05-08

Step-by-Step Guide for upgrading SYSVOL replication to DFSR (Distributed File System Replication)

以下文章非本人撰寫,僅為預防出處網頁有一天不存在而轉載
This Article is not written by myself.
Just a backup in case of the original one might be offline someday.
All credit goes to http://www.rebeladmin.com

Origin URL:
http://www.rebeladmin.com/2015/04/step-by-step-guide-for-upgrading-sysvol-replication-to-dfsr-distributed-file-system-replication/

SYSVOL is a folder shared by domain controller to hold its logon scripts, group policies and other items related to AD. All the domain controllers in network will replicate the content of SYSVOL folder. The default path for SYSVOL folder is %SystemRoot%\SYSVOL. This folder path can define when you install the active directory.

Windows Server 2003 and 2003 R2 uses File Replication Service (FRS) to replicate SYSVOL folder content to other domain controllers. But Windows server 2008 and later uses Distributed File System (DFS) for the replication.  DFS is more efficient than FRS. Since windows server 2003 is going out of support, most people already done or still looking for migrate in to latest versions. However migrating FSMO roles WILL NOT migrate SYSVOL replication from FRS to DFS. Most of the engineers forget about this step when they migrate from windows 2003 to new versions.

For FRS to DFS migration we uses the Dfsrmig.exe utility. More info about it available on https://technet.microsoft.com/en-au/library/dd641227(v=ws.10).aspx

2019-03-30

Chrome 的 Command Mode (--headless) 進行 ScreenShot

遇到一個問題
使用 Chrome 的 Command Mode (--headless) 進行 ScreenShot 指令如下:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --headless --disable-gpu --run-all-compositor-stages-before-draw --aggressive-cache-discard --disable-notifications --disable-remote-fonts --disable-reading-from-canvas --disable-remote-playback-api --disable-shared-workers --disable-voice-input --enable-aggressive-domstorage-flushing --window-size=1024,768 --screenshot="C:\Temp\ScreenShot.png" "https://www.google.com"

這個指令在 cmd 視窗直接執行時沒有問題,可以取得圖檔
但是如果放到 Task Scheduler 裡面跑的時候卻無法取得圖檔

由於不知道怎麼查 Chrome 的 Log ,所以先朝打開 Log 著手
在以下網站查到了怎麼開 Log

2019-03-28

PHP Webhook API Close Connection

Webhook API 一般希望在接收連線資料後盡速將連線中斷再去執行後面的其他運算
實際運作可以這樣:
1. 先回應 200 ok
2. 取得 HTTP header
3. 取得送來的資料
4. 斷線
後面再去做資料運算
程式碼這樣寫

2019-03-08

Hidden / Disable items in Windows 10 Settings App

微軟想用 Settings App 取代 Control Pannel
其中的一些設定項目必須用以下方式在 GPO 中設定才能隱藏起來


  1. Open the Local Group Policy Editor and then go to Computer SettingsAdministrative Templates, and then Control Panel.
  2. Double-click the Group Policy Settings Page Visibility option and then select Enable.
  3. Depending on your need, specify either a ShowOnly: or Hide: string.
    If you want to only show only Proxy and Ethernet, the string would be as follows:
    ShowOnly:Network-Proxy;Network-Ethernet
    Hide:Network-Proxy;Network-Ethernet
To determine the URI of a Settings app page, look up the URI on the ms-settings: URI scheme reference page.

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