post install tasks and registry changes
I'm having trouble with my post installation tasks running items that modify the registry.
cscript c:\windows\system32\nopower.vbs
regedit.exe /s c:\windows\system32\desktop.reg
{Task then deletes sysprep files}
I know this task runs because it deletes my unattend.xml file and others.
What it is not doing is running those first two line correctly.
The vbs script sets registry entries for physical NICs to disable power management. This is a must have.
the desktop.reg changes the background of the local admin account (current user) so that it is obvious when the local admin account is logged in. I can't have this set before hand because we use the admin account to setup the default profile during sysprep.
It appears some registry entries can't be changed until the computer has finished logging in all the way. I have a few other registry changes id like to make but havn't attempted yet.
help would be much appreciated.
cscript c:\windows\system32\nopower.vbs
regedit.exe /s c:\windows\system32\desktop.reg
{Task then deletes sysprep files}
I know this task runs because it deletes my unattend.xml file and others.
What it is not doing is running those first two line correctly.
The vbs script sets registry entries for physical NICs to disable power management. This is a must have.
the desktop.reg changes the background of the local admin account (current user) so that it is obvious when the local admin account is logged in. I can't have this set before hand because we use the admin account to setup the default profile during sysprep.
It appears some registry entries can't be changed until the computer has finished logging in all the way. I have a few other registry changes id like to make but havn't attempted yet.
help would be much appreciated.
0 Comments
[ + ] Show comments
Answers (11)
Please log in to answer
Posted by:
jverbosk
13 years ago
Posted by:
jverbosk
13 years ago
I just played around with pushing a vbs script as a post-install task (after posting this, before I headed home) and the trick was to zip the actual vbs file, create a new post-install task (add application) and use "cscript scriptname.vbs" as the command line statement. Doing it in this manner got it working.
I also tried to accomplish the same by creating a new BAT post-install task and just pasting the script code, but that failed to run.
John
I also tried to accomplish the same by creating a new BAT post-install task and just pasting the script code, but that failed to run.
John
Posted by:
jverbosk
13 years ago
Posted by:
RandomITPro
13 years ago
I discovered my vbs script is running properly. The problem is the registry ekey it searches for in the network adapters, "PnPCapabilities" does not exist after sysprep, and driver reinstall, until NIC power management settings are changed in the GUI. Thus, my script is useless. I'll need to find another solution it seems.
As for the desktop, the registry change does require at least a log off, but the computer is restarted after post install tasks.
As for the desktop, the registry change does require at least a log off, but the computer is restarted after post install tasks.
Posted by:
jverbosk
13 years ago
One of the other users at Konference highly recommended a program called AutoIT (http://www.autoitscript.com/site/) for creating scripts to automate certain things (like programs that don't offer switches for silent installs). I'm starting to look into now, but maybe this would help your situation as well? From what I understand, it captures mouse & key commands as a script and then lets you bundle the resulting script as an EXE. There is a caveat with the mouse clicks (it captures them based on screen coordinates), but I was told by the same person that she was able to get around this by using keyboard shortcuts instead.
Regardless, please let us know what ends up working for you!
John
Regardless, please let us know what ends up working for you!
John
Posted by:
RandomITPro
13 years ago
Thanks for the reply John, I'll look into that. I actually got the registry key to apply and get my background changed as a first login command in my unattend file. Unfortunately I also use my unattend file to copy the admin profile onto the defualt profile so now everyone has the special admin background. I'm not sure the post install task would improve the result.
Back to the drawing board...
Back to the drawing board...
Posted by:
jverbosk
13 years ago
Posted by:
jverbosk
13 years ago
OK, here's the AutoIT script that will set the Power Config options for WinXP laptops as follows:
___________________
Enable Hibernation
Enable Always show power icon on the taskbar
Disable prompt for password when computer resumes from standby
Sets "When I close the lid" to Do nothing
Sets "Critical battery alarm - Alarm action" to Hibernate
Sets all Plugged In - Power Scheme settings to Never
Sets Running on batteries - Power Scheme settings to 25 min/30 min/45 min/1 hour (see script comments for more detail)
___________________
Just note that you only want to run this on Windows XP machines with default settings as the script expects certain values to be in place in order to work properly. But even if you don't use this "as is", at least it should give you an idea of how to do it. I just stepped through the Notepad tutorial, read the WinZip tutorial and was pretty much able to use the program. Two good Help pages for the AutoIT app - Send Key list and ASCII Characters.
I'll definitely be using this app, should come in particularly handy for installing apps that don't have silent install options.
John
___________________
; open Display Properties
Run("control.exe desk.cpl")
WinWaitActive("Display Properties")
Send("{TAB 4}")
Send("{RIGHT 2}")
; open Power Options Properties screen
Send("!o")
WinWaitActive("Power Options Properties")
Send("{TAB 11}")
; select Hibernate tab
Send("{RIGHT 4}")
; enable Hibernation and apply
Send("!h")
Send("!a")
Send("{TAB 3}")
; select Advanced tab
Send("{LEFT}")
; enable Always show icon...
Send("!s")
; disable Prompt for password...
Send("!p")
; set When I close the lid... to Do nothing
Send("!w")
; d
Send("{ASC 100}")
Send("{TAB 6}")
; select Alarms tab
Send("{LEFT 2}")
; open Critical Battery Alarm Actions screen
Send("!r")
WinWaitActive("Critical Battery Alarm Actions")
; set Alarm action to Hibernate
Send("{TAB 3}")
; h
Send("{ASC 104}")
Send("{TAB 3}")
Send("{ENTER}")
; select Power Schemes tab
Send("{LEFT}")
Send("{TAB 4}")
; n - Plugged in - Turn off monitor - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - Turn off monitor - After 25 mins
Send("{DOWN 4}")
Send("{TAB}")
; n - Plugged in - Turn off hard disks - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - Turn off hard disks - After 30 mins
Send("{DOWN 5}")
Send("{TAB}")
; n - Plugged in - System standby - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - System standby - After 45 mins
Send("{DOWN 5}")
Send("{TAB}")
; n - Plugged in - System hibernates - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - System hibernates - After 1 hour
Send("{UP}")
Send("{TAB}")
; close Power Options Properties screen
Send("{ENTER}")
WinWaitActive("Display Properties")
; close Display Properties
Send("{ENTER}")
___________________
Enable Hibernation
Enable Always show power icon on the taskbar
Disable prompt for password when computer resumes from standby
Sets "When I close the lid" to Do nothing
Sets "Critical battery alarm - Alarm action" to Hibernate
Sets all Plugged In - Power Scheme settings to Never
Sets Running on batteries - Power Scheme settings to 25 min/30 min/45 min/1 hour (see script comments for more detail)
___________________
Just note that you only want to run this on Windows XP machines with default settings as the script expects certain values to be in place in order to work properly. But even if you don't use this "as is", at least it should give you an idea of how to do it. I just stepped through the Notepad tutorial, read the WinZip tutorial and was pretty much able to use the program. Two good Help pages for the AutoIT app - Send Key list and ASCII Characters.
I'll definitely be using this app, should come in particularly handy for installing apps that don't have silent install options.
John
___________________
; open Display Properties
Run("control.exe desk.cpl")
WinWaitActive("Display Properties")
Send("{TAB 4}")
Send("{RIGHT 2}")
; open Power Options Properties screen
Send("!o")
WinWaitActive("Power Options Properties")
Send("{TAB 11}")
; select Hibernate tab
Send("{RIGHT 4}")
; enable Hibernation and apply
Send("!h")
Send("!a")
Send("{TAB 3}")
; select Advanced tab
Send("{LEFT}")
; enable Always show icon...
Send("!s")
; disable Prompt for password...
Send("!p")
; set When I close the lid... to Do nothing
Send("!w")
; d
Send("{ASC 100}")
Send("{TAB 6}")
; select Alarms tab
Send("{LEFT 2}")
; open Critical Battery Alarm Actions screen
Send("!r")
WinWaitActive("Critical Battery Alarm Actions")
; set Alarm action to Hibernate
Send("{TAB 3}")
; h
Send("{ASC 104}")
Send("{TAB 3}")
Send("{ENTER}")
; select Power Schemes tab
Send("{LEFT}")
Send("{TAB 4}")
; n - Plugged in - Turn off monitor - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - Turn off monitor - After 25 mins
Send("{DOWN 4}")
Send("{TAB}")
; n - Plugged in - Turn off hard disks - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - Turn off hard disks - After 30 mins
Send("{DOWN 5}")
Send("{TAB}")
; n - Plugged in - System standby - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - System standby - After 45 mins
Send("{DOWN 5}")
Send("{TAB}")
; n - Plugged in - System hibernates - Never
Send("{ASC 110}")
Send("{TAB}")
; Running on batteries - System hibernates - After 1 hour
Send("{UP}")
Send("{TAB}")
; close Power Options Properties screen
Send("{ENTER}")
WinWaitActive("Display Properties")
; close Display Properties
Send("{ENTER}")
Posted by:
RandomITPro
13 years ago
Posted by:
jverbosk
13 years ago
Posted by:
jverbosk
13 years ago
Just wanted to comment on my AutoIT code here.... after trying it on several machines, it leaves much to be desired. After researching further, I decided to use POWERCFG to address most of the power settings, and a *ahem* more mature AutoIT script to address the Power buttons section (specifically the "When I close the lid...." action) since POWERCFG doesn't touch this. Ran into an issue with selecting tabs with AutoIT and found that ControlClick is a much more consistent method. Hope this might be useful for someone someday.
John
_________________________________________
XP-LAPTOP batch file code
_________________________________________
POWERCFG /CREATE XP-LAPTOP
POWERCFG /HIBERNATE on
POWERCFG /CHANGE XP-LAPTOP /monitor-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /monitor-timeout-dc 25
POWERCFG /CHANGE XP-LAPTOP /disk-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /disk-timeout-dc 30
POWERCFG /CHANGE XP-LAPTOP /standby-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /standby-timeout-dc 45
POWERCFG /CHANGE XP-LAPTOP /hibernate-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /hibernate-timeout-dc 60
POWERCFG /GLOBALPOWERFLAG on /OPTION BATTERYICON
POWERCFG /GLOBALPOWERFLAG off /OPTION RESUMEPASSWORD
POWERCFG /BATTERYALARM critical /ACTIVATE on /LEVEL 3 /ACTION hibernate
POWERCFG /SETACTIVE XP-LAPTOP
EXIT
_________________________________________
AutoIT script for setting "close lid" action to Do Nothing (Default - Stand By)
_________________________________________
Run("control.exe desk.cpl")
WinWaitActive("Display Properties")
; select Screen Saver tab
ControlClick("Display Properties", "", "SysTabControl321", "left", 1, 135, 10)
; open Power Options Properties screen
Send("!o")
WinWaitActive("Power Options Properties")
; select Advanced tab
ControlClick("Power Options Properties", "", "SysTabControl321", "left", 1, 235, 10)
; select When I close the lid....
Send("!w")
; set to Do nothing
Send("{UP}")
; close Power Options Properties screen
Send("{ENTER}")
WinWaitActive("Display Properties")
; close Display Properties
Send("{ENTER}")
John
_________________________________________
XP-LAPTOP batch file code
_________________________________________
POWERCFG /CREATE XP-LAPTOP
POWERCFG /HIBERNATE on
POWERCFG /CHANGE XP-LAPTOP /monitor-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /monitor-timeout-dc 25
POWERCFG /CHANGE XP-LAPTOP /disk-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /disk-timeout-dc 30
POWERCFG /CHANGE XP-LAPTOP /standby-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /standby-timeout-dc 45
POWERCFG /CHANGE XP-LAPTOP /hibernate-timeout-ac 0
POWERCFG /CHANGE XP-LAPTOP /hibernate-timeout-dc 60
POWERCFG /GLOBALPOWERFLAG on /OPTION BATTERYICON
POWERCFG /GLOBALPOWERFLAG off /OPTION RESUMEPASSWORD
POWERCFG /BATTERYALARM critical /ACTIVATE on /LEVEL 3 /ACTION hibernate
POWERCFG /SETACTIVE XP-LAPTOP
EXIT
_________________________________________
AutoIT script for setting "close lid" action to Do Nothing (Default - Stand By)
_________________________________________
Run("control.exe desk.cpl")
WinWaitActive("Display Properties")
; select Screen Saver tab
ControlClick("Display Properties", "", "SysTabControl321", "left", 1, 135, 10)
; open Power Options Properties screen
Send("!o")
WinWaitActive("Power Options Properties")
; select Advanced tab
ControlClick("Power Options Properties", "", "SysTabControl321", "left", 1, 235, 10)
; select When I close the lid....
Send("!w")
; set to Do nothing
Send("{UP}")
; close Power Options Properties screen
Send("{ENTER}")
WinWaitActive("Display Properties")
; close Display Properties
Send("{ENTER}")
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.