Tuesday, May 20, 2008

How to run .cgi .pm and .pl (perl scripts) in IIS

After struggling for hours I finally managed to run .cgi, .pm and .pl scripts in IIS. I needed this to test Trouble Ticket Express (ttx224) Helpdesk software available from http://www.unitedwebcoders.com

First you need to install Active perl.

Second you need to setup the scripts virtual directory. It will not be available by default if you did not customize IIS installation. You will find it under IIS -> World Wide Web Service -> Scripts Virtual Directory.

Do not confuse the physical directory c:\Inetpub\scripts with the virtual directory that is visible in the Inetmgr. Although the virtual directory points to the same physical directory however internally IIS modifies/creates some pointers to make this setup work correctly. Also dont try to add a virtual directory scripts and point it to the physical directory as this will not help.

3[2]

Once you have done that, Copy all the scripts in the c:\Inetpub\scripts folder.

Now open Inetmgr and register .pl, .pm and .cgi as extensions that would parsed using perl processor. To do so

1. Open inermgr and choose properties of the Default Website

2. Go to Home Directory tab and choose configuration

4[2]

3. Click Add to add and application extension.

4. Fill in the details as shown in the following screenshot.

5[2]

Do the same for all the three extensions, namely .pl, .pm and .cgi

5. Remember to fill in the details for each extension exactly the way it is shown above.

6. Restart the World Wide Web Publishing Service.

bingo you are all set to go.

----------------------End of Document --------------------------

Tags: CGI, Helpdesk, IIS, Perl

Published Date: 20080520

Monday, May 19, 2008

Cleanup $NTServicePackUninstall$ and SoftwareDistribution Folder

Service pack and Windows update installations leave a lot of unnecessary files in the %SystemRoot% folder. They occupy a lot of space and you can safely delete these files. Do this only when you are sure that you will not need to uninstall any of the updates or Service Pack.

To remove the Service Pack uninstall files
  1. Go to C:\WINDOWS and delete "$NTServicePackUinistall$"
  2. Go to Add/Remove Programs.
  3. Click "Service Pack 1"(2)(3), there will be an error since you just deleted the file.
  4. Click YES to delete the shortcut.
  5. Use similar procedure to delete uninstall files for the updates.

The updates will be in this format "$NTUninstall********"
Do NOT delete "$hf_mig$"

To remove the Automatic updates' files in SoftwareDistribution Folder

Automatic updates are downloaded in %systemroot%\SoftwareDistribution\Download folder and occupy a lot of space. You can safely delete these files.

  1. Open a command prompt window
  2. type net stop wuauserv and press enter
  3. Open Windows Explorer and delete all contents in the folder c:\windows\SoftwareDistribution\Download
  4. Go back to Command prompt window and type net start wuauserv and press enter

Be sure to restart Windows before before another attempt at getting the updates !!

--------------------End of Document ----------------

Tags: Windows Server 2003, Windows Server 2008, Windows XP

Published Date: 20080519

Saturday, May 17, 2008

How to clean up downloaded files for Automatic updates / Windows Update

Automatic updates are downloaded in %systemroot%\SoftwareDistribution\Download folder and occupy a lot of space. You can safely delete these files.

Type the following commands in command prompt window

net stop wuauserv

Open Windows Explorer and delete all contents in the folder c:\windows\SoftwareDistribution\Download

Go back to Command prompt window and type net start wuauserv

Be sure to restart Windows before another attempt at getting the updates !!

-------------- End of Document -----------------

Tags: Windows 2000, Windows 2003, Windows XP

Published Date: 20080517

Friday, May 16, 2008

How to remove Outlook Express 5.1, 5.5, or 6.0 from a Windows 2000-based computer

To manually remove Outlook Express 5.1, Outlook Express 5.5, or Outlook Express 6.0 from a Windows 2000-based computer, follow these steps:

Note Make sure that you are logged on to the computer as an administrator.

1. Make sure that system files and file name extensions are visible.

a. Double-click the My Computer icon.

b. On the Tools menu, click Folder Options, and then click the View tab.

c. In the Hide Files and Folders section, click Show hidden files and folders, and then click to clear the Hide file extensions for known file types check box.

d. Click to clear the Hide Protected Operating System Files (Recommended) check box, and then click Yes in the warning message dialog box.

e. Click OK to close the Folder Options dialog box.

2. Delete the Outlook Express registry keys.

To remove Outlook Express, you must delete the registry keys for Outlook Express. To do this, follow these steps:

a. Click Start, click Run, type regedit, and then click OK.

b. Locate the following registry keys, right-click the registry key, and then click Delete:

•HKEY_LOCAL_MACHINE\Software\Microsoft\Outlook Express

•HKEY_CURRENT_USER\Software\Microsoft\Outlook Express

•HKEY_LOCAL_MACHINE \Software\Microsoft\Active Setup\Installed Components\{44BBA840-CC51-11CF-AAFA-00AA00B6015C}

c. Close Registry Editor.

3. Rename the Outlook Express files.

To complete the removal procedure, rename the Outlook Express files. Each of these files is located in the default file folder and in the C:\Winnt\System32\Dllcache folder. For example, the Msoe.dll file is located in the following folders:

• C:\Program Files\Outlook Express

• C:\Winnt\System32\Dllcache

You must rename the file in both folders to successfully remove Outlook Express. To rename the Outlook Express files, follow these steps:

a. Remove any CDs that are in your CD drive.

b. Start Windows in safe mode.

c. Click Start, point to Search, and then click For Files and Folders.

d. In the Search for files or folders named box, type Msoe.dll, and then click Search Now.

e. Right-click the first Msoe.dll file, and then click Rename.

f. Type Msoe.old, and then press ENTER.

g. To rename the second instance of the Msoe.dll file, repeat steps e and f.

h. When you are prompted about Windows file protection, click Cancel.

i. When you are prompted about whether to keep unrecognized file versions, click Yes.

j. To rename the following files, repeat steps d through i:

• Msoeacct.dll

• Msoert2.dll

• Msoeres.dll

• Msimn.exe

• Oeimport.dll

• Oemiglib.dll

• Oemig50.exe

• Setup50.exe

k. Restart your computer in Normal Mode.

-------------- End of Document -----------------

Tags: Windows 2000, Windows XP

Published Date: 20080516

Thursday, May 15, 2008

How to manually rebuild Performance Counter Library values

When you use the System Monitor tool, some counters may be missing or do not contain counter data. The base set of performance counter libraries may become corrupted and may need to be rebuilt along with any extensible counters. This behavior may occur if certain extensible counters corrupt the registry, or if some Windows Management Instrumentation (WMI)-based programs modify the registry.

To rebuild the base performance counter libraries manually:

1. Copy Perfc009.dat and Perfh009.dat to %Systemroot%\System32 folder.

2. Start Registry Editor, and then locate the following key in the registry:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Perflib

3. In the registry, change the LastCounter value to 1846 (decimal), and change the LastHelp value to 1847 (decimal).

4. Locate the following registry key to search for services that have a Performance subkey:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services

5. Remove the following values from the Performance subkey (if they exist):

• FirstCounter

• FirstHelp

• LastCounter

• LastHelp

You can also use the Exctrlst.exe tool to locate the performance counter dynamic-link library files (DLLs) that are installed, and then access the registry to remove the DWORD values. You now have a workable performance registry that contains only system base counters.

After you have completed this procedure, you must re-add the extensible counters from the list of services. Before you do so, however, you must identify the .ini file that is used to load the counters:

5. Run the batch file counters.bat

-------------- End of Document -----------------

Tags: Windows XP, Windows 2003

Published Date: 20080515

Wednesday, May 14, 2008

If Windows Update does not work

If Windows update does not work properly and you are receiving error repeatedly when you are trying to update windows from microsoft website use these commands to configure windows update from scratch.

net stop bits
net stop /s wuauserv
regsvr32 /u wuaueng.dll /s
del /f /s /q %windir%\SoftwareDistribution\*.*
del /f /s /q %windir%\windowsupdate.log

regsvr32 wuapi.dll
regsvr32 wuaueng1.dll
regsvr32 wuaueng.dll
regsvr32 wucltui.dll
regsvr32 wups2.dll
regsvr32 wups.dll
regsvr32 wuweb.dll

net start bits
net start wuauserv
wuauclt.exe /resetauthorization /detectnow

-------------- End of Document -----------------

Tags: Windows XP, Windows 2003

Published Date: 20080514

Wednesday, May 7, 2008

Disable Reading or Writing to USB and other removable mass storage devices

You can prevent users from using any portable USB removable disk or flash drive by using a custom .ADM file that can be imported into the Local Group Policy (thus effecting only the local computer) or by using Active Directory-based Group Policy Objects (also known as GPOs).

Note: This tip will allow you to restrict usage of USB removable disks, but will continue to allow usage of USB mice, keyboards or any other USB-based device that is NOT a portable disk. I am assuming that AD based GPs would be used. The same result can be achieved by changing the location of adm template file and using Local Group Policy instead.

It's worth mentioning that in Windows Vista Microsoft has implemented a much more sophisticated method of controlling USB disks via GPO. If you have Windows Vista client computers in your organization you can use GPO settings edited from one of the Vista machines to control if users will be able to install and use USB disks, plus the ability to control exactly what device can or cannot be used on their machines.

Step 1: Create a simple text file named removable_storage.adm with the following content and save it to "%systemroot%\inf\" directory on the domain controller you would be creating the GP.

********** Start of File **********

CLASS MACHINE
CATEGORY "Custom Policy Settings"
CATEGORY "Resrtict Removable Drives"
  POLICY "Disable USB Removable Drives"
   KEYNAME "SYSTEM\CurrentControlSet\Services\USBSTOR"
   EXPLAIN !!explaintextusb
     PART "usbstore.sys driver status" DROPDOWNLIST REQUIRED
       VALUENAME "Start"
       ITEMLIST
        NAME "Started" VALUE NUMERIC 3 DEFAULT
        NAME "Stopped" VALUE NUMERIC 4
       END ITEMLIST
     END PART
   END POLICY
  POLICY "Disable CD-ROM"
   KEYNAME "SYSTEM\CurrentControlSet\Services\Cdrom"
   EXPLAIN !!explaintextcd
     PART "cdrom.sys driver status" DROPDOWNLIST REQUIRED
       VALUENAME "Start"
       ITEMLIST
        NAME "Started" VALUE NUMERIC 1 DEFAULT
        NAME "Stopped" VALUE NUMERIC 4
       END ITEMLIST
     END PART
   END POLICY
  POLICY "Disable Floppy"
   KEYNAME "SYSTEM\CurrentControlSet\Services\Flpydisk"
   EXPLAIN !!explaintextflpy
     PART "flpydisk.sys driver status" DROPDOWNLIST REQUIRED
       VALUENAME "Start"
       ITEMLIST
        NAME "Started" VALUE NUMERIC 3 DEFAULT
        NAME "Stopped" VALUE NUMERIC 4
       END ITEMLIST
     END PART
   END POLICY
  POLICY "Disable High Capacity Floppy"
   KEYNAME "SYSTEM\CurrentControlSet\Services\Sfloppy"
   EXPLAIN !!explaintextls120
     PART "sfloppy.sys driver status" DROPDOWNLIST REQUIRED
       VALUENAME "Start"
       ITEMLIST
        NAME "Started" VALUE NUMERIC 3 DEFAULT
        NAME "Stopped" VALUE NUMERIC 4
       END ITEMLIST
     END PART
   END POLICY
  POLICY "Write Protect USB Removable Drives"
   KEYNAME "SYSTEM\CurrentControlSet\Control\StorageDevicePolicies"
   EXPLAIN !!explaintextwriteprotect
     PART "Write Protect USB Removable Drives status" DROPDOWNLIST REQUIRED
       VALUENAME "WriteProtect"
       ITEMLIST
        NAME "Off" VALUE NUMERIC 0 DEFAULT
        NAME "On" VALUE NUMERIC 1
       END ITEMLIST
     END PART
   END POLICY 
END CATEGORY
END CATEGORY

[strings]
explaintextusb="Disables the USB Removable Drives capability by disabling the usbstor.sys driver. \n\nSelect the ENABLED radiobox, then select STOPPED for the usbstore.sys driver status in the drop-down list.  \n\nNote that this will only prevent usage of newly plugged-in USB Removable Drives or Flash Drives, devices that were plugged-in while this option was not configured will continue to function normally. Also, devices that use the same device or hardware ID (for example - 2 identical Flash Disks made by the same manufacturer) will still function if one of them was plugged-in prior to the configuration of this setting. In order to successfully block them you will need to make sure no USB Removable Drive is plugged-in while you set this option. \n\nIn order to re-enable the usage of USB Removable Drives select STARTED for the usbstore.sys driver status in the drop-down list."
explaintextcd="Disables the CD-ROM Drive by disabling the cdrom.sys driver. \n\nSelect the ENABLED radiobox, then select STOPPED for the cdrom.sys driver status in the drop-down list. \n\nIn order to re-enable the usage of USB Removable Drives select STARTED for the cdrom.sys driver status in the drop-down list."
explaintextflpy="Disables the Floppy Drive by disabling the flpydisk.sys driver. \n\nSelect the ENABLED radiobox, then select STOPPED for the flpydisk.sys driver status in the drop-down list. \n\nIn order to re-enable the usage of USB Removable Drives select STARTED for the flpydisk.sys driver status in the drop-down list."
explaintextls120="Disables the High Capacity Floppy Drive by disabling the sfloppy.sys driver. \n\nSelect the ENABLED radiobox, then select STOPPED for the sfloppy.sys driver status in the drop-down list. \n\nIn order to re-enable the usage of USB Removable Drives select STARTED for the sfloppy.sys driver status in the drop-down list."
explaintextwriteprotect="Enforces write protection on all USB Removable Drives. \n\nSelect the ENABLED radiobox, then select ON for the Write Protect USB Removable Drives status in the drop-down list. \n\nIn order to disable write protection on USB Removable Drives select OFF for the Write Protect USB Removable Drives status in the drop-down list."

*********** End of File ************

Step 2: Adding .adm files to the Administrative Templates in a GPO

Open the Group Policy Management Console (or GPMC) from the Administrative Tools folder in the Stat menu, or by typing gpmc.msc in the Run command.

Right-click an existing GPO (or create a new GPO, then right-click on it) and select Edit.

clip_image002

clip_image004

clip_image006

Expand either the Computer settings or Users settings sections of the GPO. Go to the appropriate Administrative Templates section and right-click it. Select Add/Remove Templates.

clip_image008

In the Add/Remove Templates window click Add.

clip_image010

Browse to the location of the required .ADM file and click Open.

clip_image012

In the Add/Remove Templates window notice that the new .ADM file is listed, then click Close.

clip_image014

Now re-open the Administrative Templates section and browse to the new settings location.

Step 3: In order to successfully view and configure the new .ADM file settings you will need to change the default filtering view for the GPO Editor (or GPedit.msc). Unless you change these settings, the right pane will appear empty, even though it has the settings in it.

Follow these steps:

In GPEdit.msc (or any other GPO Editor window you're using) click on View -> Filtering.

clip_image016

Click to un-select the "Only show policy settings that can be fully managed" check-box. Click Ok.

clip_image018

Now you will be able to see the new settings in the right pane:

clip_image020

You can now configure any of the above settings:

clip_image022

Note: You do not need the adm template stored in inf directory any more as it is copied along with the policy folder in the Sysvol share. However you might need it to modify the template if required.

-------------- End of Document -----------------

Tags: Active Directory, Group Policy, Windows 2003

Published Date: 20080507