Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Windows Shell: Explorer vs Windows Explorer

22 Mar 2011   #1

Windows 7 Enterprise
Windows Shell: Explorer vs Windows Explorer

Im working on a small project, which isnt exactly going according to plan...

We have some .vbs scripts which must be run before explorer.exe starts
so, the best way to do this would be to replace the windows shell with a custom program (login.exe, written in C#) by replacing the registry key, HKLM>Software>Microsoft>Windows NT>Current Version>Winlogon:Shell = login.exe

What is happening:
The user logs in using AD credentials.
Helloworld.vbs is run
When helloworld.vbs finishes and closes, Explorer.exe is run but opens as Windows Explorer, instead of the usual Shell.

Opening TaskManager (alt+ctrl+del > taskmanager) then running explorer.exe, also opens Windows explorer, instead of the Shell.

Reverting the above registry key back to explorer.exe, then logging off and on, opens the Shell.

Any ideas why?

Source code of Helloworld.vbs
wscript.echo("Hello World")
Source code of Login.exe
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace autexplorer
    class Program
        static void Main(string[] args)
            System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
            myProcess.StartInfo.FileName = "wscript";
            myProcess.StartInfo.Arguments = " C:\\Windows\\Setup\\Scripts\\helloworld.vbs";

            System.Diagnostics.Process myProcess2 = new System.Diagnostics.Process();
            myProcess2.StartInfo.FileName = "C:\\windows\\system32\\explorer.exe";

Helloworld.vbs will be rescripted for much more complex things later on. But for now, its testing only.

Im not a C# programmer, I mostly do VBScript.
But a .vbs fails to run when loaded in the above registry key.

My System SpecsSystem Spec

22 Mar 2011   #2

Windows 7 32 bit

Why do the .vbs script have to be run before Explorer?

I'm not big into .vbs but I'm wondering if windows scripting host has some dependencies that need Explorer such as ActiveX or similar? How about load Explorer normally, run your scripts, then kill Explorer and relaunch? Only reason I can think is that something has to be done before login. Which makes me wonder why you are taking this approach.

If it really needs to run before login then it probably needs to be implemented as a service.
My System SpecsSystem Spec
22 Mar 2011   #3

Windows 7 Enterprise

Thanks for your reply Miles,
A bit of a broader overview:
Some shell folders are redirected to the network shares. Currently done via GPO, but also testing through editing the registry keys.

Because, while connected to the network, the Novell scripts map H:\ correctly, then explorer loads, all is fine.
However in the case of a laptop user, when they take the machine home, they wont have an H:\
This is where my .vbs script works its magic. It creates a substituted H:\ and creates folders on D:\
But by the time the script runs, Explorer has already failed to find the shell folders, so 'my documents', 'music', etc are broken.

This is where I need my script to run first, to create the subst H: and folders BEFORE Explorer goes exploring for them.

When they get back to work, and reconnect to our network, once they log in they should then have their regular networked H:\ plus a D:\offlineFiles folder structure in their appropriate libraries.
This is also the reason we cannot use the C:\Users\ folders, because once they get back on the network, these are redirected and basically unusable.

The easy and dirty workaround is like you said, load Explorer, run the script, kill and restart Explorer.
However, this poses the issue that the end user will be presented with a 'broken' working desktop, which will then disappear and reappear as 'fixed'.
In our envrionment, this will not do.
It needs to be completely transparent to the end user. All they should notice is an extra couple seconds of login time.
My System SpecsSystem Spec

23 Mar 2011   #4

Windows 7 Enterprise

Its amazing how much clearer you can think after a trip to the bathroom.

I think I've found the solution...
The value of registry key
HKLM>Software>Microsoft>Windows NT>Current Version>Winlogon:Shell
should remain as Explorer.exe
But, the key Userinit, which by default is userinit.exe, should be the one changed to login.exe

Login.exe has been modified to instead call userinit.exe
    System.Diagnostics.Process myProcess2 = new System.Diagnostics.Process();
    myProcess2.StartInfo.FileName = "C:\\windows\\system32\\userinit.exe";
So far, it looks very promising.
After logging in, the novell scripts dialog appears as normal. That will close, and I'm presented with the "Welcome". This, as expected, takes around 3 seconds longer than in previous timings. Then Explorer loads the working desktop.

My helloworld.vbs was nowhere to be seen during the whole process.
My System SpecsSystem Spec
23 Mar 2011   #5

Windows 7 32 bit

That's interesting. With all the books like "Undocumented Windows" you would think somewhere along the line the Registry would get documented by somebody. Seems more like cryptography than system settings.

Glad you found a solution.
My System SpecsSystem Spec

 Windows Shell: Explorer vs Windows Explorer

Thread Tools

Similar help and support threads
Thread Forum
Windows Explorer Is Not Working/Windows explorer is restarting Loop
Sorry for starting a thread on this, but from reading about my problem online it seems like a different set of circumstances causing this for each person. So here's what I can tell you. I was going through and deleting stuff off my hard drive, trying to clear up space and get things a little...
General Discussion
Classic Shell/Explorer Custom Command
Hi, I've created a Custom Command under Classic Explorer that invokes a VBS script. If the command contains E:\abcdef.vbs, it works. If, however, I change it to E:\abcdef.vbs "%3", nothing happens, even though there is no reference to the argument within the script.:confused::huh: For what...
Explorer.exe stoped working , regedit shell did't work
hi, From Today am having weired problem. My Explorer is crashing , but that is not weird. But Mine is...i guess ! When I boot-up and after logging in my taskbar never appears .. On Forcing to open explorer from task-manager by explorer.exe and explorer don't work at all , on typing that ! ~...
BSOD Help and Support
Windows Explorer (Not Internet Explorer) Causing problems
I've never posted on a help forum before, so please bear with me. I have a Dell Studio 1749 laptop, running Windows 7 Home Premium 64bit. Windows Explorer is not working. That is, Windows Explorer, not Internet Explorer. It seemed like every forum I already checked this confused people....
General Discussion
How to show path in Windows Explorer / Windows Explorer Replacements?
Hello everyone, I am working with my external HDD, on which I have placed most of my data files. Windows Explorer finds the files okay, but when I go to the file location, nowhere on the screen does it show the complete path of the file. I would like to know the full path of the file I am...
Internet Explorer 8 special shell shortcut
Hi there, My IE8 special shell shortcut that that provides quick access to internet options is missing from desktop, does anyone knows how to put it there? I tried to use the method I used with xp and vista but it didn't work.. can someone help me here?
Browsers & Mail

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 23:14.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App