Something like this?
(Get-CimInstance -ClassName softwarelicensingservice).OA3xOriginalProductKey | Out-File 'C:\temp\key.txt' #Fixed
#.....
$key = Get-Content 'C:\temp\key.txt'
cscript.exe C:\Windows\System32\slmgr.vbs -ipk $key
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello all,
I'm starting to use powershell and i'm trying to get a certain results and i'm sure someone would be able to help me.
i'm using this command to get the Windows10 cd-key : wmic path softwarelicensingservice get OA3xOriginalProductKey
i would like to copy the results of this request and add it to this line : slmgr.vbs -ipk ( insert cd-key here )
i need to find a way to have this process automated
Thanks
Something like this?
(Get-CimInstance -ClassName softwarelicensingservice).OA3xOriginalProductKey | Out-File 'C:\temp\key.txt' #Fixed
#.....
$key = Get-Content 'C:\temp\key.txt'
cscript.exe C:\Windows\System32\slmgr.vbs -ipk $key
The second line is just a comment. What's in the $key variable? Does it read the file ok?
D'oh, my ISE changed the property name. It's OA3xOriginalProductKey, not OA3xOrslmgr