Utilities

Installing mtr on FreeBSD Without a GUI

So you need to install mtr on FreeBSD but it tries to install X11, Gnome and a bunch of other stuff that doesn’t need to go on your Web server? Use these steps to compile mtr on FreeBSD without X windows.

cd /usr/ports/net/mtr
make clean
make -DWITHOUT_X11
make install
/usr/local/sbin/mtr –help

Alternatively, you could edit /etc/make.conf to include “WITHOUT_X11=yes” to get the same result without using the -DWITHOUT_X11 command line option.

Utilities

Comments (0)

Permalink

Robocopy Exit Codes

Every once in a while I go looking for these return codes and end up spending several minutes searching the Internet for them. Of course, this time I ended up finding them in the obvious place - the README for Robocopy. Here they are, for posterity.

The return code from Robocopy is a bit map, defined as follows:

Hex Bit Value Decimal Value Meaning If Set
0×10 16 Serious error. Robocopy did not copy any files. This is either a usage error or an error due to insufficient access privileges on the source or destination directories.
0×08 8 Some files or directories could not be copied (copy errors occurred and the retry limit was exceeded). Check these errors further.
0×04 4 Some Mismatched files or directories were detected. Examine the output log. Housekeeping is probably necessary.
0×02 2 Some Extra files or directories were detected. Examine the output log. Some housekeeping may be needed.
0×01 1 One or more files were copied successfully (that is, new files have arrived).
0×00 0 No errors occurred, and no copying was done. The source and destination directory trees are completely synchronized.

You can use this information in a batch file to report the most serious anomalies, as follows:

if errorlevel 16 echo ***FATAL ERROR*** & goto end
if errorlevel 8 echo **FAILED COPIES** & goto end
if errorlevel 4 echo *MISMATCHES* & goto end
if errorlevel 2 echo EXTRA FILES & goto end
if errorlevel 1 echo Copy successful & goto end
if errorlevel 0 echo –no change– & goto end
:end

Alternatively, full details of the return code could be reported as follows:

if errorlevel 16 echo ***FATAL ERROR*** & goto end
if errorlevel 15 echo FAIL MISM XTRA COPY & goto end
if errorlevel 14 echo FAIL MISM XTRA & goto end
if errorlevel 13 echo FAIL MISM COPY & goto end
if errorlevel 12 echo FAIL MISM & goto end
if errorlevel 11 echo FAIL XTRA COPY & goto end
if errorlevel 10 echo FAIL XTRA & goto end
if errorlevel 9 echo FAIL COPY & goto end
if errorlevel 8 echo FAIL & goto end
if errorlevel 7 echo MISM XTRA COPY & goto end
if errorlevel 6 echo MISM XTRA & goto end
if errorlevel 5 echo MISM COPY & goto end
if errorlevel 4 echo MISM & goto end
if errorlevel 3 echo XTRA COPY & goto end
if errorlevel 2 echo XTRA & goto end
if errorlevel 1 echo COPY & goto end
if errorlevel 0 echo –no change– & goto end
:end

Utilities

Comments (0)

Permalink

Running Logon Scripts Using Elevated Privileges

For Windows, this is way more difficult than it should be. Unix/Linux solved this problem solved many, many years ago. The fact that Microsoft still hasn’t solved it is amazing to me. Fortunately, there are some third party products to help out the everyday, hardworking Windows sysadmin.

RunAs Professional
RunAs Professional is a substitute for Microsoft’s command runas.
RunAs Professional solves the problem that normal runas does not support the commandline parameter password.

RUNADMINBAT
Create a batch file (for example a logon script) for users. The batch file contains commands that require administrative privileges. Five steps to use the “runas” function from Windows 2000 and Windows XP pro with “runadminbat” in your scripts. No additional installation on your clients is necessary.

Encrypted RunAs
Encrypted RunAs is a small utility that is designed to make the job of Administrators a little easier, it can be used to run applications or software installations with access rights a standard user does not have.

TqcRunas
The power of RUNAS made scriptable, easy and secure.

NetExec
NetExec is a multisession extension for Windows NT and Windows 2000. Using NetExec it is possible to log on to a system with multiple accounts at the same time. So you can work with more than one user account simultaneously and switch between them without logging off and on.

CPAU
Command line tool for starting process in alternate security context. Basically this is a runas replacement. Also allows you to create job files and encode the id, password, and command line in a file so it can be used by normal users.

Utilities
Windows

Comments (0)

Permalink

Fun with GnuWin32

There are times that that Windows makes it difficult to do tasks that are trivial to accomplish on Linux. Simple text processing is a perfect example. I recently had the need to find out all the unique host IP addresses that had used SMTP to connect to an Exchange server during a period of time. I use an advanced reporting package on my Exchange servers but it is geared toward business decisions and capacity planning. It works very well but does not analyze data at this level which leaves me to find a solution to this problem on my own.

Fortunately, I have GnuWin32 installed on my workstation and it gives me the use of traditional Linux/Unix utilities such as cut, sort, uniq and grep. Looking at the SMTP logs I see that the fields are separated by a space and the IP address of each connection is listed in the third column. So I copy the log files for the period to my desktop computer where I have GnuWin32 installed. I cd to the directory where the log files are located and run the following command:

cut -f 3 -d ” ” *.log | sort | uniq > results.txt

I modify it slightly to find all of the unique internal hosts that have connected to the SMTP server.

cut -f 3 -d ” ” *.log | sort | uniq | grep “172.16.” > results.txt

GnuWin32 makes it a simple and fun task where Windows has no easy equivilant.

Utilities
Windows

Comments (0)

Permalink

ZoomIt - My New Favorite Tool

Having used several different magnification utilities I have never found one that I really like until now. ZoomIt is a utility written by Mark Russinovich and it is my new favorite utility. The user interface is intuitive and easily usable. It magnifies the entire screen, unlike the built-in Windows magnification utility where it splits the screen in half. It works well on multiple monitor configurations and even captures magnified screenshots. It also does my favorite thing on Windows - it runs without administrative rights. Perfect!

Utilities

Comments (0)

Permalink