Saturday, February 21, 2009

How To Change the default CMD directory

Change the path you are in when you run the CMD command

1)    Regedit
2)    HKEY_CURRENT_USER\Software\Microsoft\Command Processor
3)    In the right-pane, double-click Autorun and set the startup folder path as its data, preceded by “CD /d “. If Autorun value is missing, you need to create one, of type REG_EXPAND_SZ or REG_SZ in the above location.
a.    Example:  To set the startup directory to F:\Windows, set the Autorun value data to CD /d F:\Windows
b.    You may also use a batch file so that it executes the contents automatically upon launching the Command Prompt. To view the entire list of arguments supported by CMD.EXE and their description, type CMD /? at the Command Prompt.

4)    You can also set the default Prompt in the Autorun key. To execute more than one command automatically at Command Prompt startup, type the commands in a Notepad document and save as a .BAT file. Then, type the full path to the batch file in the Autorun field in the registry. Sample Batch file:
@CD /D F:\Utilities
@Prompt$P$G

Minor side-effect - “Autorun” value and CmdHere Powertoy
Open Command Window Here PowerToy adds an Open Command Window Here context menu option on file system folders, giving you a quick way to open a command window (cmd.exe) pointing at the selected folder. The Open Command Window Here functionality is affected if you set the Command Processor Autorun value as described earlier in this article.
To re-enable the functionality of Open Command Window Here PowerToy, and have the Command Processor Autorun feature enabled at the same time, use these steps:
•    Click Start, Run and type regedit.exe
•    Navigate to the following location:
HKEY_CLASSES_ROOT \ Directory \ shell \ cmd \ command
•    In the right-pane, double-click (default) and change the following data:
cmd.exe /k “cd %L”
to
cmd.exe /d /k “cd %L”
•    Exit the Registry Editor
Note: If /D parameter IS specified on the command line, then when CMD.EXE starts, it ignores the AutoRun registry variables in the following locations.
HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Command Processor \ AutoRun
HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor \ AutoRun

How To View Wireless networks with netsh

Use Vista's CLI to view expanded details about available wireless networks.

netsh wlan show all

How to Reinstall Help and Support

“Help and Support” is missing after you upgrade to Windows Server 2003 Service Pack 2

SYMPTOMS
After you upgrade a Microsoft Windows Server 2003-based computer to Microsoft Windows Server 2003 Service Pack 2 (SP2), Help and Support is missing when you click Start. Additionally, the Help menu is missing in programs that are running on the Windows Server 2003 SP2-based computer.
Additionally, when you type msinfo32.exe or Helpctr.exe at a command prompt to try to start Help and Support manually, you receive the following error message:
Windows cannot open Help and Support because a system service is not running. To fix this problem, start the service named ‘Help and Support’.
However, when you start the Services Microsoft Management Console (MMC) snap-in, the Help and Support service is not listed.

RESOLUTION
To resolve this problem, reinstall the Help and Support service. To do this, follow these steps:
  1. Click Start, click Run, type cmd in the Open box, and then click OK.
  2. At the command prompt, locate the following folder: %windir%\PCHealth\HelpCtr\Binaries
  3. At the command prompt, type the following commands, and then press ENTER after each command:
    1. HelpSvc.exe /regserver /svchost netsvcs /RAInstall
    2. HSCUpd.exe -i hscmui.cab
    3. HSCUpd.exe -i hscsp_s3.cab       (or hscsp_l3.cab dir might be necessary)

How to Configure IIS to listen on IP

How to solve the problem
To solve the problem you have to disable socket pooling for those protocols that you plan to publish on the box. For SMTP, NNTP and POP3 you can follow the following procedure:
1.    Open the command box
2.    change the directory to Inetpub\scripts
3.    Enter one of the following depending on the service that you want to disable socket pooling for:
a.  For SMTP:
net stop smtpsvc
cscript adsutil.vbs set smtpsvc/disablesocketpooling true
net start smtpsvc


C:\Inetpub\AdminScripts>netstat -ano | find “:25″
TCP    0.0.0.0:25             0.0.0.0:0              LISTENING       2672
C:\Inetpub\AdminScripts>netstat -ano | find “:25″
TCP    192.168.1.100:25         0.0.0.0:0              LISTENING       2672
This should also work for POP3 (use pop3svc) and IMAP4 (use imap4svc). I currently experience an error when trying to disable socket pooling for NNTP.

How about HTTP and HTTPS?

To configure http.sys you will need httpcfg.exe from the Windows Server 2003 Support Tools.  Install using suptools.msi.

Enter the following to bind http.sys to the desired IP address:
net stop http /y
httpcfg set iplisten –i <address internal interface>
net start w3svc


Some Commands

httpcfg query iplisten

httpcfg set iplisten -i 192.168.1.100
httpcfg query iplisten
httpcfg delete iplisten -i 0.0.0.0

set    query    delete
ssl    urlacl    iplisten

HOW TO – Configure ISA & SMTP
1)    Install SMTP on each ISA member.
2)    Set disable socket pooling = true
3)    http://www.tacteam.net/isaserverorg/exchangekit/2003isafilteringsmtprelay/2003isafilteringsmtprelay.htm
4)    If you are using Server Publishing Rules to allow inbound access to your SMTP relay, then select an internal IP address.