Thursday, July 23, 2009

My Windows XP Customizer

Here's something I developed in Visual Studio 2008 to customize/tweak my Windows XP Professional OS.
p.s : The App requires that the dot net framework to be installed first.

you can download it here

Wednesday, July 1, 2009

How to restrict the guest account

Step 1:
Log into a local administrative account.
Choose Manage from the My Computer Context Menu.
From the Computer Management window browse to
System Tools > Users and Groups > Users
Double click on Guest to access the Guest Properties window
Click the Member Of tab
Click the Add button
From the Select Groups window click the Advanced... button
Click on the Find Now button
Select Administrators from the list
Keep clicking on all the OK buttons till it exits the Guest Properties window

This step just gave the guest account administrative privileges to run tools such as regedit, GPedit.msc, Services.msc, MMC, DOC, etc.

Close all the open windows and log off from the administrative account.

Step 2:
Log into the local Guest account.

Apply whatever restrictions you wanted to add to the guest user using regedit, MMC, or other tools.

Log off from the Guest Account.

Step 3:
Log back into the Administrative account.

Go back into Local Users and Groups>Users>Guest

Open the Guest Properties and click the Member Of tab. Select Administrators and click the Remove button.
Click OK.

Thats it. You now have a guest account with whatever restrictions you wanted to apply to it.

Monday, February 2, 2009

Prohibit a user from changing LAN settings using the registry

To provide restrictions even for administrator accounts merge the following in the registry:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Network Connections]
"NC_EnableAdminProhibits"=dword:00000001

To prohibit access to properties of a LAN connection:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Network Connections]
"NC_LanProperties"=dword:00000000

To disable the Ability to enable/disable a LAN connection:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Network Connections]
"NC_LanConnect"=dword:00000000

To prohibit TCP/IP advanced configuration:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Network Connections]
"NC_AllowAdvancedTCPIPConfig"=dword:00000000

To Prohibit access to the advanced settings item on the advanced menu:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Network Connections]
"NC_AdvancedSettings"=dword:00000000

To Prohibit access to the new connection wizard:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Network Connections]
"NC_NewConnectionWizard"=dword:00000000

Prohibit a user from changing LAN settings using Group Policies

One way is to give a limited account to the user. But what about accounts that need other administrative privileges? Well here how you can restrict network settings for the administrative user account:

Run GPEdit.msc

Go to User Configuration> Administrative Templates > Network > Network Connections.

Here you’ll find many network restrictions.

GPNetwork

The ones I find useful are:
Prohibit access to properties of a LAN connection
Ability to enable/disable a LAN connection
Prohibit TCP/IP advanced configuration
Prohibit access to the advanced settings item on the advanced menu
Prohibit access to the new connection wizard

None of the above seemed to be working for an administrative account. Later on I learned that for it all to work in an administrative account I had to enable this:

Enable Windows 2000 Network Connections settings for Administrators.

Thursday, January 29, 2009

How to edit the windows registry: Video tutorial for beginners

Well here’s a simple video tutorial to edit the registry. It lacks audio though.

Hope it helps somebody:)

Thursday, January 22, 2009

Prevent changing file associations using the Folder Options

To prevent users from changing file associations using the File Types tab in Folder Options, merge the following in the registry:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoFileAssociate"=dword:00000001

Delete the key to allow changing the associations.

Remove options to Shutdown using the Start menu and the task manager

Merge the following into the registry to remove access to shutdown using the Start menu and the task manager.

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoClose"=dword:00000001

You can shutdown using the command prompt or by first logging off. to get it back change the value of NoClose to 0 or delete the key.

Make Explore/Open the first option when you right-click a folder

To make Explore the first option in the right-click, merge the following to the registry:

Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell] @="explore"

To make Open the first option in the right-click, merge the following to the registry:

Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell] @="open"

Monday, January 19, 2009

Hide your data in an Image file

You can hide your documents in a JPEG image file.

1) Put your files in a RAR file. You can use WinRAR for that. I'll use abc.rar as an example.

2) Now move this RAR file into a particular folder. I'll use the C:\MyFolder here.

3) Have a JPEG/JPG file (The one in which you want to hide the stuff) in the same folder. I'll use Logo.jpg as an example.

Now in the command prompt navigate to the folder using cd MyFolder

now type this: copy /b Logo.jpg + abc.rar Logo.jpg

Now double-click on the Logo.jpg file it should open with your Picture viewer. To open it as a RAR file you can use open with from the files right-click menu and choose WinRAR Or drag it into WinRAR otherwise the JPG's open with will have a WinRAR entry. To make it more secure I recommend adding a password for the RAR file.

How to open multiple instances of Google Talk

It's frustrating when you share a single PC at your home with your family. By default Google Talk allows only one user to sign in at a time. Here's how you can have multiple instances of Gtalk open to sign in with different accounts.

1) Browse to the directory where you installed Google Talk: C:\Program Files\Google\Google Talk

2) Select the file named 'googletalk.exe' and create a shortcut for it.

3) Open the properties for the shortcut and append its target location with /nomutex

The target: should look like this; "C:\Program Files\Google\Google Talk\googletalk.exe" /nomutex

4) Now run this shortcut whenever you require to open another instance of Google Talk

Force files sent to the Windows Recycle Bin to be automatically erased

To forcefully delete files without moving it to the Recycle Bin (Without holding Shift + Delete) :

Merge the following into the registry:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\BitBucket] "NukeOnDelete"=dword:00000001

Show/Hide file extensions

One way is to do it using folder options. The registry way is as follows: To Hide: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "HideFileExt"=dword:00000001

To Show/Unhide: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "HideFileExt"=dword:00000000

Restore missing Send To Desktop (Create Shortcut)

If the Desktop (create shortcut) entry is missing from the Send To when you right-click a file you can restore it using the following methods. Method 1:

Type shell:sendto in Start menu>Run.

This will open the Send To folder.

In this folder create a new text file and rename it as Desktop (create shortcut).DeskLink

Method 2:

Use the following command in Start Menu>Run or the Command Prompt: regsvr32 sendmail.dll

Disable access to a drive

To prevent users from using My Computer, Explorer, Run, Map Network Drive to access the content of selected drives:

In the Windows Registry Editor (regedit) navigate to: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Create a new DWORD Value named: NoViewOnDrive

The value for NoViewOnDrive needs to be calculated as follows:

A drive that needs to be hidden is represented by a binary 1.

ZYXWVUTSRQPONMLKJIHGFEDCBA
00000000000000000000100000

For example to hide drive F the value for NoDrives = 20 in hexadicimal

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoViewOnDrive"=dword:00000020

To hide all drives except C, D and E the binary value is 11111111111111111111100011

So the value for NoDrives will be: 3FFFFE3

If a user tries to access the drive he will get a restriction warning stating "This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator."

Disable personalizing the target location for My Documents, My Music, My Pictures and Favourites

When you right-click the My Documents folder icon in the Desktop or Start Menu, you get an option to change its target location. To disable changing this target location merge the following into the registry:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "DisablePersonalDirChange"=dword:00000001

To re-enable it delete the "DisablePersonalDirChange" from the registry.

Use the following to restrict the remaining:

DisablePersonalDirChange - Restrict changes to My Documents DisableMyPicturesDirChange - Restrict changes to My Pictures DisableMyMusicDirChange - Restrict changes to My Music DisableFavoritesDirChange - Restrict changes to Favorites

Disable the recycle bin properties option

Import the following into the registry:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoPropertiesRecycleBin"=dword:00000001 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer] "NoPropertiesRecycleBin"=dword:00000001

Restore missing tabs in Folder Options

Paste the following in notepad and save it with the .reg extension:

Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\CLSID\{EF8AD2D1-AE36-11D1-B2D2-006097DF8C11}] [-HKEY_CLASSES_ROOT\CLSID\{B091E540-83E3-11CF-A713-0020AFD79762}] [HKEY_CLASSES_ROOT\CLSID\{EF8AD2D1-AE36-11D1-B2D2-006097DF8C11}] @="Global Folder Settings" [HKEY_CLASSES_ROOT\CLSID\{EF8AD2D1-AE36-11D1-B2D2-006097DF8C11}\InProcServer32] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ 00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,62,00,72,00,\ 6f,00,77,00,73,00,65,00,75,00,69,00,2e,00,64,00,6c,00,6c,00,00,00 "ThreadingModel"="Both" [HKEY_CLASSES_ROOT\CLSID\{B091E540-83E3-11CF-A713-0020AFD79762}] @="File Types Page" [HKEY_CLASSES_ROOT\CLSID\{B091E540-83E3-11CF-A713-0020AFD79762}\InProcServer32] @=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\ 00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,53,00,48,00,\ 45,00,4c,00,4c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,00,00 "ThreadingModel"="Apartment"

Now merge it with the registry.

Registry editing has been disable by your administrator

Here's the command to enable registry editing using the command prompt/run dialog box:

REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f

Here's another way to enable it by using a vb script: http://punkisnail.blogspot.com/2009/01/enable-regedit-using-vb-script.html

Show Desktop is missing from the quick launch toolbar

The following steps show how to restore the 'Show desktop' entry in the quick launch toolbar. Open Notepad and type/paste the following code:

[Shell] Command=2
IconFile=explorer.exe,3
[Taskbar] Command=ToggleDesktop

Save the file with a .scf extension in the quick launch folder.

Here's the path to the quick launch folder: C:\Documents and Settings\[USERNAME]\Application Data\Microsoft\Internet Explorer\Quick Launch

Another method is to type this command in run or the command prompt: regsvr32 /n /i:U shell32.dll

Monday, January 12, 2009

Remove the New option from the explorer context menu

To remove the New option: In the registry editor navigate to: [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shellex\ContextMenuHandlers\New]

In the right column you'll find a REG_SZ value named (Default) whose data equals: {D969A300-E7FF-11d0-A93B-00A0C90F2719} Delete this (Default) value. That's it.

Now right click on the desktop and check if the menu has an entry named 'New'.

To restore the New option import the following in the registry: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shellex\ContextMenuHandlers\New] @="{D969A300-E7FF-11d0-A93B-00A0C90F2719}"

Remove access to Folder Options...

To remove access to the Folder Options in explorer import the following into the registry:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Group Policy Objects\{BE399983-1586-4348-BDDA-08DCCADB3A6B}User\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoFolderOptions"=dword:00000001

Log Off to apply the settings. To restore the folder options Change the dword value to 00000000

Disable the Command Prompt

To disable access to the command prompt import the following into the windows registry:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System] "DisableCMD"=dword:00000001

Now if the user tries to open the command prompt he will get a notification stating: "The command prompt has been disabled by your administrator".

To re-enable access to the command prompt use the following: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System] "DisableCMD"=dword:00000000

Sunday, January 11, 2009

Change the Internet Explorer title text

Open notepad and paste the following and save it with a '.reg' extension

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main] "Window Title"="Hello punkisnail"

Use your own text instead of Hello punkisnail. Import the file into the windows registry and check it out.

Detecting Arrow keys on a windows form application using VB.NET

Handling arrow keys on a VB windows form is a pain until you find a solution that works according to your needs:) Well I posted this coz I got excited having solved a problem I had with detecting the arrow keys in VB.NET. I've been struggling to detect the arrow keys on a windows application form that I was designing in VB 2008.

The form contained a TabControl and needed to detect the keys only on TabPage1. Since there were many other controls on the form I had to use an overriding function.

i.e:

Protected Overrides Function ProcessCmdKey(ByRef msg As Message, _ ByVal keyData As Keys) As Boolean

 ' detect which key is pressed and perform some action

End Function

The problem is that TabPage2 contained a textbox and would allow me to enter only a single character. To continue typing into the textbox I needed to click in the textbox and type the next character. To overcome this problem I needed to check which TabPage had the focus. But the problem was where to check the focus.

Download my code to find out how I solved my problem: http://www.mediafire.com/?wnw3zduymtj Hopefully someone finds this post useful.

Configure Hidden options through the registry

To disable changing the hidden files and folder settings in Folder Options:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL] "CheckedValue"=dword:00000000

To disable showing hidden files and folders:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "Hidden"=dword:00000000

To disable showing superhidden files and folders:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "ShowSuperHidden"=dword:00000000

To enable changing the hidden files and folder settings in Folder Options:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder\Hidden\SHOWALL] "CheckedValue"=dword:00000001

To enable showing hidden files and folders:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "Hidden"=dword:00000001 To enable showing superhidden files and folders: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced] "ShowSuperHidden"=dword:00000001

Saturday, January 10, 2009

Edit the registry using Powershell

If you use the Get-PSDrive cmdlet you'll notice that HKCU and HKLM appear as drives. This allows us to use item cmdlets to manage items in the HKLM: and HKCU: drives.

To change your location to the HKCU: drive use either Set-Location HKCU: or cd HKCU:

To navigate through the registry drive: you can use cd the same way you would use it to navigate through directories in the command prompt. You can also use Set-Location

Example to navigate to HKCU/Control Panel/Desktop
PS HKCU:\> Set-Location "HKCU:/control panel/desktop"

or

PS HKCU:\> cd "HKCU:/control panel/desktop"

To view subkeys: Use either dir or Get-ChildItem

To create a new registry key:
To create a new registry key within a subkey we can use the New-Item cmdlet
For example, to create a key named PUNKISNAIL under hkcu/control panel/desktop
PS HKCU:\control panel\desktop> New-Item PUNKISNAIL

To delete a registry key:
Here we can use the remove-item cmdlet.
For example to delete the key PUNKISNAIL which we created under hkcu/control panel/desktop use:
PS HKCU:\control panel\desktop> remove-item PUNKISNAIL

If you're in a different drive you can use the following to delete the key:
PS C:\>remove-item -path "hkcu:/control panel/desktop/punkisnail"

To get the registry entries in a key:
Here we can use the Get-ItemProperty cmdlet.

To get the properties for menushowdelay found in HKCU/Control Panel/Desktop use: Get-ItemProperty -path "hkcu:/control panel/desktop" -name menushowdelay

To create a registry entry use:
new-itemproperty -path somepath -name someEntryName -value AnyValue -propertyType SomeType Example: new-itemproperty -path "HKCU:/control panel/desktop/punkisnail" -name MyNameIs -value "Shane Lobo" -propertyType string

possible property types are: String, ExpandString, Binary, DWord, MultiString, QWord, Unknown

To clear the value of a registry entry use:
Clear-ItemProperty Clear-ItemProperty -path SomePath -name SomeEntryName

To delete a registry entry use:
remove-ItemProperty remove-ItemProperty -path SomePath -name SomeEntryName

Killing processes using the command prompt

To kill a process in the command prompt we need to know either its Image Name or Process ID. One way to find this is in the Windows Task Manager. The other way is to use the Tasklist command in the command prompt.

Command to kill a process in Windows XP Pro:

 taskkill [/pid processID | /im ImageName]} [/f] [/t]

/pid processID Specifies the process ID of the process to be terminated.

/im ImageName Specifies the image name of the process to be terminated.

Use the wildcard character (*) to specify all image names.

/f Specifies that processes be forcefully terminated.

/t Terminates the specified process and any child processes started by it.

Example: taskkill /im notepad.exe

Command to kill a process in Windows XP Home Edition: Windows XP Home Edition users can use the tskill command as follows: tskill {processID | processName}

Example: tskill notepad

Edit the registry using the command prompt

To know the contents of a particular registry key or a particular value:

REG QUERY KeyName [/v ValueName | /ve] [/s]

/v Specifies the registry value name that is to be queried.

/ve Runs a query for value names that are empty.

/s Specifies to query all subkeys and value names recursively. Example to query the value of menushowdelay at HKCU/control panel/desktop

reg query "hkcu/control panel/desktop" /v menushowdelay

To add new registry keys:

REG ADD KeyName [/v ValueName | /ve][/t Type][/d Data] [/f]

/t Specifies the type for the registry entry which must be one of the following: REG_SZ REG_MULTI_SZ REG_DWORD_BIG_ENDIAN REG_DWORD REG_BINARY REG_DWORD_LITTLE_ENDIAN REG_LINK REG_FULL_RESOURCE_DESCRIPTOR REG_EXPAND_SZ

/d Specifies the data for the new registry entry.

/f Adds the registry entry without prompting for confirmation.

Example to change the value of menushowdelay to 0:
reg add "hkcu/control panel/desktop" /v menushowdelay /t REG_SZ /d 0

To delete registry keys:

REG DELETE KeyName [/v ValueName | /ve | /va] [/f]

/va Deletes all entries under the specified subkey. Subkeys under the specified subkey are not deleted.

to export and import registry keys:

To export: REG EXPORT KeyName FileName

To import: REG IMPORT FileName

Manage services using windows powershell

To get a list of objects representing the services and their running status:
type: get-service
To get the status of a particular service, type: get-service -name servicename
where, servicename is the short name for the service.
To get the status for a service using its display name, type:
get-service -displayName
"displayname"
example: get-service -name wuauserv
get-service -displayName "Automatic Updates"
both the examples will give the same result.


To start, stop, pause and resume services:
To start a service using short names , type: start-service -name servicename
To start a service using display names, type: start-service -displayName "displayname"

To stop a service using short names , type: stop-service -name servicename
To stop a service using display names, type: stop-service -displayName "displayname"

To pause a service using short names , type: suspend-service -name servicename
To pause a service using display names, type: suspend-service -displayName "displayname"


To resume a service using short names , type:resume-service -name servicename
To resume a service using display names, type: resume-service -displayName "displayname"

To restart a service using short names , type: restart-service -name servicename
To restart a service using display names, type: restart-service -displayName "displayname"


To set how a service starts up:
set-service -name servicename -startupType {<automatic>|<manual>|<disabled>}
or
set-service -displayName displayname -startupType {<automatic>|<manual>|<disabled>}

Example: set-service -name wuauserv -startupType manual

Change attributes of a file using the command prompt

The attrib command is used to Display, set, or remove attributes assigned to files or directories. using attrib without parameters displays attributes of all files in the current directory.
Syntax
attrib [{+|-}r] [{+|-}a] [{+|-}s] [{+|-}h] [{+|-}i] [drive:][path][fileName] [/s [/d] [/l]]
+ is for setting the attribute
- is for clearing an attribute
r is for
the Read-only file attribute.
a is for the Archive file attribute.
s is for the System file attribute.
h is for the Hidden file attribute.
i is for the Not Content Indexed file attribute.
/s Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories.

/d Applies attrib and any command-line options to directories.

/l Applies attrib and any command-line options to the Symbolic Link, rather than the target of the Symbolic Link.

If a file has the System (s) or Hidden (h) attribute set, you must clear the attribute before you can change any other attributes for that file.

Examples:
To assign the Read-only attribute to the file named Report.txt, type:
attrib +r report.txt
To remove the Read-only attribute from files in the Public directory and its subdirectories on a disk in drive B, type:
attrib -r b:\public\*.* /s

Managing Windows Services using the command prompt

To configure how a service starts: sc config servicename start= {auto|demand|disabled}

use auto for services that need to automatically start each time the computer is restarted.
use demand for services that need to be started manually.
use disabled for services that need to be disabled/prevented from starting..

To create a text list of running services use the command:
sc query > serviceslist.txt

To create a list of all services, use:
sc query type= service state= all > allserviceslist.txt

To start, stop, pause and resume services:

To start a service, type:
net start servicename

To stop a service, type:
net stop servicename

To pause a service, type:
net pause servicename

To resume a service, type:
net continue servicename

servicename Specifies the short name of the service.

 

To get the short name of the service from the descriptive name (Example for Remote Registry): sc getkeyname "Remote registry"

Download a list of short names for services: http://www.mediafire.com/?zfmyzd5yjzy

Friday, January 9, 2009

Using Netsh to configure IP settings

To get the IP automatically using DHCP use this command:
netsh int ip set address
"local area connection" dhcp

To get the DNS server address automatically:
netsh int ip set dns
"local area connection" dhcp

local area connection can have any name. Just look in your control panel>Network Connections for the correct name.

To set a static IP address use this command:
netsh
interface ip set address "Local Area Connection" static ipaddr subnetmask gateway metric

NOTE: Replace ipaddr with the static IP address, subnetmask with the subnet mask, gateway with the default gateway and, if necessary, metric with the appropriate metric.

The following example changes the interface "Local Area Connection" to a static address of 192.168.0.10 with a subnet mask of 255.255.255.0, and the interface has a default gateway of 192.168.0.1 with a metric of 1:

netsh interface ip set address "Local Area Connection" static 192.168.0.10 255.255.255.0 192.168.0.1 1
 

To change the DNS server address use:
netsh int ip set dns
"local area connection" static 192.168.0.254 primary

To add more DNS server addresses entries use:
netsh int ip add dns
"local area connection" 192.168.1.254

 

Enable Regedit using a VB script

Here's something that might help when a message box declaring
"Registry editing has been disable by your administrator" gets thrown at your face.

This script is by Doug Knox and has helped me a lot specially when some stupid virus wouldn't allow me to access the registry.

Here's the link:
http://www.dougknox.com/security/scripts/regtools.vbs

alternate link:
http://www.mediafire.com/?lbiymmznktw

Here's the code which you can paste in notepad and then save with a '.vbs' extension.

'Enable/Disable Registry Editing tools
'© Doug Knox - rev 12/06/99

Option Explicit

'Declare variables
Dim WSHShell, n, MyBox, p, t, mustboot, errnum, vers
Dim enab, disab, jobfunc, itemtype

Set WSHShell = WScript.CreateObject("WScript.Shell")
p = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\"
p = p & "DisableRegistryTools"
itemtype = "REG_DWORD"
mustboot = "Log off and back on, or restart your pc to" & vbCR & "effect the changes"
enab = "ENABLED"
disab = "DISABLED"
jobfunc = "Registry Editing Tools are now "

'This section tries to read the registry key value. If not present an
'error is generated. Normal error return should be 0 if value is
'present
t = "Confirmation"
Err.Clear
On Error Resume Next
n = WSHShell.RegRead (p)
On Error Goto 0
errnum = Err.Number

if errnum <> 0 then
'Create the registry key value for DisableRegistryTools with value 0
WSHShell.RegWrite p, 0, itemtype
End If

'If the key is present, or was created, it is toggled
'Confirmations can be disabled by commenting out
'the two MyBox lines below

If n = 0 Then
n = 1
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & disab & vbCR & mustboot, 4096, t)
ElseIf n = 1 then
n = 0
WSHShell.RegWrite p, n, itemtype
Mybox = MsgBox(jobfunc & enab & vbCR & mustboot, 4096, t)
End If

Check out Doug's website (http://www.dougknox.com/) for interesting scripts.

Download a big compilation of Windows Registry tweaks

Registry tweaks that I've accumulated over time: http://www.mediafire.com/?no2yvyom3dt

Lost Send to Option

If the Send To option is missing in the context menu when you right-click on a file use the following:

Paste the following in notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\Send To] @="{7BA4C740-9E81-11CF-99D3-00AA004AE837}"

Merge it with the registry.

Remove 'Manage' from the My Computer context menu

Paste the following in notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoManageMyComputerVerb"=dword:00000001

Merge it with the registry.

to undo the change delete the "NoManageMyComputerVerb" key from the registry.

How to hide applets in the control panel

The control panel applets are stored in the X:\WINDOWS\system32 folder.

X: represents the drive where you have installed windows.

Open regedit. Navigate to HKEY_CURRENT_USER\Control Panel\don't load

Insert a new String value and rename it with the applets name that you want to hide. Give it the value: No

For example to hide 'Add or Remove Programs' from the Control Panel insert the following in Notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Control Panel\don't load] "appwiz.cpl"="No" Merge it with the registry. To undo delete the concerned key from the registry.

Disable right-click in explorer

Paste the following in notepad and save it with a '.reg' extension.

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoViewContextMenu"=dword:00000001 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoViewContextMenu"=dword:00000001

Merge it with the registry. To undo it delete the "NoViewContextMenu" from the registry.

Remove System Properties from My Computer and Control Panel

Paste the following in notepad and save it with a '.reg' extension.

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoPropertiesMyComputer"=dword:00000001

Merge it with the registry.

To undo the effect delete the "NoPropertiesMyComputer"from the registry.

Disable right-click on the Taskbar

Paste the following in notepad and save it with a '.reg' extension.

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoTrayContextMenu"=dword:00000001

Merge it with the registry.

To allow right-clicking on the taskbar delete the "NoTrayContextMenu" key from the registry.

Remove the Run command from the Start menu

Paste the following in notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoRun"=dword:00000001

to renable it delete the "NoRun" key from the registry.

Disable Task Manager

Paste the following in notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system] "DisableTaskMgr"=dword:00000001 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System] "DisableTaskMgr"=dword:00000001

To re-enable the task manager delete the "DisableTaskMgr" key from the registry.

Disable Control Panel

Paste the following in Notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoControlPanel"=dword:00000001 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoControlPanel"=dword:00000001

Now merge it with the windows registry. To enable opening the control panel delete the "NoControlPanel" key in the registry.

Remove the 'Shortcut to...' Prefix on Shortcuts

Paste the following in Notepad and save it with a '.reg' extension. Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer] "link"=hex:00,00,00,00 [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer] "link"=hex:00,00,00,00

Now merge it with the registry.

To undo the effect replace the value of "link" with "link"=hex:01,00,00,00

Prevent access to registry editing tools

Method 1: One way to do this in Windows XP professional is through gpedit.msc

Start>Run... type: gpedit.msc

In the 'Group Policy' window expand 'User Configuration' expand 'Admininstravive Templates' and select 'System'

Double-click 'Prevent access to registry editing tools' in the pane towards the right.

Choose 'Enabled' and apply.

 

Method 2: The second way is to use the registry itself. To disable it for the current user: [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] "DisableRegistryTools"=dword:00000001

To disable it for all users: [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] "DisableRegistryTools"=dword:00000001

If one tries to run regedit after applying this tweak a message box will appear stating "Registry editing has been disabled by your administrator"

Hiding Drives in the Windows Explorer

This will hide a particular drive in My Computer, Explorer, Send To, ... In the Windows Registry Editor (regedit) navigate to: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer

Create a new DWORD Value named: NoDrives

The value for NoDrives needs to be calculated as follows:
A drive that needs to be hidden is represented by a binary 1.

ZYXWVUTSRQPONMLKJIHGFEDCBA
00000000000000000000100000

For example to hide drive F the value for NoDrives = 20 in hexadicimal To hide all drives except C, D and E the binary value is 11111111111111111111100011 So the value for NoDrives will be: 3FFFFE3

Disable detection of USB Storage devices

To disable the detection of USB Storage devices paste the following in notepad and save it with a '.reg' extension.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR] "Start"=dword:00000004

merge it with the Windows registry.

To re-enable the detection of USB storage devices use:

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR] "Start"=dword:3

Write-Protect USB Drives

You can use this to prevent data theft through the USB port. Paste the following in notepad and save it with a '.reg' extension.

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies] "WriteProtect"=dword:00000001

Then merge it with the windows registry.

Disable Autorun on all drives

Many viruses spread through removable storage drives using the drives autorun feature. For example as soon as one inserts the USB drive an autorun.inf file that links to the virus gets executed.

To disable automatically running this autorun.inf file use the following steps:

1) If you use Windows XP Professional:

click Start>Run... type:

gpedit.msc and hit Enter. This will open a 'Group Policy' window. Expand: 'Computer Configuration' then expand 'Administrative Templates' Select 'System' and in the pane towards the right look for 'Turn off Autoplay'. Double-click 'Turn off Autoplay' and choose 'Enabled'. Where it says 'Turn off autoplay on:' choose 'All Drives' . Click 'Apply' and 'OK' Follow the same steps by expanding 'User Configuration'

2) In case your version of windows does not run gpedit.msc try the following method that uses the Windows Registry:

open Notepad and paste the following in it:

Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer] "NoDriveTypeAutoRun"=dword:000000ff

Save the file with a '.reg' extension and double-click the file. You might be prompted to merge it with the registry. Agree to do so.

Note : if you double-click the drive it might still execute the autorun.inf file.

A safer option to open drives is to use the Windows Explorer View (WinKey + E). Or maybe you'll need to import this in the registry too: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom] "AutoRun"=dword:00000000

I'm not too sure but I guess the above tweak removes the Autoplay entry from the CDROM context menu.