2020-12-30

Azure Note: ADDS integrated Azure File Share with Private Endpoint

 ADDS integrated Azure File Share

1. Azure vNet DNS set to ADDS DNS

2. Add Private DNS zone (Or Auto Create in Step 3.2.3)
2.1 Named: privatelink.file.core.windows.net
2.2 Add Virtual Network Link

2020-12-28

PowerPoint 存成圖片檔的解析度調整

PowerPoint 很小氣,預設輸出圖片只有 1280x720
如果需要輸出高解析度的話必須要修改註冊機碼

微軟說明在此:
https://docs.microsoft.com/en-us/office/troubleshoot/powerpoint/change-export-slide-resolution

HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\PowerPoint\Options

2020-12-25

Powershell Password Generator

$Password =  ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".tochararray() | sort {Get-Random})[0..16] -join ''

$Password

https://passwordsgenerator.net/

2020-12-21

Copy VM Disk on Azure

$ResourceGroup = "ResourceGroupName"
$SourceDiskName = "SourceDiskName"
$TargetDiskName = "TargetDiskName"

$SourceDisk = Get-AzDisk -ResourceGroupName $ResourceGroup -DiskName $SourceDiskName

$DiskConfig = New-AzDiskConfig -SourceResourceId $SourceDisk.Id -Location $SourceDisk.Location -CreateOption Copy -DiskSizeGB $SourceDisk.DiskSizeGB -SkuName "Premium_LRS"

New-AzDisk -Disk $DiskConfig -DiskName $TargetDiskName -ResourceGroupName $ResourceGroup

2020-12-11

Apache .htaccess 去除網址最後一個元素

傳 imagemap Message Type 的圖片 URL 給 Line 的時候
Line 會用 https://xxx/Path/To/image.png/1040 取代 https://xxx/Path/To/image.png

由於我只要提供一張圖片而已不區分解析度,所以想用 mod_rewrite 的方式處理
因為不熟悉正規表達式,網路搜尋老半天後暫時只能用以下方式處理

不知道那個 /Path/To/ 要怎麼用變數取代,否則就只能寫 .htaccess 在該路徑
並把 Path/To 寫 Hard Code 進去 Orz

RewriteEngine On
RewriteRule ^(.*)/1040 /Path/To/$1 [L]

如果有人會的話竟請不吝提供 m(_ _)m

2020-12-10

PowerShell Save Credential to file for futher use

Section 1: Create Password File

# Get Password
$PassWord = Read-Host -Prompt 'Please Enter Password';

# Convert to System.Security.SecureString
$PassWord = ConvertTo-SecureString -String 
$PassWord -AsPlainText -Force

# Encrypt it
$Encrypted = ConvertFrom-SecureString -SecureString $Password

# Save to File
$Encrypted | Set-Content Encrypted.txt
Section 2: Read Password File
# Read From File and Convert to System.Security.SecureString
$Password = Get-Content Encrypted.txt | ConvertTo-SecureString

2020-12-08

取得 AD 群組成員階層結構 Get AD Group Members Hierarchy

先參考這篇 取得 AD 群組成員的指令 Group Members List 

本篇為進階用,產生報表用

#-------------------------------------------------------
$OUFileter = 0
$UserOU = "OU=Users,DC=Contoso,DC=com"

$Groups = @()
$Groups += "Users_Group"
#-------------------------------------------------------

Integrated Windows Authentication with Apache 2.4 on Windows

Download mod_authnz_sspi from Here (The ApacheHaus US)

Uncompress it and copy mod_authnz_sspi.so to Apache\modules

Add Configuration in http.conf

LoadModule authnz_sspi_module modules/mod_authnz_sspi.so

2020-12-01

快速調整 User Profile Disk 磁碟與分割區大小

快速調整 User Profile Disk 磁碟與分割區大小
紅色部份為應調整參數

$ExtendDiskSize = 16; #in GB

$DiskPartCommandFileName = ((Get-Location).Path + '\DiskPartCommand.txt');

$ExtendDiskSize = ($ExtendDiskSize*1024*1024*1024);
$VHDxs = Get-ChildItem -path 'C:\VirtualDisks\Pool' -Recurse -Filter "*.vhdx" | select FullName;

在不支援 Hyper-V 虛擬化技術的機器上使用指令安裝 Hyper-V Role

只不過想用個 Resize-VHD 指令
被罵說沒有 Hyper-V Role,但這台機器 (Azure VM) 又不支援巢狀虛擬化 (懶得去設定)
只好用指令裝起來,但要記得裝好重開機之前用第二行指令設定開機時不要跑 Hypervisor
不然應該會壞掉

dism /online /enable-feature /featurename:Microsoft-Hyper-V
bcdedit /set hypervisorlaunchtype off