Windows script

need a script i can schedule that will turn on the proxy then turn on windows update set to download but do not install then at 4am set windows update back to do not download then turn proxy off.
rjefAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SStoryCommented:
Try these:
Copy the following code section into a file named proxupdatesoff.vbs
'ENABLE IE REGISTRY
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002 
Set objShell = CreateObject("WScript.Shell")

On Error Resume Next

'get Registry object
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

'turn of IE Proxy
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,0

'disable Windows updates
Const AU_NEVER_CHECK=1					'Never check for updates
Const AU_NOTIFY_ONLY=2 					'Check for updates but let me choose whether to download and install them
Const AU_DOWNLOAD_ONLY=3				'Download updates but let me choose whether to install them
Const AU_AUTO_INSTALL=4 				'Install updates automatically
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
strValueName = "AUOptions"
objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,AU_NEVER_CHECK

Open in new window


And copy the following into a file named proxupdateson.vbs
'ENABLE IE REGISTRY
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002 
Set objShell = CreateObject("WScript.Shell")

On Error Resume Next

'get Registry object
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

'turn of IE Proxy
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
strValueName = "ProxyEnable"
objReg.SetDWORDValue HKEY_CURRENT_USER,strKeyPath,strValueName,1

'disable Windows updates
Const AU_NEVER_CHECK=1					'Never check for updates
Const AU_NOTIFY_ONLY=2 					'Check for updates but let me choose whether to download and install them
Const AU_DOWNLOAD_ONLY=3				'Download updates but let me choose whether to install them
Const AU_AUTO_INSTALL=4 				'Install updates automatically
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update"
strValueName = "AUOptions"
objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,AU_AUTO_INSTALL

Open in new window


Off turns off IE Proxy and disables (never check for updates) for Windows update.
On turns on IE Proxy and enables Automatically install Windows update.

I have not tested it overnight, but it does seem to change the settings appropriately. Warning: Things like Winpatrol that monitor these settings could prevent it from working.  Also the scripts will probably need to run as ADMIN when scheduled in order to function properly. These scripts do at least change the registry settings appropriately.  Whether or not the Windows Update service must be restarted after changes is unknown.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rjefAuthor Commented:
thbanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.