Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
5Type
Engaged Sweeper
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.

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
8 REPLIES 8
5Type
Engaged Sweeper
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.
taeratrin
Champion Sweeper
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.
Hemoco
Lansweeper Alumni
Most likely the executable changes some registry entries, try to find which ones and maybe you can script it?
taeratrin
Champion Sweeper
Or remove the power management restrictions for a day...
taeratrin
Champion Sweeper
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.
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.
5Type
Engaged Sweeper
So is there another way of doing this?
Hemoco
Lansweeper Alumni
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)

Archive

This board contains archived posts from the retired Lansweeper Forum and Insiders Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now