MattHiggs Posted January 1, 2023 Share Posted January 1, 2023 (edited) Hey guys. So, I have an autoit script that I wrote which is meant to activate windows on a fresh install of the operating system. The code looks something like this: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If @OSVersion = "WIN_10" Or @OSVersion = "WIN_2016" Then If @OSVersion = "WIN_10" Then Run ( @ComSpec & " /c " & 'slmgr.vbs -ipk <a key>' ) $one = WinWait ( "Windows Script Host", "Installed product key <a key> successfully.", 5 ) WinActivate ( $one ) WinWaitActive ( $one, "", 5 ) ControlClick ( $one, "", 2 ) Else Run ( @ComSpec & " /c " & 'slmgr.vbs -ipk <a key>' ) $one = WinWait ( "Windows Script Host", "Installed product key <a key> successfully.", 5 ) WinActivate ( $one ) WinWaitActive ( $one, "", 5 ) ControlClick ( $one, "", 2 ) EndIf ElseIf @OSVersion = "WIN_11" Or @OSVersion = "WIN_2022" Then MsgBox ( 1, "Hello", "This is windows 11 or server 2022" ) Run ( @ComSpec & " /c " & 'slmgr.vbs -ipk <os key>' ) $one = WinWait ( "Windows Script Host", "Installed product key <os key> successfully.", 5 ) WinActivate ( $one ) WinWaitActive ( $one, "", 5 ) ControlClick ( $one, "", 2 ) Else EndIf RunWait ( @ComSpec & " /c " & 'cscript //B "' & @SystemDir & '\slmgr.vbs" /ato' ) As you can see, for troubleshooting purposes, I included a messagebox in the event @OSVersion macro is Win_11 or Win_2022. I just deployed windows 11 to one of my devices this evening and attempted to use the above script to activate my machine, and not only did the message box not appear, but my device was not activated. This tells me that the @OSVersion macro does not correctly detect windows 11 or windows server 2022 machines (I also tested this on a windows server 2022 machine and ran into the same problem). The macro does work for all of the other operating system versions. Edited January 3, 2023 by MattHiggs Link to comment Share on other sites More sharing options...
Danp2 Posted January 1, 2023 Share Posted January 1, 2023 It should be working correctly in the latest release and / or beta. Which version are you using? MattHiggs 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
MattHiggs Posted January 3, 2023 Author Share Posted January 3, 2023 On 12/31/2022 at 10:53 PM, Danp2 said: It should be working correctly in the latest release and / or beta. Which version are you using? @Danp2Hmm. I will recompile the script to see if that might be the issue, but these are the versions running on my machine: Link to comment Share on other sites More sharing options...
MattHiggs Posted January 3, 2023 Author Share Posted January 3, 2023 @Danp2I will be damned. When I went to re-compile the script, I noticed that autoit was compiling the script using the BETA version of autoit. When I re-compiled the script using the production version of autoit, the script worked as intended. Thanks for the input!! Link to comment Share on other sites More sharing options...
Danp2 Posted January 4, 2023 Share Posted January 4, 2023 @MattHiggsThis line in your script is likely the culprit -- #AutoIt3Wrapper_Version=Beta 😉 Latest Webdriver UDF Release Webdriver Wiki FAQs 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