Showing posts with label CMD. Show all posts
Showing posts with label CMD. Show all posts

Wednesday, August 26, 2009

PathPing > Traceroute

Thanks Chris, for telling me about PathPing!

PathPing is a network utility supplied in Windows NT, Windows 2000, Windows 2003, Windows XP and Windows Vista. It combines the functionality of Ping with that of Traceroute (in Windows: tracert), by providing details of the path between two hosts and Ping-like statistics for each node in the path based on samples taken over a time period, depending on how many nodes are between the start and end host. The advantages of PathPing over ping and traceroute are that each node is pinged as the result of a single command, and that the behavior of nodes is studied over an extended time period, rather than the Ping's default sample of four messages or Traceroute's default single route trace. The disadvantage is that, using the default settings, it often takes more than five minutes to produce a result.

PathPing - Wikipedia, the free encyclopedia

Use the -q number option to reduce the number of queries per hop if you're in a hurry, as the default is 100.PathPing

Thursday, October 30, 2008

All Your Command (CMD) Prompts Are Belong To Us

Ever typed SET to display all the useful environment variables windows has?

You can add those environment variables to your command prompt permanently. And No, Billy, this won't work by simply editing System Properties, so read on...

Four files and the PSEXEC.EXE utility are needed - save all 4 files in the same directory in a share(such as \\server\share ) to prepare to deploy your groovy command prompt on every server under your influence.

I changed the command prompt to better keep track of which server and which credentials are in use, and added a timestamp.

CMDPROMPT.BAT - contains the prompt with your preferred environment variables and gets copied to %windir%
:: c:\windows\cmdprompt.bat
@echo off
prompt $_[%ComputerName%\%Username%] $t$_$p$g

CMDPROMPT.REG - get registered on the target machine(s) to invoke CMDPROMPT.BAT when CMD.EXE is executed
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"AutoRun"="%windir%\\cmdprompt.bat"


CMDPROMPT-INSTALL.CMD - the installer script - important for deploying the prompt to multiple machines
:: \\server\share\cmdprompt-install.cmd
@echo off
copy /Y \\server\share\cmdprompt.??? %windir%\
regedit /s %windir%\cmdprompt.reg


SERVERLIST.TXT - a list of target machines(one per line) that will receive the newly minted command prompt goodness.
Eriador
Gondor
GreyHavens
Minastirith
Mordor
Rivendell
Rohan
Bullwinkle
Rocky
Elaine
George
Jerry
Challenger
Cubs
Hindenburg
SpruceGoose
Titanic
TowerofPiza

Now to install! Open up a command prompt and cd to the directory containing the SERVERLIST.TXT , then run the following:
psexec @SERVERLIST.TXT -c -u DOMAIN\%username% \\server\share\cmdprompt-install.cmd


Login to some of these target servers and enjoy the utility of the improved prompt.

Tuesday, October 14, 2008

Create Windows Shares from the Command Line using RMTSHARE.EXE

RMTSHARE.EXE from one of the Windows NT Resource kits makes quick work of creating shares.

Here's an example of creating a hidden, read-only share accessible only by the fictional AD group 'DOMAIN\AdminsSQL':
rmtshare \\SQLSERVERNAME\BACKUPS-RO$=E:\BACKUPS /GRANT "DOMAIN\AdminsSQL":r


Want write(change) access but still with a hidden share? Use this syntax:
rmtshare \\SQLSERVERNAME\BACKUPS-RW$=E:\BACKUPS /GRANT "DOMAIN\AdminsSQL":c


Remove the dollar sign from the end of the share name if you want the share to be visible.

Running RMTSHARE.EXE against a \\SERVERNAME with no parameters shows all the shares(including the hidden shares) available, like so:
C:\>rmtshare \\SQLSERVERNAME

Share name Resource Remark

-------------------------------------------------------------------------------
IPC$ Remote IPC
C$ C:\ Default share
X$ X:\ Default share
ADMIN$ C:\WINDOWS Remote Admin
BACKUPS-RO$ E:\BACKUPS Shared by remote command.
BACKUPS-RW$ E:\BACKUPS Shared by remote command.
D$ D:\ Default share
L$ L:\ Default share
E$ E:\ Default share
The command completed successfully.


Tested in Vista, Server 2003, Server 2000. Let me know if you find a version of Windows incompatible with RMTSHARE.EXE!