Archive for the 'Other Sites of Mine' Category

Google is brutal with sitemap errors. Be Warned!

Google has de-listed my game servers startup from its indexes. I went from a steadily climbing position to being not listed instantly. Why you ask? What pisses off the Google gods? Not much, apparently.

You see, I use vim to write all my websites. I know its not the best way to do things but gosh darn-it for some reason I just always end up coming back to it. One of the shortcuts in vim is Shift-A. This starts editing at the end of a line.

I was happily updating my sitemap by hand when I ended up pressing Shift-A on extra time. Unknowingly, I committed that miss-placed capital “A” into my sitemap and published it. Google happily crawled my sitemap not too long later and found the typo. They could have looked the other direction and threw a warning on webmaster tools, but instead they entirely de-listed me. Sounds fair to me.

But, theres a ray of hope. Chrome has built-in XML error checking. If you simply open up your sitemap in Google Chrome before actually making it live, it will display any validation errors in big red letters at the top of the page.

I of course fixed problem as soon as I saw it i webmaster tools and resubmitted my sitemap. Google even shows my pages as indexed but just will not display them in searches. I’m assuming is a temporary thing and that they’ll re-list me, but I can only guess. They’ve crawled and accepted my new site map, but are apparently waiting over a week to re-list me!

I’m sorry Google! Stop the madness! Can’t we be friends?!

Find Your IP using PowerShell and WMI

I recently was writing a script which required me to find the IP of the local machine and use it later on. I stoped for a minute and realized that some computers will have one network card and some will have 20, including virtual adapters. So I knew there had to be a way to figure out which network cards were being assigned an address and see a list of them. I came up with the following:

(gwmi -query "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=TRUE").IPAddress

Then, to reference any single NIC, if there are more than one, you only need to specify the one you need out of the array with [0] or [1] etc etc.

Not PERFECTLY simple, but practical and functional!

PowershellCommunity.org Launched

A new and very well done PowerShell Community site has been launched. Don Jones and others are facilitating it and it looks like it’s going to take off well!

Check it out and get your username quick at PowershellCommunity.org

Check Drivespace for Each Drive on a List of Remote Computers

This script Checks a list of remote computers. You specify the servers inside of the $servers variable by placing each in quotes with a comma between entries as I have done below within the script. All you must do then is simply run the script. WMI will discover all drives on the remote machine and give you the total size, used space, free space and percent free. Entries below 15% will be shown in red and all others will be shown in yellow. You can add as many servers as you like, or easily mod the file to read from a text file.

You will probably want to save your credentials with this script as I posted about here for ease of use.

I use this particular script a lot.


#Retrieve Drive Space on Remote Computers

#SET TARGET SERVERS
$servers = "Server1", "Server2", "Server3"

$gb = 1024 * 1024 * 1024
foreach ($target in $servers){
write-host "Checking $target..."
$obj = (gwmi -query "select * from win32_logicaldisk where Size > 1" -computername $target -cred $pw)
foreach ($disk in $obj) {
$freespace = ($disk.freespace / $gb)
$totalspace = ($disk.Size / $gb)
$freepercent = (($freespace / $totalspace)*100)
if ($freepercent -lt "15") {
write-host "Drive" ($disk.deviceid) "has" ($disk.freespace / $gb).ToString("n") "GB Free of" ($disk.Size / $gb).ToString("n") "GB." $freepercent.ToString("n") "% Free." -foregroundcolor red
}
else {
write-host "Drive" ($disk.deviceid) "has" ($disk.freespace / $gb).ToString("n") "GB Free of" ($disk.Size / $gb).ToString("n") "GB." $freepercent.ToString("n") "% Free." -foregroundcolor green
}
}
}