A Windows "whereis" Command

This one-liner (source):
I found this batch script/command on ServerFault *I think*. Very cool little one-liner trick.

@for %%e in (%PATHEXT%) do @for %%i in (%1%%e) do @if NOT "%%~$PATH:i"=="" echo %%~$PATH:i

Example usage:

C:\Users\Rich\Desktop>whereis cmd
C:\Windows\System32\cmd.exe
C:\Users\Rich\Desktop>whereis shutdown
C:\Windows\System32\shutdown.exe
C:\Users\Rich\Desktop>whereis putty

Update: July 21, 2011 So, I discovered: “where” built-in to Windows…

Description: Displays the location of files that match the search pattern. By default, the search is done along the current directory and in the paths specified by the PATH environment variable.

“where” exists in Windows Server 2003 but I also have it natively on Windows Vista and 7.  Not sure which other Windows releases it is included in.
 

Reset Terminal Server Grace Period

Client Machines
Delete the following key which will force client to obtain new license from server.

HKLM\Software\Microsoft\MSLicensing

Server 2000/2003
To reset the 90 day grace period on the Terminal Server Licensing Server perform the following steps:

net stop TermServLicensing
%windir%\system32\LServer to %windir%\system32\LServer.old

Make a new empty directory in %windir%\System32 named LServer

net start TermServLicensing

Additional Info…
Each CAL is valid for between 52 and 89 days, the number of days is determined randomly when the CAL is issued. When a CAL is due to expire in 7 days the TS server will attempt to renew it, again, for between 52 and 89 days. If it cannot connect to the license server it will attempt to renew the CAL each time the client logs on. When a CAL expires it is returned to the pool of available licenses. This helps the license server to automatically recover Per Device CALs that are lost when the device is no longer in use or when its operating system is reinstalled. If the license server itself is lost then you should try to recover it using the most recent backup. If no backup is available then you must reinstall the server, reactivate it, and contact the license clearinghouse to have them issue replacement CALs.

IIS Migration Tool

Had to migrate a few sites today from Server 2000 to Server 2003 IIS6. Microsoft has a tool called iismt that will assist in migrating.
First thing I had to do on the Server 2000 server was enable DCOM so I could remotely transfer the files. Access DCOM configuration in 2000 from Start -> Run -> dcomcnfg. Here’s a screenshot of what the settings were.

After enabling DCOM, I rebooted the Windows 2000 server after I experienced some errors trying to remotely access it. Once rebooted, I was able to successfully migrate sites.
Here’s a quick batch script I made to copy multiple sites over. Pretty generic. Main point is that there were multiple sites so I needed a loop to do this. I only copied the configuration over. Next step after copying configuration over I then copied all data and made adjustments through IIS Administration tool for each individual site ensuring I had the document home directories properly setup post-migration.

@echo off
FOR %%s IN (13 17 18 20 21 23 25 29 32 34 36 39 8) DO iismt.exe OLDSERVER w3svc/%%s
/user OLDSERVER\administrator /password s3cr3tpass /configonly

I determined which w3svc files I needed by browsing to C:\WINNT\system32\logfiles.
Hope this helps anyone with similar needs.

bcdedit – GUI'fied

If you’ve ever modified your boot partition information before in a Vista+ computer, you’ve realized Microsoft does not store this in boot.ini. Instead, it’s edited via a command called bcdedit which is a command line tool.
I ran across a tool called EasyBCD which is a GUI front-end essentially. This tool is endorsed by Microsoft, PC Magazine and other organizations. Visit EasyBCD website to download it for free!

Note: This does not work on Windows XP, 2000, ME/98/95. This is for Windows Vista, 7, and Server 2008.