Monthly Archive for August, 2007

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
}
}
}

FeedReader3 (Awesome Freeware RSS Reader)

Sometimes you just find a piece of free software that makes you want to send your thanks to the creators. For me, FeedReader is one of ‘em. FeedReader is a lightweight RSS reader with an organized interface and a hefty amount of options within. I’ve been using it for a couple days now and I must say, it’s just wonderful.

Download FeedReader from the FeedReader3 homepage by clicking here.

Here are some screenshots from the FeedReader3 website:

fr1.png
fr2.png
fr3.png

For your first feed on FeedReader, you can use mine! :-D
Subscribe to this RSS Feed

ESET Releases Anti-Spam and Firewall Protection

Okay, I was trolling around fileforum.com and i noticed the word ESET. I love my good friends over at ESET so I downloaded. Turns out this is an all-in-one (yeah i know what you’re thinking) package to protect your computer. The firewall is awesome and shows the bandwidth in and out for each process in a display much like NetLimiter and the anti-spyware is reviewing very well. Also, my Windows Mail within Vista has some awesome new spam or not-spam buttons.

Here are a few screenshot of ESET’s new all-in-one solution to protection:

eset1.png

eset2.png

Download the Beta of Eset Smart Security Here

Ping Checking with PowerShell [Updated 9/25/07]

I wanted a better way to watch pings while doing stuff on another monitor. I was tired of looking back and scrolling up. So, Check-Pings.ps1 was born. This script simply pings the first given variable in a loop and outputs the last successful ping time. However, if an error occurs, the time and date is printed out for logging purposes. This is a lot better than ping -t because it doesn’t spam your screen too much and you’ll know 100% if a ping drops. So, here it is.

Check-Pings Picture

This script uses spaces, which don’t agree with my blog too much. Click the PowerShell icon to download the .ps1 file that will include the spaces needed. Oh, what the hay, you can just click here too.
Download Check-Pings.ps1

Check-Pings.ps1

$target = $args

if ((($target).length) -lt "1") {
Write-Warning "No Target IP Specified."
Write-Warning "EXAMPLE: Check-Pings.ps1 www.google.com"
break
}

$didnt = 0
$worked = 0
$datetime = (get-date)

write-host "`nLoading..." -nonewline -foregroundcolor yellow
$ping = new-object System.Net.NetworkInformation.Ping
write-host "`rStarted ping to $target $datetime`n"

while (1) {

$go = $ping.send("$target")
$result = $go.status
$ms = $go.roundtriptime
$ip = ($ping.send("$target").address).ipaddresstostring

if ($result -match "Success") {
$time = (get-date)
$worked = ($worked + 1)
if ($didnt -gt "0") {
$failrate = ( ($didnt / $worked ) * 100).tostring(".0")
write-host `r"Ping Successful ($ip) - $target - $time - $failrate% Loss - $ms ms " -nonewline -foregroundcolor green
write-host " " -nonewline
}
else {
write-host `r"Ping Successful ($ip) - $target - $time - 0% Loss - $ms ms " -nonewline -foregroundcolor green
write-host " " -nonewline
}
}
Else {
$time = (get-date)
$didnt = ($didnt + 1)
if ($worked -gt "0") {
$failrate = ( ($didnt / $worked ) * 100).tostring(".0")
write-host `r"Ping Failed ($ip) - $target - $time - $failrate% Loss ($didnt lost) "`n -nonewline -foregroundcolor red
write-host " " -nonewline
}
else {
$didnt = ($didnt - 1)
write-host `r"$target ($ip) - $time - Host not sucessfully pinged yet. " -nonewline -foregroundcolor red
}
}
sleep -milliseconds 500
}

Example Useage:

Check-Pings.ps1 google.com

Edit: Yeah, my ISP is Comcast
Edit: Updated to work with the .net ping object thanks to Shay (http://scriptolog.blogspot.com)