ondrovic Posted December 30, 2012 Share Posted December 30, 2012 (edited) I have been trying to get slmgr.vbs to work from autoit but cant seem to get the darn thing to work here is my code $prodkey = "00000-00000-00000-00000-00000" Func _rekey($key) RunWait(@ComSpec & " /c " & "cscript %windir%\system32\slmgr.vbs /ipk " & $key, "", @SW_SHOW) RunWait(@ComSpec & " /c " & "cscript %windir%\system32\slmgr.vbs /ato","",@SW_SHOW) EndFunc _rekey($prodkey) I am sure I have the syntax correct Windows Software Licensing Management Tool Usage: slmgr.vbs [MachineName [user Password]] [<Option>] MachineName: Name of remote machine (default is local machine) User: Account with required privilege on remote machine Password: password for the previous account Global Options: /ipk <Product Key> Install product key (replaces existing key) /ato [Activation ID] Activate Windows /dli [Activation ID | All] Display license information (default: current license) /dlv [Activation ID | All] Display detailed license information (default: current license) /xpr [Activation ID] Expiration date for current license state Edited December 30, 2012 by ondrovic Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted December 31, 2012 Share Posted December 31, 2012 try something like this clipput("@ComSpec & " /c " & "cscript %windir%system32slmgr.vbs /ipk " & $key) and paste into into the console, and see what happens. Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
ondrovic Posted December 31, 2012 Author Share Posted December 31, 2012 Wow I feel like a duma$$ I forgot to call the function lol it seems to be working now Link to comment Share on other sites More sharing options...
copyleft Posted March 9, 2019 Share Posted March 9, 2019 Google bought me here. I'm surprised @ondrovic was pleased with the solution: I can't get @DiscatoroftheUSA's script to work, even after inserting the missing forward slashes in the %windir% file path. Link to comment Share on other sites More sharing options...
bolthead Posted March 9, 2019 Share Posted March 9, 2019 (edited) As a pointer, this works for me on widows 10 $iPID = Run(@ComSpec & " /K " & "cscript %windir%\system32\slmgr.vbs /dlv", "", @SW_SHOW) If you want to capture the output then this works #include <AutoItConstants.au3> $iPID = Run(@ComSpec & " /c " & "cscript %windir%\system32\slmgr.vbs /dlv", "", @SW_HIDE, $STDOUT_CHILD) $sOutput = "" While 1 $sOutput &= StdoutRead($iPID) If @error Then ExitLoop WEnd MsgBox(0, "Licencing Information", $sOutput) To insert a product key you may need admin rights, I'm not sure. Edited March 9, 2019 by bolthead Better example Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now