Answered by:
Software Center - Computer Maintenance

Question
-
Is there a way to automatically enable the - Automatically install or uninstall required software and restart the computer only outside of the specified business hours - option?
Instead of having my users check this option, is there a way that I can have it checked automatically?
Thanks!
Wednesday, December 19, 2012 4:28 PM
Answers
-
It might be possible that this can be set using a script. You can use http://www.mssccmfaq.de/2012/03/26/software-center-business-hours-auslesen-setzen/ as a starting point for poking around in WMI.
Torsten Meringer | http://www.mssccmfaq.de
Wednesday, December 19, 2012 4:49 PM -
Hi,
I did some Quick testing using Torsten's excellent script and this should do it:
vbScript to check what the setting is:
Set objUX = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_ClientUXSettings")Set GBH = objUX.ExecMethod_("GetAutoInstallRequiredSoftwaretoNonBusinessHours")
WScript.echo "Automatically install or uninstall required software and restart the computer only outside of the specified business hours : " & GBH.AutomaticallyInstallSoftware
vbscript to set the value:
Set objUX = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_ClientUXSettings")
Set inParam = objUX.Methods_.Item("SetAutoInstallRequiredSoftwaretoNonBusinessHours").inParameters.SpawnInstance_()
inParam.AutomaticallyInstallSoftware = "True"
Set result = objUX.ExecMethod_("SetAutoInstallRequiredSoftwaretoNonBusinessHours", inParam)Great work Torsten!
regards,
Jörgen
-- My System Center blog ccmexec.com -- Twitter @ccmexec
- Edited by Jörgen NilssonMVP Wednesday, December 19, 2012 6:08 PM
- Marked as answer by TorstenMMVP Thursday, December 20, 2012 8:06 AM
Wednesday, December 19, 2012 6:07 PM
All replies
-
It might be possible that this can be set using a script. You can use http://www.mssccmfaq.de/2012/03/26/software-center-business-hours-auslesen-setzen/ as a starting point for poking around in WMI.
Torsten Meringer | http://www.mssccmfaq.de
Wednesday, December 19, 2012 4:49 PM -
Hi,
I did some Quick testing using Torsten's excellent script and this should do it:
vbScript to check what the setting is:
Set objUX = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_ClientUXSettings")Set GBH = objUX.ExecMethod_("GetAutoInstallRequiredSoftwaretoNonBusinessHours")
WScript.echo "Automatically install or uninstall required software and restart the computer only outside of the specified business hours : " & GBH.AutomaticallyInstallSoftware
vbscript to set the value:
Set objUX = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_ClientUXSettings")
Set inParam = objUX.Methods_.Item("SetAutoInstallRequiredSoftwaretoNonBusinessHours").inParameters.SpawnInstance_()
inParam.AutomaticallyInstallSoftware = "True"
Set result = objUX.ExecMethod_("SetAutoInstallRequiredSoftwaretoNonBusinessHours", inParam)Great work Torsten!
regards,
Jörgen
-- My System Center blog ccmexec.com -- Twitter @ccmexec
- Edited by Jörgen NilssonMVP Wednesday, December 19, 2012 6:08 PM
- Marked as answer by TorstenMMVP Thursday, December 20, 2012 8:06 AM
Wednesday, December 19, 2012 6:07 PM -
Thank you! This did it.Wednesday, December 19, 2012 7:16 PM
-
Look like a good script thanks
https://social.technet.microsoft.com/profile/maya%20rose/Thursday, March 24, 2016 12:33 PM