2023/08/24

GPO佈署EDGE IE瀏覽模式突然失效 被略過

原本有透過GPO在使用者的電腦,佈署EDGE政策,讓EDGE在開啟一些特定網頁時,會啟用IE瀏覽模式。

但這兩天開始有電腦的IE瀏覽模式沒被啟用,查看GPO確定是有套用沒錯,所以不是GPO的問題。

開啟EDGE查看設定,發現套用的政策被略過了,但只有少數人有這個狀況。


查了一下才知道是因為EDGE最近升級後,有一些改變。
如果使用者在EDGE裡登入了私人帳號,GPO佈署的政策就會被略過,只要登出帳號,就會恢愎正常了。



Originally, we deployed EDGE policies via GPO on users' computers to enable IE browsing mode when opening certain websites.


However, in the past two days, some computers have failed to enable IE browsing mode. After checking the GPO, we confirmed that it is being applied correctly. Therefore, the issue is not with the GPO.


When we opened EDGE and checked the settings, we found that the applied policies were being ignored. However, this was only happening for a small number of users.


After some investigation, we learned that this is because EDGE was recently updated. If a user is logged in to a personal account in EDGE, the policies deployed via GPO will be ignored. Simply logging out of the account will restore normal behavior.


2023/08/18

Python Excel書推薦

 Python操作Excel:最強入門邁向辦公室自動化之路 王者歸來

這本書裡面範例多,而且都很簡短,好上手,想要Python來處理Excel資料的很適合。




2023/08/14

Ultravnc viewer 連線設定

 Ultravnc viewer 在連線時,有時後畫面會太大,或速度比較慢。

這是可以去調整設定,讓畫面自動去符合目前的螢幕大小,跟連線速率的狀況。

但每次連線就要調一次太麻煩,要直接去預設值裡面調整,這樣之後就會自動套用。

先隨便找一台電腦連線,連線之前先把"auto scale"打勾,"quick encoder"選擇"LAN",連後就連線,連上後就可以關閉。

這時到 C:\Users\username\AppData\Roaming\UltraVNC\,就會看到剛剛那台電腦的連線設定檔。

接著把這個檔案重新命名為"options",覆蓋原本已存在的檔案,就行了。

這個設定檔可以用記事本開啟,看到裡面的設定,下列兩個設定就是對應到剛剛設定的那兩個值

QuickOption=3 #可將連線速品質預設為MEDIUM,降低連線延遲。

AutoScaling=1 #可自動調整連線視窗大小,符合當前的螢幕尺吋。



UltraVNC viewer may sometimes display too large a screen or be slow when connected.

You can adjust the settings to make the screen automatically fit the current screen size and connection speed.

However, it is too troublesome to adjust it every time you connect. You can directly adjust it in the default values, so it will be automatically applied afterwards.

First, connect to any computer at random. Before connecting, check the "auto scale" and select "LAN" for the "quick encoder". Then connect and close it after connecting.

At this time, go to C:\Users\username\AppData\Roaming\UltraVNC, and you will see the connection settings file for the computer just now.

Then rename this file to "options" and overwrite the existing file.

This settings file can be opened with Notepad to see the settings. The following two settings correspond to the two values ​​that were just set:

QuickOption=3 #Can set the connection speed quality to MEDIUM by default, reducing connection latency.

AutoScaling=1 #Can automatically adjust the size of the connection window to fit the current screen size.

2023/08/11

搭配Google Blogger 的Google Adsense ads.txt一直顯示找不到

 最近Google Blogger流量變多了,但Google Adsense這兩三個月的收入卻都是0,感覺怪怪的。

進到Google Adsense後台看了一下,發現在"網站"這裡面的設定,ads.txt狀態是顯示"找不到"。

看了一下說明,發現設定都對,然後連到 https://網站網址/ads.txt ,資料也有正常顯示。

本來在想是不是Blogger裡面的robots.txt設定有問題,所以把robots.txt關閉,但還是沒用。

後來在論壇上看到有人分享,到Google Adsense後面的"設定-->帳戶資料",裡面有一個"賣家資訊顯示設定",要設定成公開,ads.txt馬上就會馬上生效變成"已授權"。

測試了一下,真的馬上就好了,Google的ads設定都沒提到這個,還好有好心人提供這個方法才得以解決。


Recently, my Google Blogger traffic has increased, but my Google Adsense income for the past two to three months has been 0. I felt strange.

I went to the Google Adsense backend and checked. I found that the status of ads.txt in the "Website" settings is "Not Found".

I read the instructions and found that the settings are correct. Then I went to https://website-url/ads.txt, and the data was also displayed normally.

I thought that the robots.txt setting in Blogger might be wrong, so I turned off robots.txt, but it didn't work.

Later, I saw someone share on the forum that I should go to the "Settings"->"Account Information" in Google Adsense, and there is a "Seller Information Display Settings". I should set it to "Public", then ads.txt will be effective immediately and become "Authorized".

I tested it, and it really worked immediately. 

Python py轉exe的執行檔太大

 Python寫好的執行要直接轉成exe檔在其他沒裝Python直接運行,可是轉出來的exe檔都好大,幾KB的py檔轉成exe變成幾百MB。

原來是因為之前是用Anaconda裝好環 境的,裡面有一大堆套件,在轉換時,也一直被塞進去了。

要解決這個問題,就是建一個新的虛擬環境,裝上所需的套件,再進行轉換,exe檔就變成幾十MB而已。

可以參考下面網站,說的非常清楚。

https://inf.news/zh-hant/technique/0abeedacd79bf29153e82893d9a0e280.html



Converting a Python script into an executable (.exe) file is a convenient way to run the program on systems without Python installed. However, the resulting .exe files tend to be quite large, often several hundred megabytes, even for scripts that are just a few kilobytes in size.

The reason behind this issue is that if you previously developed your code within an Anaconda environment, it likely included a multitude of packages and dependencies. During the conversion process, these dependencies are also bundled into the executable, contributing to its substantial size increase.

To address this problem, a solution involves creating a new virtual environment, installing only the necessary packages, and then proceeding with the conversion process. This approach results in executable files that are only a few tens of megabytes in size.

For a detailed guide on how to accomplish this, you can refer to the following website:

https://inf.news/zh-hant/technique/0abeedacd79bf29153e82893d9a0e280.html

2023/08/08

fortigate log 保留天數調整

 fortigate log 預設保留7天,如果容量夠的話,可以設定保留久一點,若有發生異常,可以查到比較久以前的紀錄。

直接在指令模式下分別輸入下列三個指令就行了,其中第二行就是設定日誌保留的天數,下面的範例是設成30天。

config log disk setting

set maximum-log-age 30     

end


FortiGate logs are stored by default for 7 days. If you have enough disk space, you can configure them to be stored for a longer period of time. This will allow you to view older logs in case of an incident.

To configure FortiGate logs, enter the following three commands in command mode. The second command sets the number of days that logs are stored. In the example below, logs are stored for 30 days.

config log disk setting

set maximum-log-age 30

end

2023/08/07

windows 使用batch 指令匯出dhcp lease位址租用紀錄

 如果是windows2012,powershell 4.0裡面有get-dhcp的指令把DHCP目前租用IP的清單做匯出。

但在windows2008,powershell 1.0沒這個指令,不想升級powershell,可以用netsh來完成,指令如下:


@echo off

netsh dhcp server scope 172.16.11.0 show clients > "%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%_dhcp_clients.txt"

exit

指令會把172.16.11.0這個領域的IP租用匯出到txt中,檔名是會以當天的日期呈現。

如果要把每個領域都匯出,就把指令重覆貼上,改掉scope後面的領域IP就行了。



If you are using Windows 2012, PowerShell 4.0 includes the get-dhcp command to export a list of currently leased IP addresses from DHCP.

However, in Windows 2008, PowerShell 1.0 does not have this command. If you do not want to upgrade PowerShell, you can use netsh to complete the task. The command is as follows:

@echo off

netsh dhcp server scope 172.16.11.0 show clients > "%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%_dhcp_clients.txt"

exit

This command will export the IP leases for the 172.16.11.0 scope to a text file. The file name will be in the format of YYYYMMDD_dhcp_clients.txt.

To export leases for all scopes, simply copy and paste the command, and change the scope IP address after scope.

2023/07/28

APACHE http轉跳https 設定

最近在查怎麼讓web伺服器某些https的網站,在連線時,用http連會自動轉跳到https,查到的設定都好復雜,結果發現有一個人分享一個很簡單的方法,主要是利用連上http沒東西時,會自動幫你轉跳到https的頁面就可以了,只需要一行設定,可參考下列說明

ttps://www.orcy.net.cn/927.html 

2023/07/07

ESXi 6.5 的windows 2012虛擬機傳送ctrl alt del沒反應

在ESXi 6.5架設了一台windows 2012虛擬機,開啟了遠端桌面連線的功能,都可以使用,接著安裝了vmtool重開機後,使用chrome透過esxi的web console要登入主機時,傳送ctrl alt del沒反應。

使用遠端桌面連線,輸入完帳號密碼後,也都連不上,非常奇怪。

查了一下google,vmware有一篇文章是說要升級esxi,這個就先不考慮。

在經過一些測試後發現,是透過windows update進行更新時,會有一個vmware的套件,安裝了這個後,才會有傳送ctrl alt del沒反應的問題,所以在做windows update時不要裝這個套件就好了。


I have set up a Windows 2012 virtual machine on ESXi 6.5 and enabled the Remote Desktop Connection feature, which was working fine. Then I installed vmtools and rebooted the virtual machine. After that, when I tried to log in to the host using Chrome via ESXi's web console and sent Ctrl+Alt+Del, there was no response.

I also tried using Remote Desktop Connection, but after entering the username and password, I couldn't connect, which is very strange.

After searching on Google, I found an article from VMware suggesting upgrading ESXi, but for now, I'm not considering that option.

After some testing, I discovered that when updating through Windows Update, there is a VMware package that, when installed, causes the issue with Ctrl+Alt+Del not working. So, when performing Windows Update, it's advisable not to install this package.

2023/07/06

Excel 下方的分頁頁籤不見了

 EXCEL檔案不同的分頁,通常都在左下方可以做點選切換。

但某些檔案明明就有多個分頁,但下方卻都沒東西,無法切換。

這是設定的問題,只要在進階的設定裡,找到 顯示工作表索引標籤,將此功能打勾就會正常顯示其他分頁了。





Different worksheets in an Excel file are usually switchable by clicking on the tabs located at the bottom left.
However, in some cases, even though a file has multiple worksheets, there is no content displayed at the bottom, and switching between them is not possible.
This is a configuration issue. By going into the advanced settings and enabling the "Show sheet tabs" option, the other worksheets will be displayed correctly.