Sunday, October 15, 2006

QA - problems running WScript.Shell on 64bit Windows



I'm having trouble running a bat file from an ASP page. It works fine on Windows 2003 Std x32 server but fails now we have upgraded to the x64 edition

In the ASP we are trying to run the following

Set oWSH= Server.CreateObject("WScript.Shell")

errmsg = oWSH.Run("d:\\scripts\\copyiissettings.bat",0,True)

set oWSH = nothing

The errmsg is returning 1 (not very helpful)

In the BAT file we are running the following command: cscript.exe c:\windows\System32\iiscnfg.vbs /copy /ts %1 /tu machineusername /tp machinepassword

I am sure the permissions are setup correctly in IIS as both the Application Pool and Authenticated Anonymous User are set as the Administrator. We are also running IIS with he following flag enabled Enable32BitAppOnWin64=True

I can only think maybe there is a problem being related to the fact we are running x64 and perhaps there is a registry setting or group policy setting i need to change?


i figured it out.

problem is that when you call the bat from the ASP it runs as a 32 bit process and runs the cscript.exe from the SYSWOW64 directory and this fails. i copied the cscript.exe from the System32 into the SYSWOW64 directory and this fixed the problem. hopefully this wont cause another problem somewhere else?!


Yes, your resulution is one way to address your specific issue, but in general I prefer to modify/manipulate system files only after understanding what is going on and the full ramifications of the change.

Because you configured Enable32bitAppOnWin64=1, WOW64 interactions came into play and complicated matters. Here is what is going on:

  1. When you configure Enable32bitAppOnWin64=1 in IIS6, it makes IIS launch 32bit worker process (w3wp.exe) to handle requests. You see it as w3wp.exe*32 with 64bit Task Manager
  2. The 32bit worker process reads configuration and determines that .ASP is handled by C:\windows\System32\ASP.DLL and attempts to load that DLL
  3. WOW64 subsystem on 64bit Windows triggers when a 32bit process attempt to reach C:\windows\System32 and transparently redirects it to C:\windows\SYSWOW64. So, C:\windows\SYSWOW64\ASP.DLL (32bit DLL installed by IIS6 on 64bit Windows) is loaded by the worker process
  4. 32bit ASP DLL parses the ASP page and looks up ProgId for WScript.Shell in the registry. The Registry also transparently redirects access to Registry by 32bit process to the appropriate Wow6432Node inside the Registry. End result is that the 32bit OCX implementing WScript.Shell eventually gets located and loaded
  5. oWSH.Run( "d:\\scripts\\copyiissettings.bat" ) eventually translates into a CreateProcess() Win32 API call made by the 32bit worker process. The .BAT extension is looked up to be processed by C:\windows\System32\CMD.EXE , but will get redirected by WOW64 to C:\windows\SYSWOW64\CMD.EXE (32bit) in the same way as ASP.DLL earlier
  6. 32bit CMD.EXE eventually encounters the CSCRIPT.EXE statement, and after a path lookup and WOW64 redirection, it will run C:\windows\SYSWOW64\CSCRIPT.EXE (32bit) to process c:\windows\System32\iiscnfg.vbs
  7. When 32bit CSCRIPT.EXE tries to load c:\windows\System32\iiscnfg.vbs , WOW64 will redirect it to c:\windows\SYSWOW64\iiscnfg.vbs - which does not exist - and the execution fails with a file-not-found

Based on the above, the following are possible resolutions:

  • Set Enable32BitAppOnWin64=0. This turns off WOW64 everywhere at the source. This may not be possible because you may have legacy web applications which require 32bit. However, if this is the case, I question why you run 64bit Windows at all - running IIS6 in 32bit compatibility mode on 64bit Windows drags in all the WOW64 compatibility cruft without giving much 64bit advantages (the 32bit w3wp.exe still has a 32bit Address Space)
  • Copy 64bit CMD.EXE to %systemroot%\SYSWOW64 . This may not be desirable because legacy applications may depend on 32bit CMD shell behavior
  • Copy 64bit CSCRIPT.EXE to %systemroot%\SYSWOW64 . This may not be desirable because legacy applications may depend on 32bit Windows Scripting behavior
  • Duplicate the IIS Admin .vbs Scripts and IISSCHLP.WSC from %systemroot%\System32 to %systemroot%\SYSWOW64 and use %systemroot%\SYSWOW64\REGSVR32.EXE to register IISCHLP.WSC into the 32bit Registry on 64bit Windows. This creates duplicate .vbs cruft but accomplishes your task without impacting any other part of the system

Good luck



Anonymous said...

i tried the last step you suggested and i get
DllRegisterServerEx in C:\Windows\SysWow64\scrobj.dll failed Return cose was 0x800c0005

Anonymous said...

Catch the wow gold star that holds your gold in wow destiny,cheap wow gold the one that forever maplestory money twinkles within your heart. Take advantage of precious opportunities while they still sparkle before you. Always believe that your buy maplestory mesos ultimate goal is attainable cheap mesos as long as you commit yourself to it.maple money Though barriers may sometimes stand in the way of your dreams, remember that your destiny is hiding behind gold kaufen Accept the fact that not everyone is going to approve of the choices Maple Story Accounts you've made. Have faith in your gold farmen Catch the star that maple story money twinkles in your heart and it will lead you to your destiny's path. Follow that pathway and uncover the sweet sunrises that await you. Take pride in your accomplishments, as they are stepping stones to your dreams. Understand that you may make mistakes, powerlevelbut don't let them discourage mesos Value your capabilities and talents for they are what make you truly unique. The greatest gifts in life are not purchased, but acquired through hard work and determination.maplestory mesos Find the star that twinkles in your heart?for you alone maplestory powerleveling are capable of making your brightest dreams come true. Give your hopes everything you've got and you will catch the star that holds your destiny.

Anonymous said...

Now do you worried about that in the game do not had enough 2moons dil to play the game, now you can not worried, my friend told me a website, in here you can buy a lot 2moons gold and only spend a little money, do not hesitate, it was really, in here we had much 2moon dil, we can sure that you will get the cheap 2moons gold, quick to come here to buy 2moons dil.

Now do you worried about that in the game do not had enough 9Dragons gold to play the game, now you can not worried, my friend told me a website, in here you can buy a lot 9 Dragons gold and only spend a little money, do not hesitate, it was really, in here we had much 9Dragons money, we can sure that you will get the cheap 9Dragons gold, quick to come here to buy 9 Dragons gold.

Anonymous said...

Instead of duplicating the files, another option is to use FSUTIL to create a hardlink to those files in the other folder. This effectively makes the same single file exist in both folders. Edits to one location are instantly reflected in the other.

Adi said...

Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.

Anonymous said...

Good Day! Sang Brown . payday loans

Unknown said...

If you have been looking for the right BEWITCHED to AVI converter that is powerful as well as customer friendly then you have certainly found one. It is not only easy to use BEWITCHED DVD but extremely convenient to. You will adore the speed at which it can go on to convert and diversify BEWITCHED DVD COLLECTION videos into video formats and at the most satisfactory of quality output possible.

lida can be put to use to reduce the effort that is required for reducing weight. You can easily reduce your body weight with the help of lida daidaihua that are available. There are slimming capsules that are making these products available. You can use the weight loss products with daidaihua for better and faster improvement in body weight. There are a number of ways of checking out the lida slimming that are available. You can take the help of the internet to check slimming capsule that are available.

Unknown said...

louis vuitton is roomy for daily essentials. Moreover, lv has flat and phone pockets on the inside and another flat pocket on the outside to add to Louis vuitton bags practicality. Two handles and adjustable shoulder strap enable it to be carried by three ways, in the hand, on the shoulder or across the body. The very versatile louis vuitton handbags makes a harmonious combination with your everyday outfit.

jimmychooshoes said...

Jimmy Choo China strappy sandals
Jimmy Choo Patent leather sandals
Christian Louboutin - Declic leather pumps
Christian Louboutin Very Jaws 140 pumps
Alexander McQueen black skull zipper bootie
mcqueen shoes
alexander mcqueen heels
Alexander McQueen Store
Jimmy Choo sale
Replica jimmy choo shoes
manolo blahnik online store
manolo shoes
manolo blahnik sale
replica christian louboutin shoes
discount christian louboutin shoes
alexander mcqueen shoes
jimmy choo outlet
jimmy choos
jimmy shoes
Manolo Blahnik Shoes
christian shoes

Unknown said...

If you are British, it's so good that there are Yves Saint Laurent uk, YSL shoes, Let me tell you
YSL shoes
Yves Saint Laurent shoes
Cheap YSL shoes
replica YSL shoes
discount YSL shoes
louboutin almeria wedges

christian louboutin shoes said...

Red soled shoes are Christian Louboutin's signature logo, highlighting women's lovely, beautiful and not play mature sexy.
In the world of Christian Louboutin shoes heels that French is absolutely impossible to ignore. It is Europe's favorite actress! In this fall season, a pair of sophisticated open-toed shoes, square head would be a good choice
for example
Christian Louboutin Spiked Platform Slingback
christian louboutin bikiki 140 pony pumps-red ,I like this one,it is so beautiful,and this one it is very cheap
Christian Louboutin Pointed Toe Pink Pumps .this one is vety comfortful

Christian Louboutin Glittered Platform Pump Marine ,I like this colour
Christian Louboutin Horsehair Hidden Platform pumps ,This pair was fit
Christian Louboutin Mary Jane Platform

we like it ,it is very beautifulChristian Louboutin Shoes makes you beautiful.The soft skin, which under her dress, and sexy ankle pumps, draw the attention of all people.People think the popular high-heel shoes will stand by their sexy and fashion. Christian Louboutin Pumps and Christian Louboutin Wedges with the most stylist clothes and become the most charming and fashionable one in the crowd.
If you don’t have a pair of cheap Christian Louboutin sandals sale 2011, other people may say that you are out of date now. These shoes are the best speaker of the leading fashion in today’s shoes market.
The Christian Louboutin Petal Sandal Neon pink
sold on our website are of the high quality and you can enjoy the biggest discount here. So do not miss such a good chance to get these amazing shoes at the lowest price. These shoes are perfectly meet your elegant dress and even hair styles. Once you had tried on Christian Louboutin , you just can not forget the beauty they brought to you. The lovely Christian Louboutin can make your leg so sexy and you need to have them on your pretty little toes and your beautiful painted nails. We are now offering the best quality Christian Louboutin Madame Butterfly very affordable price, these shoes are high class and comfortable. This brand is well known for the most fashionable designs and the elegant looking. So if you want to keep the same pace with the fashion trend the
Christian Louboutin Glittered Platform Pump Oxblood
2011could be your best choice.

Manolo Blahnik Shoes said...

A portion of the sale proceeds from both items will benefit the New York Restoration Project, Manolo Blahnik Shoes Accept paypalwhich was founded by superstar Bette Midler, who is one of Priscilla's producers.
"If there are three things I love it is shoes, drag queens and live theatre!" said Midler, in a statement. "I am so thrilled that Manolo Blahnik Shoes and Priscilla have come together to benefit a cause near and dear to my heart, the New York Restoration Project. Go out and buy these shoes! You will look fabulous and help green and clean New York City one block at a time!"
The show, which is based on the Academy Award-winning film, Manolo Blahnik Pumpsis directed by Simon Phillips and written by Stephan Elliott and Alan Scott. The cast of 27 is led by Will Swenson, Tony Sheldon, and Nick Adams, and features Anastacia McCleskey, Jacqueline B. Arnold, and Ashley Spencer as "The DIvas".
At preview performances March 3-12, Blahnik will give away a $700 gift certificate to the store to celebratemanolo blahnik shoes discounted the first two weeks of Priscilla's Broadway previews. A total of 14 gift certificates will be given away to a randomly selected audience member during each performance.

Darin said...

The christian louboutin store was designed for the ladies. Since the louboutin heelswas born, the ladies life become colorful.The elegant pattern, the delicate style all mold the ladies perfect leg profile. The christian louboutin evening pumps are the god's masterwork. Who invited the christian louboutin pumps? Seldom people knew, but I think every lady would be grateful for him. Among the countless pumps, the christian louboutin peep toe is the most outstanding ones. Flowers in the spring of 2011 creeping, up from hair to clothes continue to footwear, have had a brilliant up. In such a glamor, spring and summer flowers now here. Romance is a woman's mood, exquisite flowers just right of expression in our gestures, the woman, how can we not love the romantic temperament so that they distributed the flowers do? 2011 flowers bloom will enjoy different poses! The Christian Louboutin 2011 Sandals also can adds the hright of the ladies, it bring surprise to the short lady. Especially the red sole of the louboutin heels, magic and sexy, many ladies are crazy. The red sole, the first feature of the Christian Louboutin heels.

Anonymous said...

Let`s write that letter we thought of writing "one of these days Tibia Gold, just because someone doesn't love you the way you want them to, doesn't mean they don't love you with all they have Tibia coins, don't waste your time on a man/woman, who isn't willing to waste their time on you sro gold.

Anonymous said...

Life is like a hot bath. It feels good while you're in it, but the longer you stay in, the more wrinkled you get rs gold, Life is too short to wake up in the morning with regrets. So, love the people who treat you right and forget about the ones who do not Runescape Gold, In the Orient young bulls are tested for the fight arena in a certain manner rs gold. Each is brought to the ring and allowed to attack a picador who pricks them with a lance..