Jump to content

Recommended Posts

Posted

Hi everyone, 

I'm new to the autoit world and am trying to do something a little complicated and am having trouble developing a solution. My OS after reimaging comes up with two operating system choices during boot up, I'd like to delete the incorrect OS. I have noticed that the default OS is always the correct OS. My issue is I need a way to find the OS identifier before I can delete. I know that I  can use bcdedit to find this but it changes every time and it needs to be the correct identifier (i.e. not the Default or bootmgr). If someone knows of a way to parse through the output of bcdedit to find the identifier that would be greatly appreciated. Here is an example of what I am trying to do:

https://scottiestech.info/2016/07/03/remove-the-choose-an-operating-system-message-when-starting-your-computer/

Posted (edited)

in before moved, answered, search for the win

$colItems = ""
$Output=""
$objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 0x30)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $objItem.Caption & " " & $objItem.Version & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_OperatingSystem" )
Endif

when you guys search, do you use a strange dialect or pirate language? I don't get it.

I am creating a new thing right here. Pirate Query Language or PQL for when you absolutely need to obfuscate any logic or reason from your search.

 

Be Ye seeking OS names from yonder files, something like that

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Posted

Hi everyone, 

I'm new to the autoit world and am trying to do something a little complicated and am having trouble developing a solution. My OS after reimaging comes up with two operating system choices during boot up, I'd like to delete the incorrect OS. I have noticed that the default OS is always the correct OS. My issue is I need a way to find the OS identifier before I can delete. I know that I  can use bcdedit to find this but it changes every time and it needs to be the correct identifier (i.e. not the Default or bootmgr). Moreover I'm trying to do this all from WinPE but it wont let me even access bcdedit. If someone knows of a way to parse through the output of bcdedit  to find the identifier and have bcdedit open on WinPE that would be greatly appreciated. Here is an example of what I am trying to do: 

https://scottiestech.info/2016/07/03/remove-the-choose-an-operating-system-message-when-starting-your-computer/

  • Moderators
Posted

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
×
×
  • Create New...