romulocarlos

How to detect Windows 10 Anniversary Edition?

4 posts in this topic

#1 ·  Posted

Hello.

I'm building a script to install some windows updates with a GUI. For this, the script need to know witch windows version to work: Windows 7, Windows 7 SP1, Windows 8, Windows 8.1 and so on. I read this article, but it don't list Windows 10 Anniversary Edition. So, I run into build version, because they are different between them.  The first is 10586, and Anniversary is 14393.

So, somewhere on my script I have this:

If @OSVersion = 'win_10' Then
    $versao_windows = 'Windows 10'
ElseIf @OSVersion = 'win_10' And @OSBuild = 14393 Then
    $versao_windows = 'Windows 10 Edição De Aniversário'
    $win10ae = 1
EndIf

As you see, "$versao_windows" is the "friendly" name to be showed on the GUI, and "$win10ae" will be the variable to be used to distinguish the windows version to use. But the script still showing the 'normal' Windows 10 version, even if it is running on Anniversary Edition. On the status bar, it rightly shows the 14393 build, but don't shows "Windows 10 Edição De Aniversário".

I need this to install the correct updates, because they are different from one build to another.

Where I'm wrong on my code?

Thanks in advice!


 

Share this post


Link to post
Share on other sites



#2 ·  Posted

9 minutes ago, romulocarlos said:

Where I'm wrong on my code?

May at a other place, the snipet ic correct. Make a runable (reproducer) script, showing your issue(s).

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I think your approach with if statement (as it stands) isn't using the best logic.  I suspect since the first condition is true, the rest does not process.

This is how I would do it: check the windows version first, then evaluate subversion.

;crude example
If @OSVersion = "WIN_10" Then
    $versao_windows = 'Windows 10'
    If @OSBuild = 14393 Then 
        $versao_windows &= "  Edição De Aniversário"
        $win10ae = 1
    EndIf
EndIf


edit: just a demo further demonstrate why your logic doesn't work:

$iValueA = 1
$iValueB = 1

If $iValueA = 1 Then
    $sTest = "$iValue = 1"
ElseIf $iValueA = 1 And $iValueB = 1 Then
    $sTest = "$iValue = 1 And $iValueB = 1"
EndIf
msgbox(0,"First demo Result",$sTest)

If $iValueA = 1 Then
    $sTest = "$iValueA = 1"
    If $iValueB = 1 Then
        $sTest &= " And $iValueB = 1"
    EndIf
EndIf
msgbox(0,"Second demo Result",$sTest)


 

Edited by spudw2k
1 person likes this

Share this post


Link to post
Share on other sites

#4 ·  Posted

Nevermind, solved.

I change the lines with

ElseIf @OSVersion = 'win_10' And @OSArch = 'x64' And @OSBuild < '11000'  Then

for normal version, and 

ElseIf @OSVersion = 'win_10' And @OSArch = 'x64' And @OSBuild > '11000'  Then

for Anniversary Edition.

Is detecting fine, now.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • parrishjason
      Spawning Interactive Shell with AutoIT [over psexec?]
      By parrishjason
      I am trying to spawn a cmd.exe shell on a remote machine using psexec then proceed to running commands on that machine and reading the output. I.e. running pwd. 

      Unfortunately, the code I have now will just immediately exit cmd on the remote system 
      I'm trying to use the current code
      #include <Constants.au3> $pid = Run('C:\Users\test\Desktop\psexec.exe \\192.168.1.123 -u test -p "P@$$word1" -h -s cmd',@SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) StdinWrite($pid,"pwd") StdinWrite($pid,@CRLF) Local $data Sleep(2000) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) StdinWrite($pid,"cd ") StdinWrite($pid,"C:\users\test2") StdinWrite($pid,@CRLF) StdinWrite($pid) $data &= StdoutRead($pid) ConsoleWrite("Debug:" & $data & @LF) http://stackoverflow.com/questions/19206834/command-prompt-and-autoit-stdinwrite <- credits to this stack overflow post
      Unfortunately, on my end, my cmd just starts/stops with this prompt
       
      Connecting with PsExec service on 192.1.123...Starting cmd on 192.168.1.123... cmd exited on 192.168.1.123 with error code 0. Any ideas how I can keep my shell open over psexec and still interact with it using AutoIT?

      Any feed back would be amazing! Thanks!
    • Eddi96
      Logoff users in CMD with ID
      By Eddi96
      Hey guys!
      I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with:
      Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like:
       BENUTZERNAME          SITZUNGSNAME       ID  STATUS  LEERLAUF   ANMELDEZEIT
      >wg                                  console                       2  Aktiv                     17    25.07.2016 08:19

      What I need right now is the ID. Any Idea on how to read it off of the Textfile?
      Please give me examples because I am still a rookie!
       
      With kind regards
      Eddi96
       
       
    • GreenSparks
      Change Kayboard and Region via Registry in Windows
      By GreenSparks
      Hi!
      I post here because i was wonderring if someone in this forum could help me with my script.
      What i'm trying to do, is to basically install a new keyboard layout in Windows and activate it. I want to acheive by the registry or the command line, but not with the autoit automation tools, i don't find it stable...
      Thanks for your help and have a good day!
    • Skysnake
      Change options in Windows Explorer "New" menu
      By Skysnake
      Hi
      My new Win10 PC has decided that I am not allowed to create OpenOffice text or spreadsheet documents, but some other stuff I never use.  I would like advice on how to customize the "New" context(?) menu in the Windows Explorer "New" submenu.
      I attach a screenshot.
      Essentially, how do I customize that item? 
       

    • clariceo0
      Free library for resetting windows password?
      By clariceo0
      Recently, I am interested to build a windows app to reset Windows login password as a side off project. I am still a newbie in programming so i am not able to build the app from scratch. Is there any open source  project i could learn from on this?