IPAM will assist
you in managing IP addresses.
To let you into a secret, this utilities is fun to use, even if you
don't have a pressing need to calculate your IP address space.
Get a free evaluation copy of
Orion IPAM
Is your server running slowly? Check with SolarWinds ipMonitor
Get a free evaluation copy of ipMonitor
Contents of Guy's Scripting Ezine 8 - Registry Script
This week's secret is to take you behind the scenes and show you how I
create a script by combining skills from different areas. If your goal is
to write your own scripts then it's handy to have a working knowledge of these areas:
VBScript (WSH), Windows 2000/3 (utilities), the registry (Regedit), Active Directory (LDAP). I must stress that you just need working knowledge, not
expert status; moreover, you do not need to know all of the areas for all of the
scripts - build up gradually.
I have had several requests to create VBScripts which
alter the registry settings. Once you have mastered the technique, the
scope for registry scripting is nearly as big as the registry itself. What
I want to concentrate on are skills so that you will be able to take a setting
like a check box in Explorer, find where that setting is stored in the registry,
then write a script to configure it.
Example - to Empty Temporary Internet Files folder
This
week I had a request to create a logon script that modified the Internet
Explorer settings. My initial thought was - use a Group Policy, but there
was no group policy to control this check box.
WINDIFF and REGEDIT
I admit frustration crept in when I altered the setting in the registry and
nothing happened in Internet Explorer, or when I cleared a tick in the Internet Explorer and nothing
seemed to change in the registry.
So I went away, had a cup of tea mowed the lawn, then an idea hit me.
Export the registry, use the WINDIFF utility and trace where the settings are
really found. Here is the technique I used:
- Change the settings in Internet Explorer - 'Empty Temporary Internet Files
folder when browsing' so that there is a tick in the box.
- Over to Regedit. Navigate to the section of the registry where that
setting is likely to be. HKEY_CURRENT_USER_Software_Microsoft, Right Click, then Select Export
on the shortcut menu. Choose a suitable filename e.g. tick.reg.
- Then go to Internet explorer remove the tick from the Export Temporary...
checkbox.
- Back to Regedit and Export again, this time name your file - notick.reg.
- Finally, launch WINDIFF open both files and spot the changes in the two
files.
- Here is a link for your copy of WINDIFF (also more info on WINDIFF)
The Goal was to make sure that the Internet Explorer deleted all temporary
files on exit. IE, Tools, Internet Options, Advanced, Security, Empty Temporary
Internet Files on Exit.
RegWrite - WSH Method
The actual scripting part is controlled by a method called RegWrite (Remember
other methods like MapNetworkDrive?) Once WINDIFF told me the
correct registry path, it is a matter of taking care with the syntax and
using REG_DWORD (not REG_SZ).
There was one last trap to get the
tick to appear in Internet Explorer you need to set Persistent = 0.
(Intuition may tell you it should be =1)
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\Cache\Persistent"
- HKEY_Current_User (not HKEY_Local_Machine)
- Internet Settings\cache (not Internet\Cache)
- Persistent is added to the last part of the path \Cache\Persistent
- Persistent = 0 (Not =1)
' VBScript - contact guy@computerperformance.co.uk
' The script writes to the registry value Empty Temporary Internet Files
' The key Method is RegWrite. RegLocate is the name of the variable
' Note: REG_DWORD (not REG_SZ)
' Note: Logic of 0 (zero = off) means persistent ON - strange but true!
Dim WSHShell, RegLocate, RegLocate1
Set WSHShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
RegLocate = "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings\Cache\Persistent"
' Take great care with the line above
' Note the space between \Internet and Settings\
WSHShell.RegWrite RegLocate,"0","REG_DWORD"
WScript.Quit ' Tells the script to stop and exit.
Their topics and material are ideal for getting you started with VBScript. The
videos are easy to follow and you can control the pace. Try their free demo material and then see if you want to buy the full package.
See more about VB Script Training CD.
|