想要看chkdsk的結果時,除了可以使用事件檢視器搜尋應用程式chkdsk(自己執行)或者wininit(系統執行),在網路上找到一個方法可以用powershell將log檔抓取出來成文字檔,如此可以方便使用email傳送或自動化。此方法只適用windows vista以上版本,方法如下:
windows鍵+R執行powershell.exe
鍵入
get-winevent -FilterHashTable @{logname="Application"; id= 1001,26214} | ?{$_.providername -match "chkdsk" -or $_.providername -match "wininit"} | fl timecreated, message | out-file C:\chkdskresult.txt
檔案會生成在 C:\chkdskresult.txt
可以自己類推代換路徑
另外如果只要看昨天的事件
先鍵入
$yesterday = (get-date) = (new-timespan -day 1)
再鍵入
get-winevent -FilterHashTable @{logname="Application"; id= 1001,26214; StartTime=$yesterday} | ?{$_.providername -match "chkdsk" -or $_.providername -match "wininit"} | fl timecreated, message | out-file C:\chkdskresult.txt
將上面指令建立一個文字檔並命名為chkdskresult.ps1
再於工作排程器啟動powershell.exe
新增引數 -File "剛剛chkdskresult.ps1的路徑" (前後要保留"")
最後要於powershell內執行Set-ExecutionPolicy RemoteSigned指令並選擇yes (才可開啟指令碼執行)
配合使用email傳送可參考我之前文章
另外chkdsk 搭配 /x 引數可強制卸載磁碟開始掃描
參考資料
自己
http://www.sevenforums.com/tutorials/96938-check-disk-chkdsk-read-event-viewer-log.html
設定時間參數
http://ss64.com/ps/get-winevent.html
可用Powershell排程
http://mqjing.blogspot.tw/2009/01/script-powershell.html
系統上已停用指令碼執行
http://taien.idv.tw/2012/07/25/powershell-%E6%AA%94%E6%A1%88%E7%84%A1%E6%B3%95%E8%BC%89%E5%85%A5%EF%BC%8C%E5%9B%A0%E7%82%BA%E9%80%99%E5%80%8B%E7%B3%BB%E7%B5%B1%E4%B8%8A%E5%B7%B2%E5%81%9C%E7%94%A8%E6%8C%87%E4%BB%A4%E7%A2%BC%E5%9F%B7.html
篩選複數ID
http://technet.microsoft.com/en-us/library/ee177028.aspx
http://social.technet.microsoft.com/Forums/scriptcenter/en-US/a637d5c3-6b36-474f-8092-bcdf0f686e3a/multiple-values-for-a-property-in-a-whereobject-filter?forum=ITCG
http://stackoverflow.com/questions/17691893/filterhashtable-filter-by-event-code
out-file
http://technet.microsoft.com/en-us/library/hh849882.aspx
get-content
http://stackoverflow.com/questions/17434151/writing-new-lines-to-a-text-file-in-powershell
replace
http://stackoverflow.com/questions/3403217/how-to-replace-multiple-strings-in-a-file-using-powershell
2014年6月26日 星期四
2014年6月19日 星期四
電腦右鍵選單管理無法開啟電腦管理(磁碟管理)
請進入REGEDIT修改:
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Manage\command]
將預設值改為 mmc.exe %windir%\system32\compmgmt.msc 就可以了
參考資料
http://www.mobile01.com/topicdetail.php?f=300&t=1681759&p=1
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Manage\command]
將預設值改為 mmc.exe %windir%\system32\compmgmt.msc 就可以了
參考資料
http://www.mobile01.com/topicdetail.php?f=300&t=1681759&p=1
2014年6月11日 星期三
世紀帝國二 2.2被遺忘的王朝畫面變色問題
下載下面網址的2.2更新檔,執行FixAOFE.exe選enable windowed mode。apply後退出即可執行視窗化並且調好解析度進入遊戲後會變成全螢幕。
順帶一提的是,此方法會跟Teamviewer衝突導致FC,請執行前務必將Teamviewer結束。
參考資料
自己
http://blog.yam.com/LuGaunTaoStudio/article/69104861
順帶一提的是,此方法會跟Teamviewer衝突導致FC,請執行前務必將Teamviewer結束。
參考資料
自己
http://blog.yam.com/LuGaunTaoStudio/article/69104861
2014年4月22日 星期二
有關jorte待辦事項無法同步及開啟行事曆項目當掉問題之解決方法
前一陣子發現jorte待辦事項突然無法同步,搜尋了一下找到解決的方法是把google帳號移除再重新加入讓jorte重新取得權限。結果待辦事項是可以同步了但卻發現行事曆項目打開就會當掉。自己測試了之後發現是由於我有兩個google帳號,將第二個帳號也移除重新加入之後問題解決。提供有遇到此問題的人參考。
參考資料
自己
參考資料
自己
2014年3月25日 星期二
pfsense openvpn設置,設定有線網路優先於無線網路
如何使有線網路優先於無線網路。進入網路與共用中心,變更介面卡設定,F10,進階,進階設定。
pfsense裡設定openvpn重點如下
參考資料
有線網路優先
http://www.techbang.com/posts/6326-in-windows-7-fast-switching-wired-wireless-network
http://bojack.pixnet.net/blog/post/35356025-%E3%80%90windows%E3%80%91%E5%9C%A8-windows-7-%E8%AA%BF%E6%95%B4%E6%9C%89%E7%B7%9A%E7%B6%B2%E8%B7%AF%E5%92%8C%E7%84%A1%E7%B7%9A%E7%B6%B2%E8%B7%AF
IP相同
https://forum.pfsense.org/index.php?topic=4587.0
SMB
https://doc.pfsense.org/index.php/Why_can't_I_access_Windows/SMB_shares_on_OpenVPN_clients
同事討論與實做測試
pfsense裡設定openvpn重點如下
- 先設定ca certification
- 接著server certification於pfsense用
- client certification用於要連接的設備
- 注意LZO compression及cipher兩端(server及client)要設定一樣
- 目前測試pfsense只能用tun而不能用tap
- 建立.crt與.key時如common name設一樣則會拿到同一個IP,會造成互搶,應避免
- 如需使用samba服務如網路芳鄰則需將Enable NetBIOS over TCP/IP打勾並選擇m-node,但android device有時還是會連不上
參考資料
有線網路優先
http://www.techbang.com/posts/6326-in-windows-7-fast-switching-wired-wireless-network
http://bojack.pixnet.net/blog/post/35356025-%E3%80%90windows%E3%80%91%E5%9C%A8-windows-7-%E8%AA%BF%E6%95%B4%E6%9C%89%E7%B7%9A%E7%B6%B2%E8%B7%AF%E5%92%8C%E7%84%A1%E7%B7%9A%E7%B6%B2%E8%B7%AF
IP相同
https://forum.pfsense.org/index.php?topic=4587.0
SMB
https://doc.pfsense.org/index.php/Why_can't_I_access_Windows/SMB_shares_on_OpenVPN_clients
同事討論與實做測試
2014年3月10日 星期一
Filezilla server ftp log檔透過email寄送
因為想將不需要的資訊篩選,一開始想使用findstr,但是後來發現findstr用來判斷比較好用,最後是用vbs裡的instr函數。
參考資料
time format
instr
替換
Javascript
2014年2月25日 星期二
按鍵精靈在VM中輸入問題
自己測試的結果,由於VM擷取鍵盤,所以無法用saystring直接輸入字串,而必須使用KeyPress代替,並且可以使用變數。也幸好我要輸入的變數是數字,所以使用迴圈來輸入。
參考資料
迴圈
http://tw.knowledge.yahoo.com/question/question?qid=1508062208839
輸入@等組合鍵寫法
http://tw.knowledge.yahoo.com/question/question?qid=1612072311102
參考資料
迴圈
http://tw.knowledge.yahoo.com/question/question?qid=1508062208839
輸入@等組合鍵寫法
http://tw.knowledge.yahoo.com/question/question?qid=1612072311102
訂閱:
文章 (Atom)