Monday, November 26, 2007

Retrieve System Information

As usual with Linux (and Windows in some cases) there are multiple ways to accomplish the same task but here is one for getting information on disks, usb devices, etc. attached to your computer.

user@machine:~$ sudo lshw

The listing can be quite long so don't forget to run it with the less, more or grep if you just want to see if a particular device is installed. For example if I wanted to check if one of my PQI mini-flash memory sticks was installed.

user@machine:~$ sudo lshw | grep pqi
vendor: pqi


If you're allergic to the command line use the GUI by installing lshw-gtk.

Tuesday, October 30, 2007

Setting up a Linksys NSLU2 with Debian

In case you've been out of the loop for awhile there is a nice little network device called NSLU2 put out by Linksys. It is not the perfect device nor the end all solution to having a small machine that can run multiple USB drives as well as other USB accessories however it is cheap and has a large following which helps if you're not one of those types that likes to spend long weekends figured out things. Even if you do atleast you can easily get the operating system installed and get moving on to the business at hand.

As of right now there are a few issues with the default Debian installer so the manual method must be used however it is fairly simple. The first order of business is to download the Debian image to install on the NSLU2. Finally just head over to Martin's How-To and you should be up in running in no time.

Best wishes.

Monday, October 29, 2007

Scan for Wireless Networks on Ubuntu

Now that I'm beginning to travel more I run into situations where I need to search for wireless networks. Since I'm running Xubuntu some of the utilities that would exist in the more full featured desktops do not exist in Xubuntu but I found a few alternatives.

One solution is to install the wifi-radar package. Another that I found was running the following commands:

user@machine ~> sudo iwlist scan
user@machine ~> sudo iwconfig wlan0 mode Ad-Hoc {In this example wlan0 is the name of the wireless inteface}

The interface can also be edited with:
user@machine ~> sudo iwconfig

Test nginx Configuration File

If there is a time when it becomes necessary to test out a nginx.conf file prior to attempting to use it (IOW on a live/production system) here is a handy little command.

user@machine ~> nginx -t -c /etc/nginx/nginx.conf

Sunday, September 30, 2007

PHP Based SMTP Script with TLS Support

After some searching on the web I found a quick and easy to implement script that has support for TLS which is required for all Google SMTP (Outbound) email. Their documentation is thorough and gave me everything I needed to email without spending hours playing around with things.

XPertMailer - Advanced PHP Mail Engine

Thursday, August 16, 2007

Send Email from Windows Batch/VBS File


Our scenario was we were trying to improve on the manual process that a previous network administrator was using where he was manually checking the server each night to make sure a script had run, obviously this isn't a process that can be duplicated very successfully across many clients (I kinda like my free time at night) so we wanted to set up a script which handled the normal network, disk, etc. issues and sent us an email when done.

There are some great alternatives to sending a script like the ones outlines in this article, How can I send an e-mail message from a script? on the Petri Knowledge Base however I prefer to use built-in windows functionality whenever I can as I don't have time to review everyone's source (if available) to make sure that it doesn't have an malicious stuff in it. There are obviously plenty of girations you can do to this script like storing your password securely in the registry, making the send script into it's own bat file that can be called from others and the list goes on but I wanted to get it out there for people struggling. The only thing that is needed is the smtp server, email address and password and you should be good to go.

Enjoy


Set Message = CreateObject("CDO.Message")

With Message


'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

' smtp authentication type
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

'Name or IP of Remote SMTP Server
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourserver.com"

'Server port (typically 25)
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

' username & you know what
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "notifications@yourserver.com"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "notifications-password"


.Configuration.Fields.Update

'==End remote SMTP server configuration section==


.To = "smallbiz@yourserver.com"
.From = "notifications@yourserver.com"
.Subject = "Scripted Email Notification"
.TextBody = "This email was sent from a vbs file"

.Send

End With

MsgBox("Email Generated Successfully")

Wednesday, August 1, 2007

Windows Event Logs On Remote System As Different User

We ran into an issue recently where one client had multiple domains set up and access to separate servers required logging in as a different user on a different Active Directory domain. One of the servers was having issues with logging on due to slow performance so we wanted to view the remote logs as a different user, there are a few ways to do this but the easiest I found is run the following at the command prompt.

runas /netonly /user:DOMAIN\USERID "eventvwr.exe"

At this point you will be prompted for the password for that account then the Event Viewer will popup, you can then change it to the Remote Computer Name/IP and you should be good to go.