2016-10-24

Software List (Enhanced Version) Create DB View


/******************************************************************************/

USE [Info]
GO

/****** Object:  View [dbo].[ASMA]    Script Date: 10/24/2016 10:29:40 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ASMA]'))
DROP VIEW [dbo].[ASMA]
GO

/****** Object:  View [dbo].[ASMA]    Script Date: 10/24/2016 10:29:40 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

Software List (Enhanced Version) Create DB Table

USE [Info]
GO

/****** Object:  Table [dbo].[ARPTable]    Script Date: 10/24/2016 10:28:29 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ARPTable]') AND type in (N'U'))
DROP TABLE [dbo].[ARPTable]
GO

/****** Object:  Table [dbo].[ARPTable]    Script Date: 10/24/2016 10:28:29 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ARPTable](
[Serial] [int] IDENTITY(1,1) NOT NULL,
[DateTime] [datetime] NOT NULL,
[HostName] [nvarchar](max) NOT NULL,
[IPAddress] [nvarchar](15) NOT NULL,
[MACAddress] [nvarchar](17) NOT NULL,
[Checked] [int] NOT NULL CONSTRAINT [DF_ARPTable_Checked]  DEFAULT ((0)),
 CONSTRAINT [PK_ARPTable] PRIMARY KEY CLUSTERED
(
[Serial] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

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"