File Server 雖是儲存空間,但也不必要永久存放,如果已經進磁帶備份後,很多參考用的大檔案是可以刪除的。
研究了一下 VBScript 自動刪除的機制,將下面的.vbs File 加到Server 的Schedule Tasks ,再加上絕對路徑當參數,就可以自動刪除了。
------------------ 以下作成一個 delFolderFilesOverThan60days.vbs --------
' 指定所有變數必須事先宣告才能使用
Option Explicit
' 宣告變數
Dim FSO, agoDays, modifiedDate, delFolder ,myArgs
'If WScript.arguments.length <> 0 Then
' WScript.quit
'End If
' 建立檔案系統物件(File System Object)
Set FSO = CreateObject("Scripting.FileSystemObject")
' 請將下面的變數值換成你要的
' 指定 n 天前的檔案,現在是 3 天前
agoDays = 60
' 取得檔案的修改日期
modifiedDate = DateAdd("d", -agoDays, Date)
Set myArgs = WScript.arguments
' 欲刪除檔案所在之目錄
delFolder = myArgs(0)
' 呼叫刪除檔案的子程序
DelFilesInFolder FSO.GetFolder(delFolder)
' 刪除檔案的子程序
Sub DelFilesInFolder(folder)
' 宣告變數
Dim file, subFolder
' 找出目前所在目錄內所有的檔案
For Each file In folder.Files
' 檢查檔案日期是否符合條件,若符合,就刪除
If ((file.DateLastModified <= modifiedDate)) Then
file.delete
End If
Next
' 如果遇到子目錄,也要進去檢查並刪除
For Each subFolder in folder.SubFolders
DelFilesInFolder subFolder
Next
End Sub
'WScript.Echo("作業執行完畢:" & Date & " " & Time)
----------------------------------
程式的參考出處:
http://ithelp.ithome.com.tw/question/10009001
http://ithelp.ithome.com.tw/question/10058183
2012年1月19日 星期四
2011年12月27日 星期二
新建的MSSQL無法用SA登入
今天測試MS SQL時,一直無法順利登入,應該沒打錯呀..
檢查:
1. 使用Windows Authentication 登入,發現sa 圖示有向下箭頭,按右鍵屬性改為Enable.
2. 再試仍無法登入,錯誤為:Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)
Search 登入失敗的錯誤訊息,發現是MS SQL ->Server 屬性-> Security -> Server Authentication 的地方,指定使用"Windows Authentication mode",改為"SQL Server and Windows Authentica mode" 即可.
檢查:
1. 使用Windows Authentication 登入,發現sa 圖示有向下箭頭,按右鍵屬性改為Enable.
2. 再試仍無法登入,錯誤為:Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)
Search 登入失敗的錯誤訊息,發現是MS SQL ->Server 屬性-> Security -> Server Authentication 的地方,指定使用"Windows Authentication mode",改為"SQL Server and Windows Authentica mode" 即可.
2011年12月18日 星期日
2011 台北富邦馬拉松(2011-12-18)
2011 台北富邦馬拉松: 超多人
隨手拍了一些特別的..
穿著原民服飾的超熱情加油者
據說是某日企老闆.. 雖然天氣涼爽, 但是穿著密不通風的忍者裝, 也著時讓人佩服..感謝台灣人對日本東北及311地震捐助的大和女子
穿什麼鞋最好呢? Nike / Addias ... NO! 穿室內拖最厲害..
超有元氣的靓妹加油團
靓妹加油團二
2011年12月14日 星期三
LotusScript 與Formula結合時,| (Vertical bar) 發揮大功用.
每當純用LotusScript 來做類似@DBColumn 或@DBLookup動作時就覺得很不好寫..
比如:
Search "Ref001" view的第一個Column 的動作
要先Search 出所有Document,取得第一筆, 取出第一個Column的欄位值到暫存列, 過慮是否重複,再取下一筆, 最後再排序.... ,往往一行@DBColumn 的動作,就要寫很久..
但其實 LotusScript 是可以結合 Formula 的, 只要透過Evaluate 及 | (Vertical bar) .
Formula 寫法如下: @DbColumn("":"NoCache";"":"";"REF001";1)
在 LotusScript 寫時, 一行只能出現兩個雙引號("), 如果套用有些語言處理雙引號的方法是在前面加上反斜線( \ ), 這會讓閱讀性大幅降低.
以LotusScript的作法是使用 | 來夾 ,經由 | 夾起來後, 不管多少個雙引號都視為字串, 可方便的加上變數.
Formula 的寫法改寫為LotusScript 也只要兩~三行即可完成:
Dim vrColumn As Variant , tmpstr as string
tmpstr = mailto:%7C@DbColumn(%22%22:%22NoCache";"| +db.Server+ |":"|+Ct_Replace(db.FilePath,"\","file://%22)+%7c%22;%22ref001%22;1/)|
varColumn = Evaluate(tmpstr)
排序也只要在@Sort 加到@DBColumn前即可.
有的人堅持LotusScript 就是要只用LotusScript , 寫Formula 就是 Low, 但我覺得方便性及可讀性最重要..不一定寫的最多行就是最厲害.
比如:
Search "Ref001" view的第一個Column 的動作
要先Search 出所有Document,取得第一筆, 取出第一個Column的欄位值到暫存列, 過慮是否重複,再取下一筆, 最後再排序.... ,往往一行@DBColumn 的動作,就要寫很久..
但其實 LotusScript 是可以結合 Formula 的, 只要透過Evaluate 及 | (Vertical bar) .
Formula 寫法如下: @DbColumn("":"NoCache";"":"";"REF001";1)
在 LotusScript 寫時, 一行只能出現兩個雙引號("), 如果套用有些語言處理雙引號的方法是在前面加上反斜線( \ ), 這會讓閱讀性大幅降低.
以LotusScript的作法是使用 | 來夾 ,經由 | 夾起來後, 不管多少個雙引號都視為字串, 可方便的加上變數.
Formula 的寫法改寫為LotusScript 也只要兩~三行即可完成:
Dim vrColumn As Variant , tmpstr as string
tmpstr = mailto:%7C@DbColumn(%22%22:%22NoCache";"| +db.Server+ |":"|+Ct_Replace(db.FilePath,"\","file://%22)+%7c%22;%22ref001%22;1/)|
varColumn = Evaluate(tmpstr)
排序也只要在@Sort 加到@DBColumn前即可.
有的人堅持LotusScript 就是要只用LotusScript , 寫Formula 就是 Low, 但我覺得方便性及可讀性最重要..不一定寫的最多行就是最厲害.
2011年12月11日 星期日
Sharepoint 2010 的"要求存取(Request access)"在那兒改?
Sharepoint 2010 針對您沒權限時, 延續已往提供的"要求存取(Request Access)"功能, 可以很方便的以E-Mail 方式通知網站管理者, 預設網站管理者為"主要管理員", 一般是設administrator , 因此Email 通知會是 mailto:administrator@%3Cdomain name>, 但是通常管理網站權限的是"次要管理員", 這時就需要變更"要求存取"的通知對象:
登入網站 Site => 網站動作(Site Actions)=>網站設定(Site Settings)=>網站權限(Site Permissions)=>設定=>存取要求(Manage Access Requests)=>勾選"允許存取申請"(Allow requests for access)並修正傳送存取的Email Address.
登入網站 Site => 網站動作(Site Actions)=>網站設定(Site Settings)=>網站權限(Site Permissions)=>設定=>存取要求(Manage Access Requests)=>勾選"允許存取申請"(Allow requests for access)並修正傳送存取的Email Address.
2011年11月28日 星期一
PowerPoint Web App 時發生錯誤。請稍後再試。
Sharepoint 2010 於網頁瀏覽檔案時,點選"Edit in Browser"時,出現「PowerPoint Web App 時發生錯誤。請稍後再試。」的錯誤訊息。
查找的結果如下,須安裝Hotfix 套件:
http://support.microsoft.com/kb/2553919/zh-tw
但我先在測試環境測試結果,出現英文的錯誤訊息如下:「PowerPoint Web App encountered an error. Please try again.」,經測試環境的驗證發現,是Powerpoint 的Service Application Pool & Proxy 未建立。
依照下面參考文件(http://technet.microsoft.com/en-us/library/hh269604.aspx)的:
查找的結果如下,須安裝Hotfix 套件:
http://support.microsoft.com/kb/2553919/zh-tw
但我先在測試環境測試結果,出現英文的錯誤訊息如下:「PowerPoint Web App encountered an error. Please try again.」,經測試環境的驗證發現,是Powerpoint 的Service Application Pool & Proxy 未建立。
依照下面參考文件(http://technet.microsoft.com/en-us/library/hh269604.aspx)的:
End users cannot view or edit Office 2010 documents in the browser 階段的說明進行設定,即可排除問題:
- 1. 確認 Excel Calculation Services,PowerPoint Service, and Word Viewing Service exist and are startedService 已啟動: Central Administration Web site => Application Management => Manage services on server.
- 2. 確認 Office Web Apps service applications and proxies 已建立。
- Application Management => Manage service applications. => 確認applications已存在:
- Excel Services Application Web service application
- PowerPoint service application
- Word Viewing service application
- 3. 確認三個依存的Proxy group 已存在。
- 4. 確認存取權限,參閱說明。
2011年11月16日 星期三
Lync 跨Domain Federation 的設定方法
Lync 跨Domain 需有幾個條件:
1. 部屬Edge Server:與其他Domain 界接
2. 外部DNS 有SRV Record: _sipfederationtls._tcp.<domain name> 為 <edge server fqdn>, port 5061
3. 與公眾Provider (MAN/Yahoo等)界接,需花錢更換Edge Server的憑證為外部合法的憑證
4. 購買合法的License
測試環境說明:
1. 兩個沒有Trust 的Domain:domainA.com 及domainB.com
2. Edge Server FQDN為:Exedge-sip.domainA.com 及exedge-sip.domainB.com
3. DNS SVR Record :
DomainA的SVR Record : _sipfederationtls._tcp.domainA.com 為exedge-sip.domainA.com
DomainB的SVR Record : _sipfederationtls._tcp.domainB.com 為exedge-sip.domainB.com
4. 雙方Root CA憑證
步驟:
1. 將Root CA憑證安裝到對方Domain 的Edge Server上:登入Exedge-sip.domainA.com =>mmc=>新增崁入式單元:"憑證Certificate"=>增加My user account & Computer account (local) => 匯入另一個Domain 的Root CA,出現在Certificates-Current user 的Intermediate Certificate Authorities -> Certificates內=> Copy到 Certificate(Local Computer)的Trusted Root Certification Authorities->Certificates內。
2. 另一個DomainB的Exedge-sip.domainB.com 匯入DomainA的Root CA。
3. 設定Feredated Domains : 於DomainA 的Front End Server 上開啟Lync Server Control Panel => External User Access => 1) External Access Policy : Enable communications with federated user. 2)Access Edge Configuration : Enable federation & Enable partner domain discovery. 3)Federated Domains : New => Allowed domain => Domain name : domainB.com => Access Edge Service : exedge-sip.domainB.com.
4. 同樣的,DomainB 也設定DomainA的Exedge-sip.domainA.com 為domainA.com 的 Edge Server .
未能正常連線的測試:
1. 驗證是否能正確查詢對方的SRV:
1) nslookup - 8.8.8.8
2) set type=srv
3) _sipfederationtls._tcp.domainA.com
2. 啟用Lync Client 的Log機制:
1) lync 選項=>一般=>紀錄=>勾選:在Lync中開啟紀錄
2) Lync重新啟動=>登入
3) 輸入另一個Domain 的Uuser : user1@domainA.com
4) 檢查Log : C:\Documents and Settings\<user name>\Tracing\Communicator-uccapi-0.uccapilog
5) 查詢 "ms-diagnostics",確認"reason"的錯誤原因。
相關參考文件:
1. http://ucworld.blog.51cto.com/811917/499165
2. 用Google 查ms-diagnostics的錯誤訊息
3. http://www.shudnow.net/2011/02/01/lync-2010-edge-utilizing-windows-server-2008-r2-federation-tls-issues/
1. 部屬Edge Server:與其他Domain 界接
2. 外部DNS 有SRV Record: _sipfederationtls._tcp.<domain name> 為 <edge server fqdn>, port 5061
3. 與公眾Provider (MAN/Yahoo等)界接,需花錢更換Edge Server的憑證為外部合法的憑證
4. 購買合法的License
測試環境說明:
1. 兩個沒有Trust 的Domain:domainA.com 及domainB.com
2. Edge Server FQDN為:Exedge-sip.domainA.com 及exedge-sip.domainB.com
3. DNS SVR Record :
DomainA的SVR Record : _sipfederationtls._tcp.domainA.com 為exedge-sip.domainA.com
DomainB的SVR Record : _sipfederationtls._tcp.domainB.com 為exedge-sip.domainB.com
4. 雙方Root CA憑證
步驟:
1. 將Root CA憑證安裝到對方Domain 的Edge Server上:登入Exedge-sip.domainA.com =>mmc=>新增崁入式單元:"憑證Certificate"=>增加My user account & Computer account (local) => 匯入另一個Domain 的Root CA,出現在Certificates-Current user 的Intermediate Certificate Authorities -> Certificates內=> Copy到 Certificate(Local Computer)的Trusted Root Certification Authorities->Certificates內。
2. 另一個DomainB的Exedge-sip.domainB.com 匯入DomainA的Root CA。
3. 設定Feredated Domains : 於DomainA 的Front End Server 上開啟Lync Server Control Panel => External User Access => 1) External Access Policy : Enable communications with federated user. 2)Access Edge Configuration : Enable federation & Enable partner domain discovery. 3)Federated Domains : New => Allowed domain => Domain name : domainB.com => Access Edge Service : exedge-sip.domainB.com.
4. 同樣的,DomainB 也設定DomainA的Exedge-sip.domainA.com 為domainA.com 的 Edge Server .
未能正常連線的測試:
1. 驗證是否能正確查詢對方的SRV:
1) nslookup - 8.8.8.8
2) set type=srv
3) _sipfederationtls._tcp.domainA.com
2. 啟用Lync Client 的Log機制:
1) lync 選項=>一般=>紀錄=>勾選:在Lync中開啟紀錄
2) Lync重新啟動=>登入
3) 輸入另一個Domain 的Uuser : user1@domainA.com
4) 檢查Log : C:\Documents and Settings\<user name>\Tracing\Communicator-uccapi-0.uccapilog
5) 查詢 "ms-diagnostics",確認"reason"的錯誤原因。
相關參考文件:
1. http://ucworld.blog.51cto.com/811917/499165
2. 用Google 查ms-diagnostics的錯誤訊息
3. http://www.shudnow.net/2011/02/01/lync-2010-edge-utilizing-windows-server-2008-r2-federation-tls-issues/
訂閱:
文章 (Atom)