VBScript – Disable and Enable Screen Saver




Tagged Under : , ,

Version: 22.1
Revision: 35 Build 32

VBScript – Disable and Enable Screen Saver

Introduction:
This VBScript was designed to help user to disable or enable their “Screen Saver” on Windows Vista and Windows XP. However, this script will not work on Windows 2003 and Windows 2000. So please check your ‘Operating System’ before you use this script.

Disable Screen Saver
—Copy Source Code—

'----------------------
'Author: Lair360
'Version: 19.4
'Revision: 36 Build 12
'This script will disable windows 'ScreenSaver'.
'----------------------
Option Explicit
On Error Resume Next
'----------------------
Dim WshShell, Message

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive",0,"REG_SZ"

Set WshShell = Nothing

Message = "ScreenSaver disable!."

MsgBox Message, 4096,"Please reboot your computer..."

—End Source Code—

Enable Screen Saver
—Copy Source Code—

'----------------------
'Author: Lair360
'Version: 19.5
'Revision: 36 Build 14
'This script will disable windows 'ScreenSaver'.
'----------------------
Option Explicit
On Error Resume Next
'----------------------
Dim WshShell, Message

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive",1,"REG_SZ"

Set WshShell = Nothing

Message = "ScreenSaver enable!."

MsgBox Message, 4096,"Please reboot your computer..."

—End Source Code—

Copyright By Lair360




Basic Registry Location Codes




Tagged Under : , ,

Version: 18.2
Revision: 46 Build 23

Basic Registry Location Codes.

Around the globe and offices, every single person using any of the operating systems from the Windows family has to resort, at some point, to alter the configurations of the registry files – instead of using Microsoft’s – recommended GUI-based tools. However, such changes are performed with considerable caution!

Note 1: In order to minimize your risks when dealing with the registry, you can use VBscripts – applications. By using these techniques, you’re able to guard yourself against accidental typos, and this will also grant you to work in a very large environment; if you’re in an office or server clients [admin]. Scripting can be very useful in different conditions: repair, merge, delete viruses and ect…

Note 2: All limitations can be reduced by using WMI Standard Registry provider, which is built into Windows XP. Nevertheless, it’s also available as a plug-in for Windows NT and Windows 2000. WMI can also work – around the environments [inside the registry] to delete locked – registry strings; whereas the registry method, it still lacks some functionality, especially, the Reg-Read (for registry reading) and Reg-Write (for registry writing) methods that do not work with multi-string registry entries, and Reg-Write support for binary entries is limited to values in the range of four bytes.

GetBinaryValue – Reads registry values of ‘BINARY’ types.
GetDWORDValue – Reads registry values of ‘DWORD’ types.
GetExpandedStringValue – Reads registry values of ‘EXPANDED STRING’ types
GetMultiStringValue – Reads registry values of ‘MULTI STRING’ types
GetStringValue – Reads registry values of ‘STRING’ types
CreateKey – Creates registry keys
DeleteKey – Deletes registry keys
SetBinaryValue – Writes registry values of ‘BINARY’ types
SetDWORDValue – Writes registry values of ‘DWORD’ types
SetExpandedStringValue – Writes registry values of ‘EXPANDED STRING’ types
SetMultiStringValue – Writes registry values of ‘MULTI STRING’ types
SetStringValue – Writes registry values of ‘STRING’ types
DeleteValue – Deleting registry values
EnumKey – Enumerates registry keys
EnumValues – Enumerates registry values
CheckAccess – Checks permissions on registry keys

Note 3: When you’re inside the registry hives, you can see that there are five folders.
The five of them will correspond to the registry trees, viewed in “REGEDIT.EXE” as first – level folders.
Nevertheless, they are also classified as registry – codes for WMI scripts.
This is useful if you’re doing a VBScript project in conjunction with WMI strings.

Const HKEY_CLASSES_ROOT     = &H80000000
Const HKEY_CURRENT_USER     = &H80000001
Const HKEY_LOCAL_MACHINE     = &H80000002
Const HKEY_USERS               = &H80000003
Const HKEY_CURRENT_CONFIG     = &H80000005