$MyInvocation.MyCommand (PowerShell 系統保留變數)
($MyInvocation.MyCommand).Path
$pid (PowerShell 系統保留變數)
寫入一個與 .ps1 主檔名相同、副檔名為 pid、內容為 pid 的檔案
技術記事與生活
$MyInvocation.MyCommand (PowerShell 系統保留變數)
($MyInvocation.MyCommand).Path
$pid (PowerShell 系統保留變數)
寫入一個與 .ps1 主檔名相同、副檔名為 pid、內容為 pid 的檔案
Import-Module -Name Az
# Create a VNet with a Site-to-Site VPN connection using PowerShell
# https://docs.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-create-site-to-site-rm-powershell
$RegionLocation = 'Japan East';
$ResourceGroupName = 'Infra_Network';
$vNetName = 'Corp-vNet';
$VirtualNetworkGatewayPublicIPName = 'Azure_VPN_IP';
$VirtualNetworkGatewayName = 'Azure_VPN_Gateway';
$LocalNetworkGatewayName = 'Local_VPN_Gateway';
$AzureVPNConnectionName = 'Azure_VPN_Connection';
$VPNSharedKey = (("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".tochararray() | sort {Get-Random})[0..32] -join '');
$GatewaySku = 'Basic';
$LocalNetworkIPAddress = '168.95.1.1';
$LocalNetworkAddressSpace = @('10.255.0.0/16');
$LocalRRAS_VPNName = 'AzureVPN';
$LocalDNSServer_Object = New-Object -Type PSObject -Property @{"DnsServers" = @("10.10.10.11")};
On Azure vNet Subnet: Apply Service Endpoint Policy (For Free)
Connecting from premise.
Private Endpoint per hour / Inbound per GB / Outbound per GB
Azure Files 就是 Storage Account 的 File Share,直接用 \\UNCPath\ 的方式存取效能不佳 (謎?)
如果在其上建立 VHDx 並在一台 VM 中 Mount 起來當成 File Server 來提供服務效能較佳,若用多個 VHDx 組成 Storage Pool 的話效能更好
Azure Files Standard file shares 單一檔案最大 1 TB,所以可以建立 5 個 1TB 的 Dynamic VHDx 掛接起來,建立 Simple Thin Virtual Disk 來使用,一樣取得 5TB 儲存空間,且具有高存取效率與重複資料刪除 Deduplication (Windows Server Feature),同時還可以 Pay as you go
$StorageArray 定義 Volume Name
$VolumeName 陣列定義 VHDx 成員 的 FullPath
完成以上定義後,Get-Volume 找目前系統中是否已經將 $StorageArray 中的每一個 Volume 都掛上,如果沒有,就檢查是哪一個 VolumeName 還沒掛上,將還沒掛上的 $VolumeName 陣列中的 VHDx 全部掛上。
##### 程式開始 #####
$TargetPath = 'C:\PathToBackup';
$ACLFile = 'C:\NTFSBackup.csv';
$PathReplaceKeyword = 'AKeywordToReplacePathForRetoreToDifferentPath'
$ACLArray = @();
$ACLArray += (Get-item -path $TargetPath | Get-ACL | Select-Object @{Name="Path"; Expression={($_.Path -Replace [regex]::Escape($TargetPath),$PathReplaceKeyword)}},Owner,Sddl);
$ACLArray += (Get-Childitem -path $TargetPath -recurse | Get-ACL | Select-Object @{Name="Path"; Expression={($_.Path -Replace [regex]::Escape($TargetPath),$PathReplaceKeyword)}},Owner,Sddl);
$ACLArray | Export-CSV $ACLFile -NoTypeInformation;
不知動到什麼東西導致 FSLogix 的 USer Profile 路徑下 NTFS Permission 亂掉
User Account 專屬的權限消失
因為 FSLogix 的目錄結構跟 Microsoft VDI 不一樣,所以不能直接用這篇文章的 Script 修
於是稍微修改一下成為以下 Script 來處理
===== 程式開始 =====
clear
write-host
write-host
$UPDPath = Read-Host -Prompt 'Input User Profile Disk Path'
$UPDFolders = Get-ChildItem -Path $UPDPath | Select Name,FullName
複製 NTFS ACL (Permission)
RoboCopy <source> <target> /MIR /SEC /SECFIX
差異化複製 Differential Copy
RoboCopy <source> <target> /e /xo /purge
不知為何在 Azure 上建立的 Windows 10 Multi-Session Version 用線上安裝語言包進度都不會動
而且之前記錄的這篇 Windows 10 Language Packs 多國語言字型問題 的指令敲下去也不會動
找了一下,微軟有提供語言包 ISO 檔可以下載
網頁中也有安裝的語法
要下載兩個 ISO 檔,分別是 Language ISO 與 FOD Disk 1 ISO
Mount 後直接下指令
以下列出常用的: 繁體中文、簡體中文及日文的安裝 Powershell Command