Windows 7 - Log Off Script Error Message?

Client: Windows 7 Professional
AD Server 08 R2

I have a Group Policy object configured for a user that executes a log off script.  The purpose of the script is to backup a file on client machine.  The script works correctly.  

However, sometimes when the user logs onto the machine first thing in the morning, a message appears that reads "The local session manager service failed the log on.  The group or resource is not in the correct state to perform the requested operation."  The user clicks OK, the system sits (it acts like the log off script is being ran) and then a log on prompt is shown again.  At this point, the user can log in successfully.

Any idea why the message is appearing?  The message only began to appear after I created the Group Policy object for the user.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Frank McCourryV.P. Holland Computers, Inc.Commented:
Can you post your policy settings?
If I were you, I'd create a log file for the script to update so you can see exactly when it starts and when it finishes.  Then try to link those times up to reports of this problem.  This will help determine if the script is in fact causing this issue (I doubt it).

Can you also go into the event viewer and look for an error that correlates to the error the user is seeing so we can look at the source and information within the error?
SandeshdubeySenior Server EngineerCommented:
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

TacomaVAAuthor Commented:
I was able to re-create the problem yesterday.  Upon logging in, the error message appeared.  I checked the event log, but I don't see anything significant.  I logged in around 8:39pm.  Here are a few of the first events from the system log from last night:

9/8/2013 20:40      e1cexpress      32      None      
"Intel(R) 82579LM Gigabit Network Connection
 Network link has been established at 1Gbps full duplex."

Information      9/8/2013 20:39      Microsoft-Windows-Power-Troubleshooter      1      None      "The system has resumed from sleep.

Sleep Time: ¿2013¿-¿09¿-¿06T21:29:03.130439600Z
Wake Time: ¿2013¿-¿09¿-¿09T00:39:57.999200900Z

Wake Source: Unknown"

9/8/2013 20:39      Microsoft-Windows-Time-Service      36      None      
The time service has not synchronized the system time for 86400 seconds because none of the time service providers provided a usable time stamp. The time service will not update the local system time until it is able to synchronize with a time source. If the local system is configured to act as a time server for clients, it will stop advertising as a time source to clients. The time service will continue to retry and sync time with its time sources. Check system event log for other W32time events for more details. Run 'w32tm /resync' to force an instant time synchronization.

Information      9/8/2013 20:39      Service Control Manager      7036      None      
The Application Experience service entered the stopped state.

Information      9/8/2013 20:39      Service Control Manager      7036      None      
The Shell Hardware Detection service entered the stopped state.

Information      9/8/2013 20:39      Service Control Manager      7036      None      
The Multimedia Class Scheduler service entered the stopped state.

Warning      9/8/2013 20:39      e1cexpress      27      None      
"Intel(R) 82579LM Gigabit Network Connection
 Network link is disconnected."

Information      9/8/2013 20:39      Microsoft-Windows-Kernel-General      1      None      
The system time has changed to ¿2013¿-¿09¿-¿09T00:39:57.500000000Z from ¿2013¿-¿09¿-¿06T21:29:52.410482600Z.

The log above shows that the machine went into sleep mode and when I pressed the power button on the machine at 8:39pm, I did see the "resuming windows" message.  However, the power button was NOT flashing when I pressed it.  If I intentionally put the machine into sleep mode via the Start Menu, the power button always flashes once the machine has entered sleep.

Here's another piece of the system log from Friday, when the user logged out at lunch and returned a bit later:

Information      9/6/2013 14:14      Microsoft-Windows-GroupPolicy      1500      None      
The Group Policy settings for the computer were processed successfully. There were no changes detected since the last successful processing of Group Policy.

Information      9/6/2013 14:13      Service Control Manager      7036      None      
The TCP/IP NetBIOS Helper service entered the running state.

Information      9/6/2013 14:13      e1cexpress      32      None      
"Intel(R) 82579LM Gigabit Network Connection
 Network link has been established at 1Gbps full duplex."

Information      9/6/2013 14:13      Microsoft-Windows-Power-Troubleshooter      1      None      "The system has resumed from sleep.

Sleep Time: ¿2013¿-¿09¿-¿06T16:28:57.999725700Z
Wake Time: ¿2013¿-¿09¿-¿06T18:13:28.046000900Z

Wake Source: Unknown"

Error       9/6/2013 14:13      Microsoft-Windows-GroupPolicy      1129      None      
The processing of Group Policy failed because of lack of network connectivity to a domain controller. This may be a transient condition. A success message would be generated once the machine gets connected to the domain controller and Group Policy has succesfully processed. If you do not see a success message for several hours, then contact your administrator.

Warning      9/6/2013 14:13      e1cexpress      27      None      
"Intel(R) 82579LM Gigabit Network Connection
 Network link is disconnected."

Information      9/6/2013 12:29      Service Control Manager      7036      None      The TCP/IP NetBIOS Helper service entered the stopped state.

Information      9/6/2013 12:29      Service Control Manager      7042      None      "The TCP/IP NetBIOS Helper service was successfully sent a stop control.
 The reason specified was: 0x40030011 [Operating System: Network Connectivity (Planned)]

Information      9/6/2013 12:29      Microsoft-Windows-Kernel-Power      42      -64      
"The system is entering sleep.

Sleep Reason: Button or Lid"

The user left at around 12:30pm and returned at around 2:15pm, but this time the system log shows a Group Policy error.
Can you always reproduce this issue if the user puts the machine to sleep rather than logging off?  Is it only this one machine that has the issue?  If so, is there any behavior or anything that's unique for this machine only?  Examples: other users may not sleep their machine or this user may not be an admin while others are.  Things like that.
TacomaVAAuthor Commented:
I can't always reproduce the issue, it doesn't throw the error every time.

This is the only machine that has the issue, but this is the only machine where a log off script should execute.

The user is a standard domain user.  All other machines are shutdown or simply log off at the end of the day.

One note - the file I am trying to copy at log off is 4.5GB in size.
Is this a laptop?  If so, try this to reproduce the issue (backup the file at the network location first):

Log on as a user where the logoff script should run.  Log off the machine and shut the lid to the laptop before the logoff completes.

In regards to the file size, that is a pretty large file to be copying at logoff.  How long does it take for that file to copy?
TacomaVAAuthor Commented:
This machine is not a laptop, it's an all in one desktop from Dell.

Time to copy is surprisingly quick, less than 4:00min on average I'd say.

The weird thing is, if I log off (Start -> log off) the machine, the copy executes correctly and all is well.  When the user logs off on any given week day, the machine enter into the "sleep" mode and then the error appears the following morning.  The user insists they are clicking log off and not sleep.  Which makes sense, because the power button does not flash, which based on my experience with this machine, the power button will flash if it's in sleep mode.
TacomaVAAuthor Commented:
As an additional note, my log off script simply copies the file to a UNC path that the user already has permissions for.  I am not defining permissions in the script.
It doesn't sound like the user is hitting the logoff button.  Doing so would not save any session information, so you wouldn't get a "resuming windows" screen when you hit the power button.  Do you guys have a power profile enabled on that machine that would put the machine to sleep after x minutes of inactivity?

If I were you, I'd start looking at the security logs to track all of the events.  Use this link to help define what the user is doing.  Most importantly, I'd first make sure to find out what time the user says they logged off and check the security log to see if a log off or begin log off action was logged.  Also look for any "locked" events after the user initiated the logoff.  It is possible that the user started the logoff process, then locked the screen, screen saver/power profile kicks in and sleeps the computer, then resumes when you hit the power button and gives you the associated errors when it resumes windows.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.