Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 06:39 PM
Hi,
I'm looking forward to buy Lansweeper Premium but I need to know if it can do the following.
I need to change the PowerScheme of 130 computers in my domain. As you all know theses settings are PER USER and need ADMINISTRATIVE rights.
I'm going to do it with a Login script starting a .VBS file and using LSRUNAS 2.0 to elevate user rights and encrypt password.
I'll give you the .vbs file. I tried it logged as ADMINISTRATOR and it works perfectly.
Since I didn't find any trial version of the application (if there is one I'd be very happy to receive it) could someone try this and let me know if it's working.
Thank you
I'm looking forward to buy Lansweeper Premium but I need to know if it can do the following.
I need to change the PowerScheme of 130 computers in my domain. As you all know theses settings are PER USER and need ADMINISTRATIVE rights.
I'm going to do it with a Login script starting a .VBS file and using LSRUNAS 2.0 to elevate user rights and encrypt password.
I'll give you the .vbs file. I tried it logged as ADMINISTRATOR and it works perfectly.
Here's my ChangePowerScheme.VBS file
Set oShell = CreateObject("Wscript.Shell")
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
OS = LEFT(objOperatingSystem.Version,3)
'MsgBox OS
next
'If( UCase( Trim( OS ) ) = UCase( Trim( 5.1 ) ) ) Then
'********** FRANCAIS
oShell.Run "powercfg.exe -change ""PC de bureau ou familial"" -monitor-timeout-ac 60", 0, True
oShell.Run "powercfg.exe -change ""PC de bureau ou familial"" -disk-timeout-ac 0", 0, True
oShell.Run "powercfg.exe -change ""PC de bureau ou familial"" -standby-timeout-ac 0", 0, True
oShell.Run "powercfg.exe -change ""PC de bureau ou familial"" -hibernate-timeout-ac 0", 0, True
'********** ANGLAIS
oShell.Run "powercfg.exe -change ""Home/Office Desk"" -monitor-timeout-ac 60", 0, True
oShell.Run "powercfg.exe -change ""Home/Office Desk"" -disk-timeout-ac 0", 0, True
oShell.Run "powercfg.exe -change ""Home/Office Desk"" -standby-timeout-ac 0", 0, True
oShell.Run "powercfg.exe -change ""Home/Office Desk"" -hibernate-timeout-ac 0", 0, True
oShell.Run "powercfg.exe -hibernate off", 0, True
oShell.Run "powercfg.exe -setactive ""Home/Office Desk""", 0, True
'MsgBox "Did!"
'End If
Since I didn't find any trial version of the application (if there is one I'd be very happy to receive it) could someone try this and let me know if it's working.
Thank you
Labels:
- Labels:
-
Archive
8 REPLIES 8
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2009 04:38 PM
taeratrin, Your answer is working. Thanks a lot.
I just had to change the user from INTERACTIVE to Authenticated User and now my users can change the power management settings themselves so I can use my other script to modify those parameters from them.
I just had to change the user from INTERACTIVE to Authenticated User and now my users can change the power management settings themselves so I can use my other script to modify those parameters from them.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 11:48 PM
A script could be made to do the following :
Run Regedit.exe as an administrator
Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg
Right-click on the "GlobalPowerPolicy" key and choose "Permissions".
Click on the "Advanced" button.
Click "Add".
Type INTERACTIVE and click "Check names", then OK.
Check the "Set value" and "Create Subkey" checkboxes in the "Allow" column, and click OK, then OK, then OK.
Do the same thing with the "PowerPolicies" key.
No reboot is required. You can now manage your own power options without needing to be an admin or use MakeMeAdmin.
Run Regedit.exe as an administrator
Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg
Right-click on the "GlobalPowerPolicy" key and choose "Permissions".
Click on the "Advanced" button.
Click "Add".
Type INTERACTIVE and click "Check names", then OK.
Check the "Set value" and "Create Subkey" checkboxes in the "Allow" column, and click OK, then OK, then OK.
Do the same thing with the "PowerPolicies" key.
No reboot is required. You can now manage your own power options without needing to be an admin or use MakeMeAdmin.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 11:32 PM
Most likely the executable changes some registry entries, try to find which ones and maybe you can script it?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 08:35 PM
Or remove the power management restrictions for a day...
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 07:02 PM
The best way to do this is to create a policy to run the script on login. Using something like LSRunAs or psexec will only affect the user profile of the admin running the utility.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 07:43 PM
taeratrin wrote:
The best way to do this is to create a policy to run the script on login. Using something like LSRunAs or psexec will only affect the user profile of the admin running the utility.
I do agree but the regular used doesn't have the rights to change the power management settings. Right now the only way I can do it unattended is to give admin rights for one day to my users and I don't want to do it that way.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 07:01 PM
So is there another way of doing this?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2009 06:54 PM
That could be tricky because if you use lsrunase (or the standard runas) the process will be running as another user (and not as the current logged on user)