Archive

You are currently browsing the archives for the Sysadmin Stuff category.

Jun

15

Dirty Powershell script

By raheem

Its supposed to compare two folders and then tell me the difference. Its really sloppy and slow – gotta work more on it…

$server = “srvts2010″
$backupfolder = “E:\cpsstore\SRVTS2010″
$sourcefolder = “\\srvXXXX\d$\data”

# Getting folder size of CPS folder
$colItems = (Get-ChildItem $backupfolder -recurse | Measure-Object -property length -sum)
$backupfoldersize = “{0:N2}” -f ($colItems.sum / 1024MB) + ” GB”
#write-output $backupfoldersize

# Getting folder size of source folder
$colitems2 = (Get-ChildItem $sourcefolder -recurse | Measure-object -property length -sum)
$sourcefoldersize = “{0:N2}” -f ($colItems.sum / 1024MB) + ” GB”
#write-output $sourcefoldersize

write-output “The CPS backup is ” $sourcefoldersize-$backupfoldersize ” behind ” $server

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]