CCCPaste

Get_WindowsProductkey2CLIP(PS).vbs

' IT Groceries , Youtube , Facebook , Blogspot
Const TemporaryFolder = 2

Dim fso: Set fso = CreateObject("Scripting.FileSystemObject")

' Get the path to the Temp folder
Dim tempFolder: tempFolder = fso.GetSpecialFolder(TemporaryFolder) & "\"

' Create WScript Shell object
set wshShell = createobject("wscript.shell")

' Create the temporary batch file
Set ar = fso.createtextfile(tempFolder & "WindowsProductKey.cmd", true)

ar.writeline " @echo off "  
' เปลี่ยน WMIC เป็นคำสั่ง PowerShell:
' 1. Get-CimInstance SoftwareLicensingService: ดึงข้อมูล WMI
' 2. Select -ExpandProperty OA3xOriginalProductKey: เลือกเฉพาะค่า Product Key
' 3. Out-String -Stream: ทำให้ผลลัพธ์เป็น String ที่สะอาด
' 4. Clip: คัดลอกผลลัพธ์ไปที่ Clipboard
ar.writeline " powershell -Command ""(Get-CimInstance SoftwareLicensingService).OA3xOriginalProductKey | Out-String -Stream | Clip"""  

ar.close
wshShell.run tempFolder & "WindowsProductKey.cmd", 0, true

' IT Groceries , Youtube , Facebook , Blogspot