Win10 內建的還原功能 Unified Write Filter (UWF)

原來 Win10 企業版與教育版有內建還原功能 Unified Write Filter (UWF)
能做到跟重開機就瞬間還原 公用空間或是電腦教室 就不用再買還原軟體或是裝還原卡了

首先必須要開啟這個功能
用指令的話是 DISM /Online /enable-Feature /FeatureName:client-UnifiedWriteFilter

用控制台則是

控制台 / 應用程式與功能 / 程式設定 / 開啟或關閉 windows 功能
懶懶的話就 win+R / OptionalFeatures.exe

打開 裝置鎖定 勾選 整合寫入篩選器

重開機生效

剩下設定就都是靠 uwfmgr.exe 指令了
先打開管理者權限的 cmd (開始 cmd / alt-shift-enter)

uwfmgr overlay Set-Type DISK 改用硬碟當作暫存區(預設是 RAM )
uwfmgr overlay set-size 10240 設定暫存大小為 10240 MB (10G)
uwfmgr overlay set-warningthreshold 10000 設定警告閾值為 1000M
uwfmgr overlay set-criticalthreshold 10240 設定嚴重閾值為 10240M
uwfmgr volume protect c:  設定保護磁碟為 C
uwfmgr servicing Update-Windows  設定可以接受 windows 更新

設定好之後 啟用保護

uwfmgr filter enable

重開機後就是保護狀態了
如果需要安裝程式或變動要先解除保護 然後重開機後就會是一般模式

uwfmgr filter disable

如果需要讓 windows 防毒更新可以正常更新 必須做排除部分檔案與機碼
可參考這篇文章做以下設置

uwfmgr file add-exclusion C:\Program Files\Windows Defender
uwfmgr file add-exclusion C:\ProgramData\Microsoft\Windows Defender
uwfmgr file add-exclusion C:\Windows\WindowsUpdate.log
uwfmgr file add-exclusion C:\Windows\Temp\MpCmdRun.log
uwfmgr registry add-exclusion HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Defender

我自己是沒有啟用啦 反正都會還原 就不需要防毒了(但是有 usb 交互感染風險)

其他就參考官方這兩篇
Unified Write Filter (UWF)
uwfmgr.exe

Firefox favicon 圖示錯亂

Firefox favicon 網站圖示顯示錯誤
解決方法就是砍了 favicons.sqlite 就會重抓了
Windows 的位置在 C:\Users\your_account\AppData\Roaming\Mozilla\Firefox\Profiles\亂數.default
Mac 的位置在 /Users/your_account/Library/Application Support/Firefox/Profiles/亂數.default

解決 LibreNMS Missing dependencies!

Error: Missing dependencies! Run the following command to fix:

./scripts/composer_wrapper.php install --no-dev

奇怪 今天一開 librenms 炸了這個訊息
解決方法是 安裝一下 php-mbstring

sudo apt-get install php7.0-mbstring

然後又爆寫入權限….

Error: bootstrap/cache, storage, storage/framework/sessions, storage/framework/views, storage/framework/cache, logs not writable! Run these commands as root on your LibreNMS server to fix:

chown -R librenms:librenms /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/storage/framework/sessions /opt/librenms/storage/framework/views /opt/librenms/storage/framework/cache /opt/librenms/logs

setfacl -R -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/storage/framework/sessions /opt/librenms/storage/framework/views /opt/librenms/storage/framework/cache /opt/librenms/logs

setfacl -d -m g::rwx /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/storage/framework/sessions /opt/librenms/storage/framework/views /opt/librenms/storage/framework/cache /opt/librenms/logs

If using SELinux you may also need:

解決方法

debian 用 apt install acl 就可以照說明執行 setfacl 了

以上正解
以下土炮

chown -R librenms:librenms /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/storage/framework/sessions /opt/librenms/storage/framework/views /opt/librenms/storage/framework/cache /opt/librenms/logs
chmod -R 777 /opt/librenms/bootstrap/cache /opt/librenms/storage /opt/librenms/storage/framework/sessions /opt/librenms/storage/framework/views /opt/librenms/storage/framework/cache /opt/librenms/logs

HPE 5130 JH325A switch 筆記

HPE 5130 switch

重設密碼

console 線連接

拔電 重插

Starting......
Press Ctrl+D to access BASIC BOOT MENU
Press Ctrl+T to start memory test

Ctrl-D 進入 BASIC BOOT MENU

Press Ctrl-B to enter Extended Boot menu..

隨後 Ctrl-B 進入 Extended Boot menu

Password recovery capability is enabled.

   BOOT MENU

1. Download application file to flash
2. Select application file to boot
3. Display all files in flash
4. Delete file from flash
5. Restore to factory default configuration
6. Enter BootRom upgrade menu
7. Skip current system configuration
8. Reserved
9. Set switch startup mode
0. Reboot
Ctrl+F: Format File System
Ctrl+P: Skip Super Password
Ctrl+R: Download application to SDRAM and Run
Ctrl+Z: Access EXTEND-ASSISTANT MENU

Enter your choice(0-9): 7

選擇 7 Skip current system configuration

The current setting will run with current configuration file when reboot.
Are you sure you want to skip current configuration file when reboot? Yes or No
(Y/N):Y

問你下次重開是否跳過目前設定 選 Y

0. Reboot

回到主選單 選擇 重新開機 Reboot

重開機之後進系統

砍掉啟動設定檔

delete startup.cfg

或是回復舊的設定

reset saved-configuration main

最後重開機

reboot

就不用打密碼了

設定新密碼

system-view
[HPE]local-user admin
[HPE-luser-manager-admin]password  simple 密碼
[HPE-luser-manager-admin]service-type http ssh terminal
[HPE-luser-manager-admin]save
[HPE-luser-manager-admin]exit

改 ip 並啟用網頁服務

system-view
[HPE]interface Vlan-interface 1
[HPE-Vlan-interface1]ip address 10.1.1.1 255.255.255.0
[HPE-Vlan-interface1]exit
[HPE] ip http enable
[HPE]save

Juniper switch 設定 auto-snapshot 預防斷電 gg

聽說 Juniper 的 switch 不正常斷電會掛掉
最近看到有 auto-snapshot 可以解決這問題
後面設定請看一下命令提示字元是 “>” 還是 “#” 去選擇你的模式

操作模式

ssh 過去打 cli 進入 command line interface 模式 (提示字元是”>”)

root@ex2200-04:RE:0% cli
{master:0}
root@ex2200-04>

打 configure 進入設定模式 (提示字元是”#”)

root@ex2200-04> configure
Entering configuration mode

{master:0}[edit]
root@ex2200-04#

Read more

GAM: 用 cli 管理 Google G-Suite (apps)

gam

Google g-suite 的管理介面真是出了名的難用
使用者列表是用 js 去讀出來的 最扯的是卷軸向下拉裡面的資料竟然會循環
稱了很久都沒去處理 直到今天才把 GAM 裝起來 以後改用這個管理

安裝步驟是又簡單又麻煩
打這行指令 就安裝完成了 不過這裡面很多步驟

bash <(curl -s -S -L https://raw.githubusercontent.com/jay0lee/GAM/master/src/gam-install.sh)

(debian 沒有 curl 要先 sudo apt-get install curl 一下)

依照步驟說明動作 有很多要用瀏覽器完成 所以要仔細看 貼網址 還有回來按 enter (記得複製不要按 ctrl-c 太爽 就給他中斷掉了)
因為步驟太多 就不貼了 不過都不需要看文件 應該可以完成

補一下參考資料
GAM 官方文件
批次操作文件