Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Windows NT/2000/2003 Server/2008 Server
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Windows NT/2000/2003 Server/2008 Server Find support for Windows NT/2000/2003 Server/2008 Server editions.

Reply
 
LinkBack Thread Tools
Old 06-19-2009, 06:10 AM   #1 (permalink)
Registered User
 
Join Date: Jun 2009
Posts: 20
OS: Windows XP SP3


Group Policy Power Management for Workstations

Hello,
Wondering if anyone has an answer or can lead me in the right direction. We currently control the power settings for our windows xp workstations through a group policy from our domain controller. I can modify the policy to place the computers to sleep after a certain period of inactivity. The only issue is that management doesn't want to be on a 1 hour conference and have their workstation go to sleep. The only solution for us would be to find a way to detect if the user is logged out of the workstation and then place the PC to sleep due to inactivity. I found the below script on the EPA website but it won't run due to syntax errors. I was able to fix the syntax errors and create a scheduled task via a startup script but the script fails to detect the log on status and puts the computer to sleep everytime the script runs. Anyone out there know enough VB scripting to correct this script. I don't understand why it won't run.


'** Script Name: "standby-hibernate.vbs" **
Option Explicit
On Error Resume Next
Dim strComputer, sUserName, bLoggedOn, bReboot, objWMIService,
colComputer, objComputer
Dim bStandby, objShell
strComputer = "."

Set objShell = WScript.CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer
& "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")

For Each objComputer in colComputer
sUserName = objComputer.UserName
'WScript.Echo "UserName: " & objComputer.UserName
If sUserName <> "null" Then
bLoggedOn = True
End If
Next

If Err = 0 Then
If bLoggedOn Then
WScript.Echo strComputer & "
is not Logged Off."
bStandby = False
Else
WScript.Echo strComputer & "
is Logged Off."
bStandby = True
End If
Else
WScript.Echo "Error accessing computer: "
& strComputer
bStandby = False
End If
On Error Goto 0

WScript.Echo "bStandby: " & bStandby

If bStandby = True Then
WScript.Echo "Going into standby..."
'Go to standby
objShell.run "%windir%\psshutdown.exe -d -accepteula",
0, False
Else
WScript.Echo "Not going into standby..."
End If
****************************************************
elprezidente is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 04:41 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85