Archive

Archive for August, 2009

How to Ping a Computer using PowerShell

August 24th, 2009 1 comment

Pinging a computer is really simple, and of course since this is PowerShell we don’t want to use something as primitive as ping.exe, we want to use .NET and take advantage of all the method calls and filters. Read more…

Using the System.Environment Class in PowerShell

August 24th, 2009 No comments

The Environment class has a huge array of information and accessing this information is very simple, I’m going to try and give a whole bunch of one line examples of how to do this using PowerShell. Read more…

Send eMail and SMS Text Messages with PowerShell

August 23rd, 2009 No comments

Thanks to the .NET library sending emails with PowerShell is surprisingly very simple! One thing to remember is line breaks, when you need a new line, make sure to use the escape characters `n . In the first example, I’ll send just a regular email, in the second I’ll send a SMS text message. Read more…

Check If File Exists with VB.NET

August 23rd, 2009 3 comments

I was creating an application in Visual Basic the other day and I couldn’t remember how to check to see if a file exists, so I thought I would do a quick example to see if a file exitsts. If the file exists, the program will continue on, however, if the file doesn’t exist you will get a message box saying that the file does not exist, and the application will exit. Read more…

Categories: VB.NET Tags: , ,

Append Text to a File Using Add-Content in PowerShell

August 23rd, 2009 No comments

Here’s a quick tutorial on how to add text to the end of a text file using the Add-Content or its alias ac in PowerShell. In this first example let’s add "This is the last line" to the end of a file. Read more…

Pass Credentials via PowerShell

August 23rd, 2009 No comments

I’ve often found it necessary to pass my Administrator domain or Domain Admin (DomAdmin) credentials to run a PowerShell WMI command. Fortunately PowerShell provides 3 different ways of doing just that, not counting using Windows built in runas command. The three methods I’m going to go over are

  1. Entering your own unique credentials
  2. Entering a service account password, ie: the same username (or hard coding a username)
  3. Hard coding a user name and password

Read more…

Preventing Google and Other Search Engines From Indexing Your Website Using Meta Tags

August 16th, 2009 2 comments

Not everything you post on the internet needs to be crawled, indexed, and cached by Google or any other search engines. For that very reason a robots.txt file was created, but sometimes we don’t need to get to granular in the robots.txt file, or we may not have access to edit it. For that very reason we can specific information to our META tags in our web pages. The robots field is a comma separated list, if you do not set it, it will automatically default to ALL, this means that the page can be indexed and that all links on the page can be crawled. Here is the api for the robots field… Read more…

Categories: SEO Tags: , ,

Humor: Solve Computer Overheating Problems with this Quick Fix

August 13th, 2009 No comments

Haha, I don’t know why I couldn’t stop laughing when I saw this photo, I guess it’s one way to solve an overheating problem… Read more…

Categories: Uncategorized Tags:

Mounting a Virtual/Network Drive with PowerShell

August 13th, 2009 1 comment

There’s multiple reasons why someone would want to mount a virtual or network drive, especially in an enterprise environment where many users don’t understand the concept of UNC paths or when older software doesn’t support long path names or UNC connections. Now there’s two things we need to know, is this a local path, or is it somewhere on the network. Once we know that we can get started. Read more…

Reversible AES Encryption in MySQL

August 13th, 2009 2 comments

Keeping sensitive information for any organization is a must in this day and age, and encrypting this data is one of your many lines of defense. Below are simple one liners on how to use AES encryption and decryption using MySQL as your database. When you call the AES_ENCRYPT function, MySQL will automatically return the encrypted value in a binary form, I’ll show you how to convert this into a hexadecimal value which you will need to do if you ever backup your database to SQL files. I was so happy to find that MySQL had this function built in, I can’t tell you how many types I ran through the PHP api looking for something that could meet my needs, I never even bothered to do a search for it on MySQL.

Note: Do not encrypt passwords!
Yeah, you read that correctly. Not everything needs to be decrypted. Imagine if you had a rouge system administrator, dba, or even worse, a hacker. Passwords need to be and should be hashed. Think about it for a minute, the only reason you would want to encrypt a password is if you want to be able to decrypt it at a later time. There’s no reason to do that, if a user forgets his or her password, it should be reset, and then they should be forced to change it on their next login. Read more…

Categories: Tutorials Tags: