Thursday, July 7, 2016

Uninstalling Intel SSD Toolbox 3.0.1 and fixing error "Launch Anywhere Error: Windows error 2 occured while loading the Java VM"

Skip to summary towards the bottom and bypass my methodology and some rambling.

Trying to uninstall Intel SSD Toolbox 3.0.1, but received error "Launch Anywhere Error: Windows error 2 occured while loading the Java VM".

It actually started when I tried to install the latest version of 3.3.6, as it tries to uninstall the old version but that Launch Anywhere error popped up but I dismissed it and didn't quite notice the previous version had not uninstalled.


My first thought was to reinstall the old SSD Toolbox 3.0.1 but as Intel has removed it from downloads and most 3rd party sites just would link back to the defunct Intel download -- most search results turn out to be defunct, yet eventually not only was I able to find a proper mirror to download it, but it actually turned out that original download (five years later) was still in the downloads directory.   So I reinstalled the old program but yet it still produced the same error when trying to uninstall.  Failure and 10 minutes of wasted time...  (truly wasted since as I only needed to check the original downloads).

Secondly, I shifted my focus to Java... so I tried to duplicate jre7 and just create a directory by quickly using mklink to create a jre7 junction to the current jre8 installation, but that didn't produce any results.  So as I couldn't fool things into believing jre8 was jre7, I thought I'd get the real thing but it turns out that Oracle (like Intel) has also removed old downloads and jre7 was no longer readily available for most people (for the most part)... I however was able to download the latest jre7u80 but that didn't fix anything so I went further back and looked at SSD toolbox and to see it was from November 2011 so I checked the release dates for Java and that era's jre release was the original jre7 released August 2011.  So after I installed the original jre7 from 2011, and I was finally able to uninstall SSD,   Success!!!

Now, after uninstalling everything, I am able to reinstall SSD Toolbox 3.3.6 and jre8u92 (which we do need for a certain app)... but during the small interval that I didn't have either of those installed, I clean and clear the computer of anything Oracle, Sun and SSD related (you might try ccleaner but I manually sought out and removed relevant directories myself).



Summary:  remove all java, remove all SSD toolbox (failure), find and download old jre7u0 to install, now you can uninstall old SSD and once done, then you can uninstall the old jre7 you've just installed.   Now reinstall the latest SSD and if needed, and only if you have some programs that require java, then you may also install the latest java.

So no trick.  Just needed old 2011 Java from when the SSD program was installed.

`™

Sunday, October 20, 2013

removing stupid "Administrator :" command prompt titlebar prefix to fix taskbar

I  constantly have several administrator cmd prompts open because whatever most people can try to do in "windows" and a mouse, it is often twice as fast from a command prompt, and then there is the added advantage that I can also scroll up and review or replay or tweak commands then combine them and create scripts all beyond the scope of anything done in a GUI... ahh, the power of scripting.

Anyways... so administrator command prompts windows in the taskbar, titled as "Administrator: ", all appear truncated in the taskbar as "Admi" which are troublesome to differentiate if two or more of those are cmd tasks.

So, I was looking for a quick way to re-patch my Windows 8 installation... and now my Windows 8.1 installation and various Windows Servers I deal with... and someone out there asked if there was such a tool so I though I'd spend a few minutes and here is another script that I can now use and take 3 seconds to update a Windows whenever I need...

This is close to OK, but it sometimes doesn't always work... a problem with permissions -- you may need to either "run as administrator" this VBS from explorer or even try steps #2 and #3 yourself, so go to "C:\Windows\System32\en-US\" and change owner and permissions of "cmd.exe.mui" from explorer then try to run this script again... But actually most times, I can just run it once directly and it will work successfully...   So it usually it works, but here is the sequence of things it does:
  1. check to see if backup exist to see if we've already patched the .mui
  2. load the original .mui file into memory
  3. patch the .mui file in memory
  4. take ownership of the .mui file
  5. allow permissions for the .mui file
  6. backup the .mui file
  7. save replace the .mui file
  8. run mcbuilder to update the system
So this is my "cmdA_patch.vbs" (click link to download) script that I have in the cloud so I can run it easily:

  Set fso = CreateObject("Scripting.FileSystemObject")
  set wso = CreateObject("wscript.Shell")
  b64 = true  '' try this if 32bit patch fails
  b64 = false '' normally this will work in 64bit windows

  oldString = "Administrator: %0" & chr(13) & chr(10) & chr(0)
  newString = "! %0" & chr(0) 

  if Wscript.arguments.count > 0 then
  if Wscript.arguments(0) = "-r" then
  newString = oldString '' revert to original
  end if
  end if

  newString = newString & right(oldString,len(oldstring)-len(newstring))
  if len(newString) <> len(oldString) then '' newString must to be same length as oldString
    wscript.echo "ABORT: replacement newString can not be longer than original"
    wscript.Quit
  end if


  ''#0 exists   cmd.exe.mui.0
  if fso.FileExists("C:\Windows\System32\en-US\cmd.exe.mui.0") then
    wscript.echo "warn: backup already exists doing update"
    sourcefile = "C:\Windows\System32\en-US\cmd.exe.mui.0"
    bOriginal = false '' doing an update sourcing backup
  else
    sourcefile = "C:\Windows\System32\en-US\cmd.exe.mui"
    bOriginal = true  '' doing first time sourcing original
  end if

  wscript.echo "#1 read.mod cmd.exe.mui"
  dim binData
  binData = loadBinaryFile(sourcefile)

  '' if 1F9EC = "Administrator: %0" cr nl 00 then replace 1F9EC = "21 00 20 00 25 00 30 00" '' 
  if instr(binData,uniString(oldString)) then
    wscript.Echo "found string, patching with: " & newString
    binData = Replace(binData, uniString(oldString), uniString(newString), 1,1,0)
  Else
    wscript.Echo "ABORT: 'Administrator:...' string not found"
    wscript.Quit
  End If

  saveBinaryFile binData , "C:\Windows\System32\en-US\cmd.exe.mui.1"

 if bOriginal then '' doing for the first time
  wscript.echo "#2 take.own cmd.exe.mui with takeown"
  wso.Run "takeown /f C:\Windows\System32\en-US\cmd.exe.mui"
if b64 then wso.Run "takeown /f C:\Windows\SysWOW64\en-US\cmd.exe.mui"
  wscript.Sleep 2000
  wscript.echo "#3 fix.perm cmd.exe.mui with icacls"
  wso.Run "icacls C:\Windows\System32\en-US\cmd.exe.mui /grant administrators:F"
if b64 then wso.Run "icacls C:\Windows\SysWOW64\en-US\cmd.exe.mui /grant administrators:F"
  wscript.Sleep 2000
  wscript.echo "#4 ren/back cmd.exe.mui as cmd.exe.mui.0"
  fso.MoveFile "C:\Windows\System32\en-US\cmd.exe.mui"  , "C:\Windows\System32\en-US\cmd.exe.mui.0"
if b64 then fso.MoveFile "C:\Windows\SysWOW64\en-US\cmd.exe.mui"  , "C:\Windows\SysWOW64\en-US\cmd.exe.mui.0"
  wscript.Sleep 2000
 end if
  wscript.echo "#5 replace  cmd.exe.mui"
  saveBinaryFile binData , "C:\Windows\System32\en-US\cmd.exe.mui"
  fso.CopyFile "C:\Windows\System32\en-US\cmd.exe.mui.1", "C:\Windows\System32\en-US\cmd.exe.mui", True
if b64 then fso.CopyFile "C:\Windows\System32\en-US\cmd.exe.mui.1", "C:\Windows\SysWOW64\en-US\cmd.exe.mui", True

  wscript.echo "#6 execute  mcbuilder"
  wso.Run "mcbuilder"
  wscript.Quit



Function uniString(astr)
  for x = 1 to len(astr)
    uniString = uniString & mid(astr,x,1) & chr(0)
  next
end function


Function loadBinaryFile(path)
  Dim fso, ts, a, i
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set ts = fso.getFile(path).OpenAsTextStream()
  a = makeArray(fso.getFile(path).size)
  i = 0
  While Not ts.atEndOfStream '' Don't use = by ts.readAll(), as not BinaryFile
      a(i) = ts.read(1)
      i = i + 1
  Wend
  ts.close
  loadBinaryFile = Join(a,"")
  wscript.echo "read "  & path & " " & fso.getFile(path).size & ", close"
End Function


Sub saveBinaryFile(bstr, path)
  Dim fso, ts
  Set fso = CreateObject("Scripting.FileSystemObject")
  ''On Error Resume Next
  Set ts = fso.createTextFile(path)
  If Err.number <> 0 Then
      wscript.echo "Error: " &  Err.message
      Exit Sub
  End If
  ''On Error GoTo 0
  ts.Write(bstr)
  ts.Close
  wscript.echo "close save " & path
End Sub


Function makeArray(n)
  makeArray = Split(Space(n)," ")
End Function
 
.x


Wednesday, September 4, 2013

MSSE virus symlinkd duplicates

damn, some other virus... first time ever they've deleted wuservice, but first I want to fix "Microsoft Security Client" directory and it's symlink symlinkd crap.

symlink s are easy... rd /q /s.
but symlinkd are more difficult:

fsutil reparsepoint delete en-us
fsutil reparsepoint delete Drivers
fsutil reparsepoint delete Backup
rmdir /q/s en-us
rmdir /q/s Drivers
rmdir /q/s Backup
cd ..
rd "Microsoft Security Client"