Monday 20 August 2012

Accessing the Shut Down Windows Dialog from Windows 8 Start Menu

I've only just started using Windows 8 on my work PC and the first thing I miss is the simplicity of accessing Shut Down or Sleep from the Start Menu. For whatever reason (I'm leaning towards Microsoft wanting people to use hardware sleep controls) the Shut Down menu isn't as easily accessible as it used to be.

I've seen several blog posts on pinning shut down, restart, sleep, etc, shortcuts to the new Start Menu ("Start") but having separate icons for each function seems a bit of wasted screen estate. I then found someone suggesting pressing "Windows+D" to minimise to the desktop and then pressing "Alt+F4" to bring up the Shut Down dialog.


I figured that since the "Shut Down Windows" dialog was accessible in this manner then it should be accessible some other way. I played around with RunDLL32 commands to no avail but thought perhaps AutoIt could do something. A quick search and I came across the following four lines of code that do the trick http://www.autoitscript.com/forum/topic/95279-shutdowndialog-invoke-standard-shutdown-dialog-box

From this I've created a simple AutoIt app that will show the “Shut Down Windows” dialog:

http://dl.dropbox.com/u/50326604/Shut%20Down%20Windows.zip

To use, extract the .exe, save it somewhere and right-click “Pin to Start”


Then drag the icon to where you want it on your "Start" (Menu)…




Monday 5 December 2011

Windows 7 "Please Wait" or Welcome Screen hang


Just thought I'd share a hotfix that resolved an issue that has been plaguing our Windows 7 desktop PCs for the past few weeks. Hopefully it will save someone all of the investigating we had to do!

Symptoms
Windows 7 (SP1) hangs for up to 60 minutes either at:

the"Please Wait" screen before logon screen
the "Welcome" screen after logon (Somebody coined this the "Welcome Screen of Death")
or occasionally at log off

You may see events in the Application Log under ID 6006:
The winlogon notification subscriber took xxxx second(s) to handle the notification event (CreateSession) - "Please Wait" hang
The winlogon notification subscriber took xxxx second(s) to handle the notification event (Logon) - "Welcome" screen hang
The winlogon notification subscriber took xxxx second(s) to handle the notification event (Logoff) - log off hang

This event clearly suggests a problem with the GPClient (Group Policy Client)  so we started  moving the PC to an OU with limited GPOs which reduced the problem. However, the problem is apparent when there is a large number of user profiles on the system (we had ranges of 50 to 250) and deleting profiles can appear to alleviate the problem. The more profiles, the longer the delay.

We only spotted the root cause of the issue by removing and re-applying group policies whilst logged onto a problem PC and noticing that RSOP was hanging. Using Process Explorer we spotted that one of the svchost processes was using an entire CPU core. Since this instance of svchost runs both the Winmgmt (WMI) service and the gpsvc (GPClient) service (amongst other key Windows services) so it appears that the GPClient has to wait for WMI to finish, causing the long delay.


Resolution
Install hotfix kb2617858

"This issue occurs because the Windows Management Instrumentation (WMI) component unnecessarily performs a full validation of the WMI repository"

Since each user profile adds to the WMI repository, the more profiles, the longer the delay (although their seems to be a limit of 60 minutes).

See also kb2505348 which references kb2617858

Tuesday 8 March 2011

Emails from "Microsoft Exchange" classed as "Outside the organization" in Transport Rules

It appears that emails from the built in "Microsoft Exchange" sender in Exchange 2007 are classed as "Outside the organization" in Exchange Transport Rules. Here's how I discovered the issue and was able to work around it:


It’s quite common at the moment for phishers to send “Your mailbox is almost full” type messages, requesting users to click on a link, ultimately compromising their email accounts. One of the methods our organization uses to block such messages is to have an Exchange Transport Rule to block emails with such subject lines and redirect the emails to a monitored mailbox, but for external senders only.


I don’t normally look after this system but I checked the monitored mailbox this morning and found it was full of genuine “Your mailbox is almost full” messages from the “Microsoft Exchange” sender. Numerous users won't have received this message and will potentially hit their quota, and not be able to send emails in the next few days.


My first port of call was the check the Transport Rule was set to only apply to external senders, or as Microsoft put it "from users Outside the organization", which it was. I assumed, therefore that the "Microsoft Exchange" sender is classed as being external as it has no real mailbox.


Comparing the message headers from a genuine "Microsoft Exchange" email and a phish email, I noticed the genuine email is automatically stamped by Exchange with an SCL of -1


X-MS-Exchange-Organization-SCL: -1


I added this as an exception to the Transport Rule using "except when the text specific words appears in a message header" using X-MS-Exchange-Organization-SCL as the message header and -1 as the value.




Messages that match the subject line but come from "Microsoft Exchange" now reach their intended recipient.

Friday 12 March 2010

Showing the last error in an SCCM OSD Task Sequence

Any of you that use SCCM / Configuration Manager to deploy operating systems will know what a pain it is to trawl trough the log files to determine why a build failed. I wanted the end user to see why the build had failed and there didn't seem to be a built in way to do this so I created a script that parses the SMSTS.log file for the last error that occurred before the task sequence fails and show it to the end user.

We use a customised Microsoft Deployment Toolkit (MDT) task sequence to build our desktop PCs so the script gets called as the last step in the "Gather Logs and StateStore on Failure" group:



The script is called as "Run Command Line" step running "cscript.exe "%deployroot%\scripts\UWEShowBuildError.wsf"



and will show the something like this if an error occurs during the task sequence:



The script will also create a small log file recording this error UWEShowBuildError.log which ends up with the rest of task sequence logs (System32\CCM\LogFiles)

Download the script here.
(I use the pre-fix "UWE" on our scripts, variables, etc to distinguish them from the Microsoft scripts)

Tuesday 8 April 2008

Virtual Machine - Endpoint format is invalid

Just came across a VMware virtual machine issue which jogged my memory from a few months back.

Basically, when a user was trying to RDP to a new VM, built from a syspreped template, they were unable to logon and received a strange error message about an "Endpoint format" being invalid. I thought I'd seen this before and remembered that the problem was to do with VMware tools. The problem does not seem to be very well documented but can be found if you Google for problems joining the domain, another manifestation of the problem:

http://david.hochstaetter.net/2007/09/vmware-endpoint-format-is-invalid-join.html

Basically the way we fixed the problem, with minimal reboots, was:
  • Disjoin the VM from the domain and uninstall VMware tools, then reboot.
  • Then rejoin to the domain, install the VMware tools and reboot again.

Tuesday 19 February 2008

SoftGrid error code: xxxxxx-xxxxxx0A-20000194

Just had this error when accessing SoftGrid applications and not obvious how to resolve it. A "Launch Failed" error occurs with an error code ending 20000194. On further investigation the error was only occurring when the client was talking to one of the two NLB SoftGrid servers.

According to http://support.microsoft.com/kb/930614 one of the causes for the 20000194 error is that "The path or the .sft file name that is specified" is invalid and that we should look at the sft-server.log on the SoftGrid Virtual Application Server (normally in "C:\Program Files\Softricity\SoftGrid Server\logs")

The sft-server.log for the problem server showed "File not found: C:\Program Files\Softricity\SoftGrid Server\content\.......sft" and "Unable to open C:\Program Files\Softricity\SoftGrid Server\content\.......sft"

The path "C:\Program Files\Softricity\SoftGrid Server\content\" for our setup where we have the SoftGrid content set as "D:\SoftGridContent\" (specified during setup), was incorrect.

Nowhere in the SoftGrid management console was I able to find the SoftGrid content location but a search of the registry on the offending server showed the following key to be incorrect:

HKEY_LOCAL_MACHINE\SOFTWARE\Softricity\SoftGrid Server\CurrentVersion
SOFTRICITY_SOFTGRID_CONTENT_DIR = D:\SoftGridContent\

Once this was changed to the correct content location, and the SoftGrid Virtual Application Server service restarted, all was ok.

How this had come to be incorrect, I'm not sure but we did recently move the SQL database so perhaps this had confused SoftGrid and caused the setting to default to C:\Program Files.

And to answer the question why SoftGrid uses a local path such as D:\SoftGridContent\ for its content directory, this is because this is the part of SoftGrid (the .sft stream) which is served out as an RTSP stream by the Virtual Application Server so only the server needs to be able to see the content location. In contrast, the .ico and .osd files need to be accessible over the network via UNC or HTTP as this is what the client needs to know about where to find the application.

Thursday 14 February 2008

VMware Storage VMotion from the VI Client GUI

You might have heard that VMware were bringing out the ability to migrate ESX VMs between storage areas (e.g. to different SAN LUNs or local disks) whilst running. Good news is that it part of ESX 3.5: http://www.vmware.com/products/vi/storage_vmotion_overview.html

Bad news is that is that Vmware haven't integrated the functionallity into their Virtual Infrastructure Client, however a clever person at LostCreations has created a plugin: http://www.lostcreations.com/code/wiki/vmware/viplugins/svmotion

To use this fantasic tool, you'll need servers running ESX 3.5 and to install the LostCreations SVMotion plugin for Virtual Infrastructure Client following the installation instructions on: http://www.lostcreations.com/code/wiki/vmware/viplugins/svmotion

(you don't need to install the VMware Remote CLI which is required for "manual" storage vmotion)

Have tested and works a treat with no interruption to the VM during migration.