Question Activation Windows avec clé

Plus d'informations
il y a 7 ans 3 mois #27955 par Francois Schooter
Bonjour ,

J'ai un script qui permet de changer ma clé d'activation de Windows MAK en OEM:DM

Quand le script s'exécute il nous affiche un résultat, une clé d'activation.


J'aimerais pouvoir dire à mon script de prendre le résultat ( la clé d'activation) et pouvoir aller la mettre dans l'activation de Windows.




Voici le script


[code:1]$SFTCode = @\"

[DllImport(\"kernel32\"«»)] public static extern uint EnumSystemFirmwareTables (uint FirmwareTableProviderSignature, IntPtr pFirmwareTableBuffer, uint BufferSize);
[DllImport(\"kernel32\"«»)] public static extern uint GetSystemFirmwareTable (uint FirmwareTableProviderSignature, uint FimrwareTableID, IntPtr pFirmwareTableBuffer, uint BufferSize);

\"@

$SFT = Add-Type -MemberDefinition $SFTCode -Name \"SFTKlasse\" -Language CSharp -UsingNamespace \"System.Reflection\", \"System.Diagnostics\", \"System.Collections.Generic\" -PassThru

# 0?41435049=ACPI ? github.com/michaelforney/coreboot/blob/m.../src/include/cbmem.h
$firmwareTableProviderSignature = 0x41435049
$StructSize = $SFT::EnumSystemFirmwareTables($firmwareTableProviderSignature, [IntPtr]::Zero, 0)
try
{
$StructPtr = [Runtime.InteropServices.Marshal]::AllocHGlobal($StructSize)
}
catch [OutOfMemoryException]
{
throw Error[0]
}

$buffer = New-Object Byte[]($StructSize)
$SFT::EnumSystemFirmwareTables($firmwareTableProviderSignature, $StructPtr, $StructSize)
[Runtime.InteropServices.Marshal]::Copy($StructPtr, $buffer, 0, $StructSize)
[Runtime.InteropServices.Marshal]::FreeHGlobal($StructPtr)

if (([System.Text.Encoding]::ASCII).GetString($buffer).Contains(\"MSDM\"«»))
{
$firmwareTableMSDMID = 0x4d44534d

$StructSize = $SFT::GetSystemFirmwareTable($firmwareTableProviderSignature, $firmwareTableMSDMID, [IntPtr]::Zero, 0)
try
{
$StructPtr = [Runtime.InteropServices.Marshal]::AllocHGlobal($StructSize)
}
catch [OutOfMemoryException]
{
throw Error[0]
}

$buffer = New-Object Byte[]($StructSize)
$SFT::GetSystemFirmwareTable($firmwareTableProviderSignature, $firmwareTableMSDMID, $StructPtr, $StructSize)
[Runtime.InteropServices.Marshal]::Copy($StructPtr, $buffer, 0, $StructSize)
[Runtime.InteropServices.Marshal]::FreeHGlobal($StructPtr)

$encoding = [System.Text.Encoding]::GetEncoding(0x4e4)

$key = $encoding.GetString($buffer, 56, 29)
}
$key[/code:1]<br><br>Message édité par: Arnaud, à: 4/01/19 16:46

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 2 mois #27999 par Arnaud Petitjean
Bonjour,

Il affiche le résultat sous quelle forme ?
Graphique je suppose ?

Si c'est le cas, à mon avis il ne sera pas possible de le récupérer...

Arnaud

MVP PowerShell et créateur de ce magnifique forum :-)
Auteur de 6 livres PowerShell aux éditions ENI
Fondateur de la société Start-Scripting
Besoin d'une formation PowerShell ?

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.037 secondes
Propulsé par Kunena