20090604

http://www.robvanderwoude.com/pmadmin.php#PMChoice

The Poor Man's Administrator Tools

This page is dedicated to administrators tools and tips based on "native" and freeware utilities only.
Knowing these tools may prove extremely valuable when you're faced with problems "in the middle of nowhere", without your own set of utilities nearby.
NT

* Do you need a tool to remotely execute commands on any PC?
You could of course use RCMD from the Microsoft Windows NT Server Resource Kit. Or, if "third party tools" are allowed, PSEXEC is an excellent RCMD replacement, available at SysInternals.com for free.
Or you can use the AT command to schedule the command 2 minutes from now:

NET TIME \\remotePC /SET
AT \\remotePC 10:02 "your command goes here"

If you prefer not to change your system time, download either PMSoon.bat or AtFuture.bat.
PMSoon.bat will only work if the time difference between the two systems is 1 minute or less. It will display a warning message if the difference is greater.
AtFuture.bat (a coproduction with Rob Fuller), intended for local use only, does not have this limitation.
* Do you need to prevent login scripts from running on servers?
Use NTRole (update: this utility is no longer available for download) to determine if the current "workstation" is actually a server or not.
Some company policies do not allow third party tools, however.
Of course, I wouldn't have mentioned NTRole here if I didn't have a "poor man's version" available: NTRole.bat.
Download the ZIPped version.
* Did you ever try to redirect or pipe CACLS' output in NT 4?
If you ever installed an NT Service Pack, what you probably saw were the permissions without the user IDs or groups that those permissions belonged to.
Instead of using XCACLS from the Microsoft Windows NT Server Resource Kit, extract CACLS from your original NT 4 CD-ROM and use that version whenever you need to redirect its output.
XCACLS' /Y switch can be emulated by piping a Y to CACLS' standard input:

ECHO Y| CACLS .....
Warning: Do not use the old CACLS version to set or change permissions if you have any NT 4 Service Pack applied.
A safe way to prevent yourself from accidentally using the old version is to rename the old CACLS.EXE to OLDCACLS.EXE.
* Disappointed because the CHOICE command wasn't implemented in NT? I know I was.
You could buy yourself a copy of the Microsoft Windows NT Server or Workstation Resource Kit.
Or you could download both PMChoice.bat and PMChoice.kix. The only missing part of this combination is that PMCHOICE does not accept redirected input, only keyboard input.
* SHORTCUT.EXE from the Microsoft Windows NT Server or Workstation Resource Kit is a great tool to set or read a shortcut's properties.
Many times, however, it is used just to read the path of a program file. In that case you may want to download Shortcut.bat, a batch file that uses internal commands only to read both the UNC and the fully qualified path from one or more shortcut files.

If you do need to create shortcuts, learn how to create shortcuts using INF files from this posting by Walter Zackery to the alt.msdos.batch.nt news group, and from this article by Daniel U. Thibault.
* If you ever need to create a fixed time delay in a batch file, but you do not have a copy of SLEEP.EXE from the NT Resource Kit available, just download PMSleep.bat (for Windows NT/2000) or PMSlpW9x.bat (for Windows 95/98).
These batch files use PING's -W switch to create a delay.
The following example will create a 1 minute delay in Windows NT and 2000:

CALL PMSLEEP.BAT 60

Due to limitations in the MS-DOS 7 batch language, we need to add 1 to the number of seconds specified in Windows 95 and 98:

CALL PMSLPW9X.BAT 61

This Windows 9x example will wait for 60 seconds, not 61.

You may also choose to download the latest KiXtart version from www.kixtart.org and use its SLEEP function within your batch file.
The following example will create a 1 minute delay:

ECHO $RC = SLEEP 60 > "%TEMP%.\SLEEP.KIX"
KIX32.EXE "%TEMP%.\SLEEP.KIX"
DEL "%TEMP%.\SLEEP.KIX"

This KiXtart script will work in all 32-bit Windows versions, as long as KiXtart is installed.

No comments:

Post a Comment