Alan's Blog

"Yeah. I wrote a script that will do that."

Scriptomatic on Windows 7 Solved

Posted on November 20th, 2011

I have been writing HTA files for a years as a way to improve the appearance of some of my scripts.  MSDN has a good article from May of 2011 about the power and utility of HTA files.  After moving to Windows 7 x64, I was disappointed to find that one of my favorite HTA files, Scriptomatic, had quit working.  Scriptomatic is a Microsoft utility that writes WMI code.  Unfortunately when running Scriptomatic I got this error on line 177, character 4:  “Could not complete the operation due to error 80041003”.  If you look at the code the line is: Set objWMIService = GetObject(“winmgmts:\\” & _strWMISource & “\” & strNameSpace) If you look up the error you find that it is WBEM_E_ACCESS_DENIED, “Current user does not have permission to perform the action.” If you search this problem with Scriptomatic in Google, you will find a slew of answers concluding that your only choice is to run the tool as an administrator.  This is true with the code as is, but I thought it would be more interesting to fix the problem, which is ultimately an error handing issue.  Scriptomatic tries to enumerate all of WMI.  An ordinary user cannot access all of WMI, so it fails with a permission error.  My version of Scriptomatic (Fixed_Scriptomatic.hta) adds error handling so an ordinary user can enumerate classes where there is permission to do so. Why do this?  I have another project where an ordinary user uses an HTA to get computer information.  I wanted to make sure that there would be no problems. My version of Scriptomatic adds error handling.  I have commented all of my changes.  If you are uneasy, then I suggest you download the original file and compare.  If you run my fixed version as an ordinary user, it will take a really long time to open.  On my system, a full two minutes. But the resulting list will be good for the current user’s credentials.  Note that HTA files run best from the local computer.

(Update: 1–24–12.  Fixed the embarrasing lack of a link to the file)

Filed under Alan's Favorites, HTA, Scripting, Windows 7, WMI |

2 Responses to “Scriptomatic on Windows 7 Solved”

  1. robin850 Says:
    January 20th, 2012 at 1:51 PM

    this sounds awesome, but I am unable to find the link to download your version of scriptomatic?

    did i miss a link somewhere?

    cheers,

    robin850

  2. Alan Says:
    January 24th, 2012 at 10:02 AM

    No, my fault. I continue to have issues with BlogJet. The link is fixed.

Leave a Reply

You must be logged in to post a comment.

Please Note:

All the scripts are saved as .txt files. Newer files have a "View Script" button which will let you save or open a script in notepad. For earlier posts, the easiest way to download with IE is to right click on the link and use "Save Target As". Rename file from Name_ext.txt to Name.ext.

To see a full post after searching, please click on the title.

PowerShell Scripts were written with Version 3 or 4.

https connections are supported.

Categories

Bad Behavior has blocked 576 access attempts in the last 7 days.