Monthly Archives: September 2010

Internet Explorer 9 Beta has been released

 IE9Beta on Windows 7

Yesterday, Microsoft released the public preview of Internet Explorer 9. This release is by far the most advanced version of Internet Explorer. In fact, Microsoft has setup a new web site, www.BeautyOfTheWeb.com, to both introduce and advertise Internet Explorer 9, as well as to distribute this release to the interested members of the public and to beta testers.

Internet Explorer 9 Beta is available for Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2. As for the users of Windows XP, I’m sure Microsoft is sorry that it is unable to release a version of this product for this group of users. (Do you think a sarcasm was intended?) Microsoft Windows XP currently holds more than 55% of the entire Windows market share, although it is slowly and steadily losing its share in favor of Windows 7.

Proper way of downloading Internet Explorer 9 Beta

If you try to download Internet Explorer 9 Beta from www.BeautyOfTheWeb.com as I did, you’ll probably end up with what I did: An installer no bigger than 2 megabytes! As you have probably guessed, this file is merely a bootstrapper (web installer) that downloads the real Internet Explorer 9 as well as several Windows updates that are required to install Internet Explorer 9 Beta.

You can download a standalone installer for Internet Explorer 9 from Internet Explorer 9 Worldwide Download Site if you wish. The standalone installer is approximately 35 megabytes. You can also download Internet Explorer 9 in other languages and for other operating systems from that location. To download Internet Explorer 9 Beta for Windows Server, scroll to them bottom of that page.

What’s new?

IE9 SVG Support
Internet Explorer 9 beta now supports SVG format. The image above is Mahuri.svg on Wikimedia Commons. You can see image description page there.

Internet Explorer user interface has lost more weight. Search bar is now merged with the old address bar and now you have a One Bar. There is no separate tab bar and command bar anymore; they appear next to One Bar. However, Internet Explorer 9 Beta has no status bar and progress bar. Sometimes, the throbber responsible for showing the loading of the site does not show up. I wish progress bar had also been merged with One Bar, as is the case with Windows Explorer in Windows 7. I could not find several of the commands that were available in Internet Explorer 8, including Work Offline…, Help and another one that I have forgotten its name. (Like always, I managed to take Internet Explorer into Offline mode via Windows Media Player and Windows Live Mail.) Let use hope these issues are resolved in the final release.

Internet Explorer 9 beta now supports Cascading Style Sheet (CSS) level 3 and Scalable Vector Graphics (SVG) format. In fact, Internet Explorer 9 beta takes over the .svg file association upon installation. This was a good news for me and should be a good news for Wikimedia Foundation and Wikipedia, although I think you will not see them taking advantage of this very soon; at least not sooner than you’ll see Internet Explorer 11.

Internet Explorer 9 beta now features the long-expected internal download manager! (Hurrah!) In addition, it can now turn websites into web applications that can be summoned from Desktop, Taskbar or Start Menu. To support this, it introduces a new file format (.website) that can, contrary to traditional web shortcuts (.url), hold more than a just a URL to the web site.

But enough of this! Internet Explorer’s official web site, www.BeautyOfTheWeb.com, is doing more than well to advertise for Internet Explorer. Let’s proceed to some more obscure aspects of the new Internet Explorer.

Immediately apparent flaw

The first thing that catches my eyes is the fact that the loss of weight in the user interface does include a loss weight in the various context menus. There several commands in the context menus that are always disabled, including a Paste command in the context menu of the body of the web pages.

Second, Internet Explorer 9 features a lot of performance improvements; it promises full hardware acceleration, even better than what Mozilla Firefox 4 beta is promising; it promises JavaScript performance improvements with its new Chakara engine. However, it seems Internet Explorer 9 beta has forgotten one aspect of performance improvements which I always wished it never do.

If you take a look at this blog post, you’ll see that Internet Explorer 9 developers have defined eleven areas in which Internet Explorer 9 performance can be measured: Networking, HTML, CSS, Collections, JavaScript, Marshalling, DOM, Formatting, Block Building, Layout and Design. However, they had only benchmarked ten areas not eleven! Networking performance is not benchmarked. Like all other released of Internet Explorer, it is forgotten!

But why? The fact that dial-up Internet access is deprecated doesn’t mean that bandwidth and networking performance are no longer important. In fact, it is growing more important than ever. With these new performance improvements in Internet Explorer, we are bound to see more and more voluminous web sites. I expect we are bound to see higher definition video, especially with the arrival of the new High-Efficiency Video Coding. In time, I have experienced the worst network congestions, not in dial-up Internet access, but in enterprise network where they were connected to 25Mbps Internet networks but a lot of users were also on line.

Let’s hope that Internet Explorer team has merely forgotten to put their Networking stack benchmark data on the chart, or that they did in another blog post that has escaped my notice. I’ll search more on this and, if the result was not satisfactory, will submit feedback about this to Microsoft.

Giving feedback

Speaking of feedback: Like the last two versions, it is possible to report bugs and submit feedback about Internet Explorer via Microsoft Connect website for Internet Explorer. Once you have registered in the site and enrolled for the beta test program, you may submit feedback from Internet Explore main menu.


del.icio.us Tags: ,,,,

Shutting down, restarting or logging out via shortcuts, batch files and scripts – Part 2

Introducing PsShutdown.exe

In the previous episode, we saw Shutdown.exe, a command-line tool that could perform shutdown, restart or logout. We also saw that the earlier version of Shudown.exe included with Windows XP suffers from certain discrepancies that severely limit its usage scenarios.

In addition to Shutdown.exe, a freeware called PsShutdown.exe is also available from Microsoft that features additional capabilities over Shutdown.exe in Windows XP. It can hibernate a computer or lock a user session. (Locking a user session returns the user to the logon screen without logging out. The user can return to work by logging back on.) However, as of 2 August 2010, the latest version of this tool (2.52.0.0) also suffered from a crippling shortcoming: Only users with administrative privileges could use it. Hence, I will no longer elaborate on it. In fact, if you are using Windows 7 or Windows Server 2008, you are already in possession of the improved version of Shutdown.exe which should be more than enough to handle automatic shutdown of your local machine.

Creating our own shutdown tool

If you are using Windows XP or Windows Server 2003, you do not have to cope with the discrepancies of Shutdown.exe: You can create your own shutdown tool. To do so, you use Windows Script Host (WSH), a Windows component that allows you to run scripts that you yourself have created in JScript and VBScript languages.

Composing the scripts

Familiarize yourself with the icon of VBScript script files. These files have .VBS file name extension.

You don’t need to create an entire script by yourself: I have already written the scripts for you. Follow the following instructions to import them to your computer.

  1. Start Notepad. You should find it in the Start menu.
  2. Look below and find the script for the task (shutdown, restart or log out) that you need. (Some tasks may have two scripts written for them. You can choose either of them.)
  3. Copy the entire script into clipboard. To do so, highlight the script using your mouse. Then, right-click on you selection and from the menu that appears, select Copy.
  4. Paste the entire script into Notepad. To do so, right-click somewhere in the Notepad and from the menu that appears, select Paste.
  5. Save the entire script under a name of your liking but with .vbs filename extension. If you do not know what I mean, follow these instructions carefully:
    1. In Notepad menu bar, click File, and then select Save As…
    2. Browse to the location in which you’d like to save the file. For example, Desktop.
    3. Click inside File Name field.
    4. Type a quotation mark (“).
    5. Type a name for your script. Anything will do, but I suggest you type a suitable name.
    6. Type: .vbs (Do not forget the dot.)
    7. Type another quotation mark (“).
    8. Optional: Make sure that Encoding field contains either ANSI or Unicode. It should not contain UTF-8 or Unicode Big Endian.
    9. Press Save button.
  6. Prepare to test the script: Close all your open applications and save any unsaved changes.

Your script should now be ready. If you have named it correctly, it should look like as displayed in the picture. Repeat the steps above to create other scripts that perform other tasks.

Executing the scripts

You can now execute these scripts as you execute normal apps: Just double-click on them!

You might also like to ask other software to run these scripts. For example, I have a 3D rendering application that lets me run an application when the rendering is complete. Sometimes, rendering a piece of 3D work takes a long time, so it might be a good idea to ask this application to use these scripts to shutdown the system after the work is complete. That way, I can leave the system alone.

Running these scripts from within third-party software, however, is slightly more complicated. You must tell such software to run Windows Script Host with the path to your script as the argument. For example, if your shutdown script, called Shutdown.vbs, is saved in C:\Program Files\Admin Scripts, you can tell your third-party software to run this command:

"%systemroot%\system32\wscript.exe" "%ProgramFiles%\Admin Scripts\Shutdown.vbs"

Script codes

Blog software have a bad reputation of corrupting blog posts. If in the future, you found that these scripts are corrupted, you can find a copy of them on GitHub.

Shutdown

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, "Shutdown via script"


Const LOGOFF = 0
Const SHUTDOWN = 1
Const REBOOT = 2
Const POWEROFF = 8

Const LOGOFF_FORCE = 4
Const SHUTDOWN_FORCE = 5
Const REBOOT_FORCE = 6
Const POWEROFF_FORCE = 12

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
 ObjOperatingSystem.Win32Shutdown(POWEROFF)
Next

Shutdown (Alternative)

This scripts does exactly what the one above does, only using a different code.

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, "Shutdown via script"


strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
    ObjOperatingSystem.Shutdown()
Next

Restart

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, "Restart via script"


Const LOGOFF = 0
Const SHUTDOWN = 1
Const REBOOT = 2
Const POWEROFF = 8

Const LOGOFF_FORCE = 4
Const SHUTDOWN_FORCE = 5
Const REBOOT_FORCE = 6
Const POWEROFF_FORCE = 12

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
 ObjOperatingSystem.Win32Shutdown(REBOOT)
Next

Restart (Alternative)

Like the script above, the following script also restarts the computer:

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, "Restart via script"


strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
    ObjOperatingSystem.Reboot()
Next

Logging off

Const EVENT_SUCCESS = 0
Set objShell = Wscript.CreateObject("Wscript.Shell")
objShell.LogEvent EVENT_SUCCESS, "Logging off via script"


Const LOGOFF = 0
Const SHUTDOWN = 1
Const REBOOT = 2
Const POWEROFF = 8

Const LOGOFF_FORCE = 4
Const SHUTDOWN_FORCE = 5
Const REBOOT_FORCE = 6
Const POWEROFF_FORCE = 12

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery ("SELECT * FROM Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
 ObjOperatingSystem.Win32Shutdown(LOGOFF)
Next

Further reading

For more information about these scripts, see:

  1. “Shutting Down Computers and Logging Off Users”. Scripting Center. Microsoft Corporation. 22 October 2009.
  2. “Shutting Down a Computer”. Scripting Center. Microsoft Corporation. 22 October 2009.
  3. “Restarting a Computer”. Scripting Center. Microsoft Corporation. 22 October 2009.
  4. “Win32Shutdown Method of the Win32_OperatingSystem Class”. Windows Dev Center. Microsoft Corporation. 9 September 2010.
  5. “Reboot Method of the Win32_OperatingSystem Class”. Windows Dev Center. Microsoft Corporation. 9 September 2010.
  6. “Shutdown Method of the Win32_OperatingSystemClass”. Windows Dev Center. Microsoft Corporation. 9 September 2010.

What’s next?

I promised to blog about PowerShell cmdlets that allows system administrators to perform shutdown and restart. I will leave that to another blog post.

A historic manuscript: Differences between Windows XP and Windows Server 2003

This list highlights the differences between Windows XP and Windows Server 2003. I composed this note a very long time ago in my OneNote while I was studying for my MCSE exams, 70-290 and 70-270. This list is no longer practically useful as time has caught up with both Windows XP and Windows Server 2003. However, this note is a memento of a certain period of time in which I studied hard for my success. I do not want to throw away this memento. Hence I’m archiving it here for probable future references.
See the list…

Shutting down, restarting or logging out via shortcuts, batch files and scripts – Part 1

All of us know how to use the Start menu to shut down, restart or hibernate our computers, or log out of our user accounts. But not all of us know how to do so via a shortcut, from the command line, or from within a script or batch file. In this post, I’d like to introduce you to Shutdown.exe.

Shutdown.exe

Shutdown notice on Windows 7: It appears after Shutdown.exe is executed.

Shutdown.exe is a dedicated program for performing shutdown, restart and logout. It comes with Windows XP and later. (It is also available on Windows 2000 Resource Kit disc.) It can schedule its action to be done after a certain period of time and works for remote computers too.

Unfortunately Shutdown.exe cannot hibernate computers on Windows XP or earlier. Moreover, it cannot put the computer into the sleep mode (also known as the standby mode). Most importantly, however, in Windows XP, it requires administrative privileges to shut down or restart a local machine. By default, guests and standard users who can normally shut down or restart local computer via the Start menu cannot do so via Shutdown.exe. If they try to do so, they will encounter the following cryptic error and misleading message:

Operation completed successfully.
A required privilege is not held by the client.

Shutdown notice on Windows XP: It appears after Shutdown.exe is executed.

The default behavior of this command in Windows XP can be modified by editing a local security policy item called “Force shutdown from a remote system” and suffering the consequences of doing so!

Fortunately in Windows 7, Shutdown.exe can, by default, shutdown or restart without requiring administrative privileges or unusual user rights in the security policy.

Creating shortcuts that perform shutdown

You can create a shortcut to Shutdown.exe on your desktop (or anywhere else). To so:

  1. Reveal your desktop (or open the folder in which you intend to create a shortcut.) You can press the Windows key+D key combination on your keyboard to reveal your desktop immediately.
  2. Bring up the context menu. To do so, right-click on an empty space. Alternatively, press CTRL+Space to deselect any selected item and then press the Context Menu key on your keyboard. A menu should appear.
  3. From the menu, select “New” and then select “Shortcut”.
  4. Supply one of the command strings specified in the “Supported actions“. Choose one that corresponds to the purpose of your shortcut. For example, if you are creating a shortcut to restart your Windows XP computer, enter: shutdown.exe -r -t 0.
  5. Press the Next key.
  6. Enter a name for the shortcut. In the case of the example above, enter: Restart computer.
  7. Press the Finish key.

You can create more complex shortcut by customizing the command that you entered in step 4. To do so, study the syntax of the Shutdown.exe command below. You can create shortcuts that stop the local machine after a delay, or stop a remote machine (provided that you have enough privileges on it.)

Performing shutdown from the command line or batch files

To shut down, restart or hibernate your computer, or log out of your user account from the Command Prompt, just enter a valid shutdown.exe command (like the one included in table below) and press ENTER. It will behave just like the shortcut. Same command can be entered in a batch file to produce the same effect.

It is possible to run Shutdown.exe via PowerShell or Windows Scripting Host too, but it is pointless and inconvenient. After all, PowerShell has its own dedicated cmdlets for doing the job, and Windows Scripting Host has its own native ways.

Supported actions

The table below lists the supported actions by shutdown.exe:

ActionCommand in Windows XPCommand in Windows 7
Stop the local computer nowshutdown.exe -s -t 0shutdown /s /t 0
— or —
shutdown /p
Restart the local computer nowshutdown.exe -r -t 0shutdown /r /t 0
Put the local computer to sleep now(Not supported)(Not supported)
Hibernate the local computer now(Not supported)shutdown.exe /h
Log out of the current user account nowshutdown.exe -l 0shutdown.exe /l

Syntax

Here is the Shutdown.exe’s syntax in Windows XP (modified a bit to fit this blog post):

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \computer] [-t xx] [-c "comment"] [-d up:xx:yy]
  No args             Display this message (same as -?)
     -i               Display GUI interface, must be the first option
     -l               Log off (cannot be used with -m option)
     -s               Shutdown the computer
     -r               Shutdown and restart the computer
     -a               Abort a system shutdown
     -m \computer     Remote computer to shutdown/restart/abort
     -t xx            Set timeout for shutdown to xx seconds
     -c "comment"     Shutdown comment (maximum of 127 characters)
     -f               Forces running applications to close without warning
     -d [u][p]:xx:yy  The reason code for the shutdown
                      u is the user code
                      p is a planned shutdown code
                      xx is the major reason code (positive integer less than 256)
                      yy is the minor reason code (positive integer less than 65536)

And here is the Shutdown.exe’s syntax in Windows 7 (modified a bit to fit this blog post):

Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /r         Shutdown and restart the computer.
    /g         Shutdown and restart the computer. After the system is
               rebooted, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /e         Document the reason for an unexpected shutdown of a computer.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).

Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type    Major   Minor   Title

 U      0       0       Other (Unplanned)
E       0       0       Other (Unplanned)
E P     0       0       Other (Planned)
 U      0       5       Other Failure: System Unresponsive
E       1       1       Hardware: Maintenance (Unplanned)
E P     1       1       Hardware: Maintenance (Planned)
E       1       2       Hardware: Installation (Unplanned)
E P     1       2       Hardware: Installation (Planned)
E       2       2       Operating System: Recovery (Planned)
E P     2       2       Operating System: Recovery (Planned)
  P     2       3       Operating System: Upgrade (Planned)
E       2       4       Operating System: Reconfiguration (Unplanned)
E P     2       4       Operating System: Reconfiguration (Planned)
  P     2       16      Operating System: Service pack (Planned)
        2       17      Operating System: Hot fix (Unplanned)
  P     2       17      Operating System: Hot fix (Planned)
        2       18      Operating System: Security fix (Unplanned)
  P     2       18      Operating System: Security fix (Planned)
E       4       1       Application: Maintenance (Unplanned)
E P     4       1       Application: Maintenance (Planned)
E P     4       2       Application: Installation (Planned)
E       4       5       Application: Unresponsive
E       4       6       Application: Unstable
 U      5       15      System Failure: Stop error
 U      5       19      Security issue
E       5       19      Security issue
E P     5       19      Security issue
E       5       20      Loss of network connectivity (Unplanned)
 U      6       11      Power Failure: Cord Unplugged
 U      6       12      Power Failure: Environment
  P     7       0       Legacy API shutdown

Stay tuned

In the next post, I’ll write about other avenues of automated shutdown via Windows Scripting Host and PowerShell.

%d bloggers like this: