2016-10-24

Software List (Enhanced Version) Load into DB

'On Error Resume Next

SourcePath = "D:\Info\Data"

GapString = "=====Gap====="
InfoString = "=====Info====="

DebugMode = 0

SQLServer="127.0.0.1"
SQLUser="Info"
SQLPassword="password"
SQLDB="Info"
SQLConnectionTimeout = 600

DonnotKeepOSLastBootUpTime = 1

Software List (Enhanced Version)


' ----- 參數設定開始 -----

ADDomain = "Contoso"
TargetFilePath = "\\FileServer\Info$\Data\*.dbd"
GapString = "=====Gap====="
InfoString = "=====Info====="

' 除厝模式: (派送用戶端執行應設為 0)
' 0: 不顯示訊息
' 1: 顯示錯誤訊息
DebugMode = 0

' 資料取得方式 (此參數會在 DB Record 中註記):
' 1: Local - Client Push 檔案給 Server 讀取
' 2: Remote - Server 主動連線取得資料產生檔案
InfoDataType = 1

' 如果資料取得方式是 2: Server 主動連線取得資料產生檔案
' 此處給予客戶端有可能使用的管理員帳號密碼
AuthUserNameString = ""
AuthPasswordString = ""

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

2016-09-30

Bash Script for Linux to Connect to Microsoft VDI

Script by Dino9021

因為 Remmina 一定要記住 User Name & Password 才能連線
有安全上的疑慮, 因此利用 Bash Script 搭配 xfreerdp 來進行連線作業

需要將連線資源寫成文字檔放在 Web Server 上讓 Bash Script 去下載解讀
如此如果資源有異動, 就不需要去 Client 更換 Script, 只要修改 Web Server 上的資源檔案就行了
而且如此一來不需要安裝 Remmina, 只要有 xfreerdp 就可以用了
經過測試, 如果不裝 Remmina 的話 xfreerdp 無法裝到 2.0 以上版本 (才支援 RDG)

安裝時參考 Microsoft 2012 R2 VDI 攻略 中 ubuntu 的安裝方法


  • Install Remmina and FreeRDP to Connect to VDI Through RD Gateway
    • sudo apt-get update
    • sudo apt-get dist-upgrade
    • sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
    • sudo apt-get update
    • sudo apt-get install freerdp-x11 remmina remmina-plugin-rdp
    • sudo apt-get upgrade
    • xfreerdp --version


2016-09-21

Ubuntu Upgrade Remmin

sudo apt-get purge --auto-remove freerdp-x11 remmina remmina-common remmina-plugin-rdp remmina-plugin-vnc remmina-plugin-gnome remmina-plugin-nx remmina-plugin-telepathy remmina-plugin-xdmcp

sudo apt-get update
sudo apt-get install software-properties-common

sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
sudo apt-get update
sudo apt-get install freerdp-x11 remmina remmina-plugin-rdp

sudo apt-get install freerdp-x11 remmina remmina-plugin-rdp remmina-common remmina-plugin-vnc remmina-plugin-gnome remmina-plugin-nx remmina-plugin-telepathy remmina-plugin-xdmcp

sudo apt-get upgrade
xfreerdp --version

sudo apt-get dist-upgrade

2016-07-15

Trust relationship has been lost with domain controller

Trust relationship has been lost with domain controller

當電腦與網域失去信任時不要急著退出網域再重新加入,
先在失去信任的那台電腦上試試看這個 PowerShell 指令:


Create Drive D Partition for VDI Pooled VM User Profile Desk

在部署 VDI Pooled VM 時, User 只有 User Profile 可以儲存資料檔案, 或者存放到 UNC Path 的 File Server
在許多情況下 User 會抱怨沒有 Drive D 能存放資料很不習慣, 在使用上也會有 File Server 連線速度較慢的問題
此時我們可以應變的方式為將 User Profile Disk Expand 後提供一個 Partition 給 User 使用
做法是先將 User Profile Disk 利用 Hyper-V 的 Edit Disk 功能 Expand
如果建立 User Profile Disk 時給予的容量限制是 1G, 那麼預設 User Profile Disk: UVHD-template.vhdx 就只有一個 1G 的 Partition
如果要給 User 5G 的 Drive D 空間, Expand 時請填入 1+5=6G 的磁碟大小
如此一來 User Profile Disk 就變成一個 6G 的 Disk, 而磁碟的開頭處有一個 1G 的 Partition 作為 User Profile 使用
後面有一個 5G 的未分割空間

那麼接下來要如何把這 5G 的空間建立 Partition 給 User 使用呢?
我們要利用到 AutoIT 與 VBScript, 請參考以下程式

2016-05-25

用批次檔 (Batch) 刪除指定天數之前 (過期) 所有子目錄及檔案

echo "Deleting old files ..."
forfiles /p D:\Temp /d -14 /c "cmd /c del /f /s /q @file"
echo "Deleting old directories ..."
forfiles /p D:\Temp /d -14 /c "cmd /c rd /s /q @file"

2015-12-25

VDI Shadow Remote Control Select (With SQL DB)

看這篇文章前先參考前一篇開頭的說明
http://blog.dino9021.com/2015/12/vdi-shadow-control-rdcb-remote-desktop.html

由於遠端執行 PowerShell Get-RDUserSession 指令需要開的權限太多太複雜
一直搞不出來, 於是決定山不轉路轉, 將 RDCB DB 從 Windows Internal Database 搬到 SQL Server 來 Query [備註]
用 SQL Server 的方式 Query 速度比 Get-RDUserSession 快非常多, 還有可做 HA 的彈性
好處非常多, 非常推薦大家都改用 SQL Server, 真心不騙

這隻程式用來列出目前 RDCB SQL DB 上記載的 Remote Desktop Session 供選擇 Shadow 控制
可簡化遠端協助的步驟, 並可 Shadow Windows 10 Client
(Windows Server 2012 R2 RDCB 目前以 Server Manager 無法 Shadow 至 Windows 10 Client)

執行本 PowerShell Script 的帳號必須具有連線目的 Client 的本機管理員權限
以及連線至 RDCB SQL Server 與讀取 RDCB DB 的權限 (詳細權限容後敘述)

有關 Prompt User 的相關說明及設定參考以下連結
https://blogs.technet.microsoft.com/askperf/2013/10/22/windows-8-1-windows-server-2012-r2-rds-shadowing-is-back/

2016.12.01 Update: 撈出 Pooled VM 所屬 RDVH Server Name

執行時範例圖片:

2015-12-24

VDI Shadow Remote Control Select (Pure Powershell)

這隻程式用來列出目前 RDCB 上記載的 Remote Desktop Session 供選擇 Shadow 控制
可簡化遠端協助的步驟, 並可 Shadow Windows 10 Client
(Windows Server 2012 R2 RDCB 目前以 Server Manager 無法 Shadow 至 Windows 10 Client)

執行的電腦必須安裝有 Remote Desktop Service Power Shell Module
執行本 PowerShell Script 的帳號必須具有連線目的 Client 的本機管理員權限

有關 Prompt User 的相關說明及設定參考以下連結
https://blogs.technet.microsoft.com/askperf/2013/10/22/windows-8-1-windows-server-2012-r2-rds-shadowing-is-back/