Windows IT Pro is the leading independent community for IT professionals deploying Microsoft Windows server and client applications and technologies.
  
  
  Advanced Search 


July 2002

Rundll32 Shortcuts


RSS
Subscribe to Windows IT Pro | See More Administration Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

 See corrections to this article

Simplify DLL-encapsulated administrative functions

Many common administrative functions in Windows are encapsulated in DLLs. This design lets multiple executable programs share certain functions but prevents users from directly executing functions that DLLs contain. Fortunately, Windows provides a command-line utility, Rundll32, that lets you execute some DLL functions. Here are 10 Rundll32 shortcuts to common administrative functions.

10. Open Microsoft Internet Explorer (IE) to a specific Web site. For example, to launch IE and open the Windows & .NET Magazine Web site, simply enter the following command:

rundll32.exe url.dll,
FileProtocolHandler http://www.winnetmag.com

9. Add a printer to a remote computer. Rundll32 can launch the Add Printer Wizard for a local or remote computer. The following example starts the Add Printer Wizard for remote computer teca4. (To start the Add Printer Wizard for a local computer, omit the /c switch.)

rundll32.exe printui.dll,
PrintUIEntry /il 
/c\\teca4

8. Add printer ports for attached TCP/IP printers. The following command starts the Add TCP/IP Printer Port Wizard:

rundll32.exe tcpmonui.dll,
LocalAddPortUI

7. Start the Network Identification Wizard. The following command starts the wizard, which steps you through your initial networking setup and lets you specify the computer name, logon domain, logon ID, and password:

rundll32.exe netplwiz.dll,
NetAccWizRunDll

6. Run the Network Place Wizard. This wizard lets you add a link to a network storage location. The link can access a network share, an FTP location, or a Web folder. Enter this command to start the wizard:

rundll32.exe netplwiz.dll,
AddNetPlaceRunDll

5. Create a new shared folder. Another handy administrative function that Rundll32 can perform is launching the New Share dialog box, which lets you graphically add network shares. Simply enter the following command:

rundll32.exe ntlanui.dll,
ShareCreate

4. Manage network shares. Use the following command to launch the Shared Directories dialog box. You can use this dialog box to list your system's network shares, add a new share, toggle sharing on and off, and change share permissions:

rundll32.exe ntlanui.dll,
ShareManage

3. Launch Device Manager. To quickly run Device Manager without first navigating through the Administrative Tools folder, run Rundll32 as follows:

rundll32.exe devmgr.dll DeviceManager_Execute

2. Lock your workstation. Rundll32 can also perform various shell functions. For example, you can add an icon to your desktop that you can use to immediately lock your workstation. To do so, right-click on the desktop and select New, Shortcut. In the Command line text box, enter the command

rundll32.exe user32.dll,
LockWorkStation

1. Automatically log off a user or shut down your machine. You can incorporate Rundll32 into your Windows Script Host (WSH) or command-shell scripts to log off the current user or shut down and restart the computer. The value in the command's last parameter controls the action that will occur: 0 performs a logoff, 1 performs a shutdown, 2 performs a reboot, 4 performs a forced shutdown, and 8 powers down the machine. The following example performs a logoff:

rundll32.exe shell32.dll,
SHExitWindowsEx 0

End of Article



Reader Comments
I have tried number 1 to logoff and shutdown and it did not work on Windows 2000 or Windows 98.
That one being the most useful, it would be great if it was corrected? Thank You!

Dave Namou June 28, 2002


I tried the "Automatically loging a user off" and recieved an error. I tried it as a shortcut on my desktop using the following command for the target: "%windir%\System32\rundll32.exe shell32.dll, SHExitWindowsEx 0" and for Start In: "%windir%". I receive an error stating the following:
"Error in shell32.dll Missing entry:SHExitWindowsEx"

Thanks,


Todd Lane July 01, 2002



Tool no 1
rundll32.exe shell32.dll,
SHExitWindowsEx 0
All worked (great tips) but this one, the one I need most. I get the error; "Error in Shell32.dll, missing entry;SHExitWindowsEx"
Any update

Many thanks

Jawdat Daou August 12, 2002


I to am running into the same situation as others, where I am getting error on shell32.dll claiming a missing entry. Would greatly appreciate the solution to this one.

Tammy Mortenson August 19, 2002


Correction for July 2002 Top Ten Column:

Tip #1 of the Top 10 column published in July 2002 was incorrect. As published, the tip to shutdown Windows only works for Windows 98/ME systems. The original tip was as follows:

rundll32.exe Shell32.dll, SHExitWindowsEX 0

This tip doesn’t work for Windows NT/2000/XP. To shut down an NT system from the command line using the rundll32 utility, you can enter the following command:

RUNDLL32 USER32.DLL,ExitWindowsEx

Unfortunately this tip doesn’t work for Win2K/XP. To shut down Win2K, you need to use either the shutdown.exe utility that’s provided in the Resource Kit or, if you don’t have the Resource kit, you can download and use the freeware psShutdown utility from Sysinternals (http://www.systernals.com). The psShutdown utility can be found at the following URL:
http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtml

XP incorporates the shutdown command into its native command set so to shut down an XP system, you can simply enter the shutdown command at the command prompt.

Windows Script Host (WSH) scripting also provides another method of shutting down a Win2K/XP system. An example WSH script to shut down the system follows:

'WSHShutdown.vbs

Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")

for each OpSys in OpSysSet
OpSys.ShutDown()
next

Mike Otey August 20, 2002


Tip no. 3 run the device manager without browsing
The shortcut is:
rundll32.exe devmgr.dll DeviceManager_Execute

but i think i will use my old way.
I'm in the run dialog anyway, so just type: devmgmt.msc
It is the same result, but the shortcut is easier to remember

regards

Tonny René Poulsen April 09, 2003


This is an excelent article, help me a lot,
I am still missing one import command : how do I activate the SendTo using
the rundll32

Garry Golod November 19, 2003


This is really good article but i am looking for Run shortcut actually a friend gave me this assignment i am looking for this for many day but not successful yet, please tell me how i can create shortcut for RUN.
And please tell me more abt rundll32, we are using win2000.

vikrant December 04, 2003


I have Windows 2000 Professionnel.
When I enter the command "rundll32.exe shell32.dll,SHExitWindowsEx 0" I have the error :
Error in shell32.dll
Data is missing in SHExitWindowsEx

I have usually the same error with data 1, or 2 for exemple
Thank's

Lahbib Zohair January 07, 2004


Excellent article on rundll32.

Great Guys.

vamsi March 09, 2004


 See More Comments  1   2 

You must be a registered user or online subscriber to comment on this article. Please log on before posting a comment. Are you a new visitor? Register now




Corrections to this Article:

  • Correction for July 2002 Top Ten Column:

    Tip #1 of the Top 10 column published in July 2002 was incorrect. As published, the tip to shut down Windows only works for Windows 98/ME systems. The original tip was as follows:

    rundll32.exe Shell32.dll, SHExitWindowsEX 0


    This tip doesn’t work for Windows NT/2000/XP. To shut down an NT system from the command line using the rundll32 utility, you can enter the following command:

    RUNDLL32 USER32.DLL,ExitWindowsEx


    Unfortunately this tip doesn’t work for Win2K/XP. To shut down Win2K, you need to use either the shutdown.exe utility that’s provided in the Resource Kit or, if you don’t have the Resource kit, you can download and use the freeware psShutdown utility from Sysinternals (http://www.systernals.com). The psShutdown utility can be found at the following URL:
    http://www.sysinternals.com/ntw2k/freeware/psshutdown.shtml

    XP incorporates the shutdown command into its native command set so to shut down an XP system, you can simply enter the shutdown command at the command prompt.

    Windows Script Host (WSH) scripting also provides another method of shutting down a Win2K/XP system. An example WSH script to shut down the system follows:

    'WSHShutdown.vbs

    Set OpSysSet = GetObject("winmgmts:
    {(Shutdown)}//./root/cimv2").ExecQuery("select *
    from Win32_OperatingSystem where Primary=true")

    for each OpSys in OpSysSet
    OpSys.ShutDown()
    next
Top Viewed ArticlesView all articles
Battery Life Issues Almost Certainly Not Windows 7's Fault

While Microsoft is still investigating a notebook battery life issue that was supposedly caused by Windows 7, some interesting trends have emerged. ...

Confirmed: Battery Life Issues Not Windows 7's Fault

Microsoft on Monday issued a lengthy statement about the recent Windows 7 battery controversy, echoing my assessment from earlier in the day, but backing it up with hard, cold evidence. ...

Microsoft Warns of Windows Version Expirations

Microsoft warned that this year will see three out-of-date Windows versions slip into retirement. ...


Windows OSs Whitepapers Protecting Microsoft SharePoint

Related Events Are your IT systems distributed? Or convoluted?

Deep Dive into Windows Server 2008 R2 presented by John Savill

Cutting Costs with Client Management

Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Introducing Left-Brain.com, the online IT bookstore
Looking for books, CDs, toolkits, eBooks? Prime your mind at Left-Brain.com

Discover Windows IT Pro eLearning Series!
Clear & detailed technical information and helpful how-to's, all in our trademark no-nonsense format


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro DevProConnections IT Job Hound
Left-Brain.com Technology Resource Directory asp.netPRO ITTV Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 © 2010 Penton Media, Inc. Terms of Use | Privacy Statement