Computer >> Hướng Dẫn Máy Tính >  >> Hệ Thống >> Windows 10

PowerShell: Tạo mã QR cho mạng Wi-Fi trong Windows 10

Bạn có thể dùng PowerShell tạo mã QR để chia sẻ với bạn bè hoặc đồng nghiệp. Hãy xem ví dụ dùng module PowerShell QRCodeGenerator tạo ảnh mã QR dùng cho đồng nghiệp hoặc khách kết nối mạng Wi-Fi của bạn (vì bạn không muốn đọc mật khẩu cho từng người 😉).

Module QRCodeGenerator có thể tạo file PNG mã QR cho các loại đối tượng sau:

  • Thẻ liên lạc vCard (business card)
  • Dữ liệu địa lý (Geodata)
  • Cài đặt kết nối Wi-Fi

Bạn có thể tải module QRCodeGenerator thủ công (https://www.powershellgallery.com/packages/QRCodeGenerator/1.1) hoặc dùng lệnh Package Management:

Install-Module -Name QRCodeGenerator

Sau khi cài module, mở cửa sổ PowerShell mới hoặc import module:

Import-Module QRCodeGenerator

Thay đổi chính sách thực thi PowerShell (chạy script bên thứ ba):

Set-ExecutionPolicy Unrestricted -Scope Process

Module này có 3 cmdlet PoSh: New-QRCodeGeolocation, New-QRCodeVCard và New-QRCodeWifiAccess.

Để tạo mã QR cho thẻ liên lạc (vCard), dùng script:

$strFirstName = "Max"
$strLastName = "Bakarlin"
$strCompany = "WOSHub"
$strEmail = "admin@woshub.com"
$strPath = "$home\desktop\Contact\vCard.png"
New-QRCodeVCard -FirstName $strFirstName -LastName $strLastName -Company $strCompany –Email $strEmail -OutPath $strPath

PowerShell: Tạo mã QR cho mạng Wi-Fi trong Windows 10

Để tạo mã QR truy cập mạng Wi-Fi, chỉ định SSID mạng và mật khẩu kết nối. Ví dụ:

$strSSID = "WiFiGuestNet"
$strWiFipassword = "3bg397-v232"
$strPath = "$home\desktop\Contact\wifi.png"
New-QRCodeWifiAccess -SSID $strSSID -Password $strWiFipassword -Width 10 -OutPath $strPath

PowerShell: Tạo mã QR cho mạng Wi-Fi trong Windows 10

Nếu không nhớ mật khẩu điểm truy cập Wi-Fi hoặc Hotspot di động trên Windows 10, bạn có thể hiển thị SSID và mật khẩu cho profile mạng không dây đã lưu bằng lệnh:

netsh.exe wlan show profiles name='Profile Name' key=clear

Vào thư mục Contact trên desktop và kiểm tra có hai file PNG chứa mã QR.

PowerShell: Tạo mã QR cho mạng Wi-Fi trong Windows 10

Tính năng nhận diện mã QR kết nối Wi-Fi tích hợp sẵn trong iOS 11 và có sẵn trên nhiều smartphone Android. Ví dụ, hoạt động ngay out-of-the-box trên Xiaomi của tôi. Chỉ cần quét mã bằng camera, smartphone sẽ tự nhận ra mã QR chứa thông tin kết nối Wi-Fi và gợi ý lưu để kết nối mạng này (chụp màn hình từ Xiaomi chạy Android).

PowerShell: Tạo mã QR cho mạng Wi-Fi trong Windows 10