$Array['INDEX'] = 'VALUE';
// index
$Array = array_change_key_case_recursive($Array ,CASE_LOWER);
// value
$Array = array_map('nestedLowercase', $Array );
=>
$Array['index'] = 'value';
$Array['INDEX'] = 'VALUE';
// index
$Array = array_change_key_case_recursive($Array ,CASE_LOWER);
// value
$Array = array_map('nestedLowercase', $Array );
=>
$Array['index'] = 'value';
URL Parsing by PowerShell
$URL = "https://api.contoso.com/level1/level2/Script.php?index=1&page=2&content=3";
$URI = [System.Uri]$URL;
Add-Type -AssemblyName System.Web;
$ParsedQueryString = [System.Web.HttpUtility]::ParseQueryString($URI.Query);
$QueryParams = New-Object -TypeName PSObject;
$i=0;
foreach($QueryStringObject in $ParsedQueryString){
$QueryParams | Add-Member -MemberType NoteProperty -Name $QueryStringObject -Value $ParsedQueryString[$i];
$i++;
};
$URI | fl;
$QueryParams.PSObject.Properties.Name;
$QueryParams;
openssl pkcs12 -in "www.Contoso.com.pfx"
=> unsupported encryption algorithm (RC2-40-CBC)
=> openssl pkcs12 -in "$1" -legacy
參考資料:
https://github.com/openssl/openssl/discussions/23089
Get-Mailbox UserName | fl ExchangeGuid #取得 ExchangeGuid
PowerShell On-Premises
Enable-RemoteMailbox UserName -RemoteRoutingAddress UserName@YourDomain.mail.onmicrosoft.com
Set-RemoteMailbox UserName -ExchangeGuid <ExchangeGuid from above>
如果是 Shared Mailbox, Enable-RemoteMailbox 指令加上 -Shared 參數
參考資料:
https://www.itpromentor.com/link-aduser-365/
運動攝影機錄影擋預設流量 (bitrate) 很高,但其實我覺得看不太出來高低流量畫質的差異
所以根據網路查的一些建議用 ffmpeg 批次處理降低流量
先用 ffprobe.exe 取得影片屬性,再根據影片屬性進行處理
以下 Powershell 中,VideoRotation 是影片方向的資訊,在降低流量的處理中實際上不需要
這裡只是當作筆記用,未來有需要的時候才找得到 (找很久才找到這個語法)
#設定要降低的 bitrate 值 Start
$ProcessMethod = @();
$ProcessMethod += New-Object -TypeName PSObject -Property @{
Width = 2688;
FrameRate = 30;
BitRate = 16;
};
$ProcessMethod += New-Object -TypeName PSObject -Property @{
Width = 2688;
FrameRate = 60;
BitRate = 24;
};
$ProcessMethod += New-Object -TypeName PSObject -Property @{
Width = 3840;
FrameRate = 30;
BitRate = 45;
};
$ProcessMethod += New-Object -TypeName PSObject -Property @{
Width = 3840;
FrameRate = 60;
BitRate = 55;
};
$ProcessMethod += New-Object -TypeName PSObject -Property @{
Width = 3840;
FrameRate = 120;
BitRate = 65;
};
#設定要降低的 bitrate 值End
全景影片用 VLC 等媒體播放軟體播放時若預設不以全景模式播放代表缺少 Metadata Tag
解決辦法如下,如果檔案量少,可以直接用 GUI 程式處理,檔案多的話跑批次比較省事
GUI & Source: google spatial-media
https://github.com/google/spatial-media/releases
Command 需要 python 2.7 (新版不行)
根據影片類型可能要加入 StereoMode 參數,請自行參考程式說明
先轉轉看確認參數再跑批次
Set-Location -Path "D:\Software\spatial-media-2.1\";
$Files = (Get-ChildItem -Path 'D:\Video' -File)
foreach ($File in $Files) {
& D:\Python27\python.exe spatialmedia -i $File.FullName ($File.FullName -Replace $File.BaseName,($File.BaseName + '_360 Tag Added'));
#if (($File.FullName -Replace $File.BaseName,($File.BaseName + '_360 Tag Added')) -eq $True) {
# remove-item -path $File.FullName -force;
#};
};
技術細節可 Google 關鍵字: Inject 360 Metadata
ALTER DATABASE [DBName] SET RECOVERY SIMPLE;
dbcc shrinkfile(DBName_log, 1);
ALTER DATABASE [DBName] SET RECOVERY FULL;
參考資料:
https://sdwh.dev/posts/2021/03/SQL-Server-LDF-Truncate-Shrink/
netsh interface portproxy add v4tov4 listenport=80 listenaddress=192.168.1.10 connectport=80 connectaddress=1.1.1.1
netsh interface portproxy show all
netsh interface portproxy delete v4tov4 listenport=80 listenaddress=192.168.1.10
或
netsh interface portproxy delete listenport=80 listenaddress=192.168.1.10
Server 不建議使用
AdGuard DNS(無過濾功能):
94.140.14.140
94.140.14.141
AdGuard DNS(攔截廣告、跟蹤器和釣魚網站)
94.140.14.14
94.140.15.15
AdGuard DNS(攔截廣告、跟蹤器、釣魚網站和成人內容的網站)
94.140.14.15
94.140.15.16
Cloudflare DNS(隱私權保護)
1.1.1.1
1.0.0.1
Cloudflare DNS (阻止惡意程式)
1.1.1.2
1.0.0.2
Cloudflare DNS (阻止惡意軟件及成人內容)
1.1.1.3
1.0.0.3
https://dns.sb/
185.222.222.222
45.11.45.11
在 PowerShell 中用帳號密碼進行 Connect-AzAccount 會被罵
WARNING: Authentication with a username and password at the command line is strongly discouraged. Use one of the recommended authentication methods based on your requirements. For additional information, visit https://go.microsoft.com/fwlink/?linkid=2276971.
先用具有適當權限的帳號登入後用以下 Script 建立 Service Principal Application
再到 RBAC 賦予需要的權限
Set-Location -LiteralPath 'C:\Command\AzureConnect';
$AzureEntraTenantId = 'xxxxxxxx-xxxx-xxxx-xx-xxxxxxxxxxxx';
$AzSubscriptionID = 'xxxxxxxx-xxxx-xxxx-xx-xxxxxxxxxxxx';
$ServicePrincipalName = 'PowershellAutomaticProcess';
$CredentailFileName = ('AzConnect_' + $ServicePrincipalName + '.txt')
$CertificateExpired = 100;
#設定密碼 100 年後到期 (預設 1 年),往下找 AddYears 字串那邊可以改
這支 Powershell Script 蒐集以下資訊並以 JSON 格式存到 Share Folder
LogonServer
Site
UserName
ComputerName
ComputerInfo
DiskInfo
Applications
NetworkInfo
GroupsInfo
LocalUsers
用 GPO 派送,目標 Share Folder 給予 User 建立 Child Object 權限
並給予 Creator Owner 刪除權限
以 User Name + Computer Name 為檔名,後加上日期年月日時分秒
保留最新的 5 個 Report
繼前一篇 Synology Active Backup for Business for Hyper-V VM Failed to Backup #01
取得 Patch 跳過了 5 個 Snapshots 的問題後
還是備份失敗
於是再用 Support Center App 產生 Active Backup for Business 的 Debug Log 後
在 ActiveBackup\volume1\@ActiveBackup\log\vm.log 中看到
synoabk_vm_backup[6175]: synoabk_vm::[WARNING] hyperv_agent.cpp:1381(6175,139923524343360) [6175]hypervisor_agent/hyperv_agent.cpp:145 {"error_class":"PowerShellException","error_message":"Missing an argument for parameter 'Id'. Specify a parameter of type 'System.Int32[]' and try again.","error_params":{"Activity":"Stop-Process","Category":5,"Reason":"ParameterBindingException","TargetName":"","TargetType":"","error_id":"MissingArgument,Microsoft.PowerShell.Commands.StopProcessCommand"},"success":false}
難道是 Powershell 語法錯誤少帶一個參數?
備份失敗了,說我的 Snapshot 數量超過 5 個所以不給備
Virtual machine VMName's snapshots have reached the maximum number (5).
You need to delete some snapshots on the device
但實際上根本就一個 Snapshot 也沒有
在使用 Synology NAS 在發生問題時為了查原因
除了系統預設相當簡略的錯誤訊息以外,可以匯出詳細 Log 來 Debug
切換到 Support Services 頁籤
初次使用 Synology Active Backup for Business 的時候
Hyper-V Server 連線成功,但 VM 列表一片空白
用 Support Center App 產生 Active Backup for Business 的 Debug Log 後
在 dsm\var\log\synoscgi.log 找到以下錯誤訊息
NAS synoscgi_SYNO.ActiveBackup.Inventory_1_list_node[24340]: [ERROR] main.cpp:212(24340,139646703461952) Code: [0] What: [[24340]hypervisor_agent/hyperv_agent.cpp:145 {"error_class":"PowerShellException","error_message":"std_out: b'[ //VM Information JSON// ]', std_err: Get-VM : Hyper-V encountered an error trying to access an object on computer 'HYPER-V-xxxxxx' because the object was not found. The object might have been deleted, or you might not have permission to perform the task. Verify that the Virtual Machine Management service on the computer is running. If the service is running, try to perform the task again by using Run as Administrator. At line:3 char:1 + Get-VM| Select Id,Name,MemoryStartup,ProcessorCount,State,Status,Prim ... + ~~~~~~ + CategoryInfo : ObjectNotFound: (:) [Get-VM], VirtualizationException + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.GetVM Get-VM : Hyper-V encountered an error trying to access an object on computer 'HYPER-V-xxxxxx' because the object was
not found. The object might have been deleted, or you might not have permission to perform the task. Verify that the Virtual Machine Management service on the computer is running. If the service is running, try to perform the task again by using Run as Administrator. At line:3 char:1 + Get-VM| Select Id,Name,MemoryStartup,ProcessorCount,State,Status,Prim ... + ~~~~~~ + CategoryInfo : ObjectNotFound: (:) [Get-VM], VirtualizationException + FullyQualifiedErrorId : ObjectNotFound,Microsoft.HyperV.PowerShell.Commands.GetVM, status_code: 1", "error_params":{"error_id":""},"success":false}]
<!DOCTYPE html>
<html lang="en" class="notranslate" translate="no">
<head>
<meta name="google" content="notranslate" />
</head>
<body>
...
</body>
</html>
出處: https://stackoverflow.com/questions/12238396/how-to-disable-google-translate-from-html-in-chrome
Modify the source code and compile it yourself
---------------------------------------------------------------------------------------------
src\Cedar\Radius.h
//#define RADIUS_RETRY_INTERVAL 500 // Retransmission interval
//#define RADIUS_RETRY_TIMEOUT (10 * 1000) // Time-out period
#define RADIUS_RETRY_INTERVAL 60000 // Retransmission interval
#define RADIUS_RETRY_TIMEOUT (60 * 1000) // Time-out period
---------------------------------------------------------------------------------------------
src\Cedar\Cedar.h
$DHCPServer = "DHCPServer.Contoso.com";
$DHCPScopes = Get-DhcpServerv4Scope -ComputerName $DHCPServer;
foreach ($Scope in $DHCPScopes) {
Get-DhcpServerv4Lease -ComputerName $DHCPServer -ScopeID $Scope.ScopeId;
};
or
$Global:Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False;
$DHCPData = (Get-DhcpServerv4Scope -ComputerName "DHCPServer.Contoso.com" | Get-DhcpServerv4Lease -ComputerName "DHCPServer.Contoso.com");
[System.IO.File]::WriteAllLines('C:\DHCP.json', ($DHCPData | ConvertTo-Json -Depth 100 -Compress), $Global:Utf8NoBomEncoding);
Set-DhcpServerv4Scope -ComputerName $DHCPServer -ScopeID $Scope.ScopeId -LeaseDuration "30.08:09:10";