Aug 25

All of the IIS process’s show up as the same process name, which makes it really challenging to figure out which of your websites has lost it’s mind.  In order to trace an IIS website or application pool back to a PID, you just need to open a command prompt and run the iisapp utility.

iisapp

Outputs
W3WP.exe PID: 7424 AppPoolId: Site1
W3WP.exe PID: 8096 AppPoolId: JoesSite
W3WP.exe PID: 13080 AppPoolId: Wookielove.com

And now you can just use taskmanager to track resource usage to a site.

Jul 23

I’ve run into a situation a couple of times now where DNS hasn’t been setup correctly and I have no idea what hostname an IP resolves to. For better or worse, windows has the netbios system that keeps it’s own naming services and can be queried from the command line using nbtstat.

nbtstat -A XXX.XXX.XXX.XXX

Where XXX is the IP address that you are trying to resolve.

Jul 30

I have to setup a couple of hundred laptops carried by sales folks in the field to connect to a new WPA2-PSK network for work.  Fortunately, windows XP has a nice little utility that lets you automate creating a new wireless connection. You’ll need a USB thumbdrive for a little bit to make this work, but you won’t need to distribute it.

  • In Control Panel, Run the Wireless Network Setup Wizard and enter in all of your network specifics.
  • When prompted, choose the”Use a USB flash drive” Method. Make sure you have a flash drive plugged into your computer.
  • Pick the drive letter and hit next,  once it has copied the files over, you can just hit cancel and exit out of the wizard.

On your thumbdrive you now have two files (setupsnk.exe and AUTORUN.inf) as well as a directory (SMRTNTKY) with various files in it. If you wanted to, you could distribute this thumbdrive as is and just have people click on the setupsnk.exe to configure their machines. I need to email these settings out, so I did this instead.

  • Create  a folder, C:\Wireless
  • copy  those two files and the entire folder into C:\Wireless
  • create a batch file called “Install_Wireless.bat” and place it into C:\Wireless
  • put the following in that batch file

SET CUR_DIR=%cd%
subst z: “%CUR_DIR%”
chdir /D Z:
Z:\setupsnk.exe
sleep 60
subst /D Z:

The batch file just creates a temp drive (z) that points to C:\wireless, the current executing bat files directory, changes to that drive and runs the setup. setupsnk assumes that it is being run directly from a drive letter, hence the mapping.  We wait for 60 seconds after the run and then remove the drive mapping assuming that you were able to click the ok button twice in 60 seconds (the whole process takes like 2 seconds).

Now, just zip that all up and distribute it.  The key piece is that everything gets extracted to C:\wireless.   I tried the old Relative paths in batch files trick, but it didn’t work for whatever reason and I’m in a bit of a hurry on this one.  If anyone can get that part working, you would be teh awesome. I get to claim that awesome sauce.   %~dp0 wasn’t working for whatever reason, but %CD% does, so I’ll take it.

Jul 29

Unix has been able to authenticate against a central server for a long, long time using LDAP and various other technologies, but Microsoft’s Active Directory is the authentication scheme you are most likely to come across in the enterprise.  Using RHEL (well, centos) it’s an easy setup.

From a command line box, run

authconfig-tui

Select “Use Winbind” under User Information and “Use Winbind for Authentication” under Authentication. I also select “Local authorization is sufficient” which we could argue for a long, long time about. That one is up to you.
When you click next, you’ll need to fill in the blanks with your organizations specific information. You do want to use “ads” as your security model if you are on active directory and put a wildcard (*) in the Domain Controllers field. Next hit Join Domain and enter the credentials for an account that has the rights to join this machine to the domain. Next we need to tweak a few files.
in /etc/samba/smb.conf change

“winbind use default domain=no” to “winbind use default domain=”yes”

If you don’t, you will need to enter your domain every time you log a user into the system like AD/User instead of just logging in as User.
Add

idmap backend = rid

into the authconfig section, right under the “idmap gid =” line. This sets up user and group id mappings to use the AD RID. You want this as long as only one domain will be logging into this server. If users from several AD domains will be logging in, you need to hit google.
In /etc/pam.d/system-auth, add

session required pam_mkhomedir.so skel=/etc/skel umask=0077

To the very end of the file. This creates a home directory for each user when they log into the system if they don’t have one already.
Now just issue a

service winbind restart

and you should be on your way!

Jul 8

I nabbed this one from Lifehacker.   Instead of having to hard code paths in batch scripts you can use the variable %~dp0 to signify the working directory of the script itself.   Now, I usually try not to be a zealot and bash on windows much especially since I started working at a computers that is very windows centric,  but damn man!  One of windows greatest weaknesses is lack of a really good command line and ‘%~dp0′ is a perfect example of that.  Though I will be using that variable in scripts to come :D

If you use “%~dp0″ (sans quotes) in a batch file, this will point to the batch file’s path. For example :

SET MAC=00:00:00:00:00:00
%~dp0mc-wol.exe %MAC%

« Previous Entries