PowerShell command to view child attributes

This is usefull when you want to see all the properties that can be queried with a powershell command:

get-childitem | format-list -property *

By rbocchinfuso on February 1, 2010 | powershell | A comment?
Tags: ,

Wordpress mime types

I wanted to expand the type of files that wordpress would allow me to upload and attach to a post.  I used a plugin called pjw-mime-config here are a few things that I figured out beyond just using this plugin to add mime types.

I originally wanted to upload and attach a powershell script to a post when wordpress responded with the following error:  File type does not meet security guidelines. Try another.  I googled the error and found that I needed to add additional mime types to be accepted by wordpress, pjw-mime-config was suggested to easily add mime types, I installed the plugin and fat fingered the mime type, I tried to remove the mime type but it failed to delete it…  I uninstalled the plugin and reinstalled thinking that would remove the mime type, no luck.  My thought at this point was that the mime types must be stored in the wordpress database  by the pjw-mime-config plugin, I worked with a test wordpress installation and exported the DB (db1.sql) installed jpw-mime-config, added a mime type (foo, text/plain) and exported the DB again (db2.sql) I then did a diff on the two SQL exports.  Sure enough there jpw-mime-config row in the wordpress DB table wp_options, I uninstalled jpw-mime-config, deleted the row and reinstalled jpw-mine-config and all was good.

After installing jpw-mime-config the wordpress uploader accepted the file but gave an error from the upload dialog that referenced functions.php @ line 2258.  To resolve the error I edited ./wp-includes/functions.php and added the ps1 mime type to the get_allowed_mime_types function (starts at appox line 2275).

By rbocchinfuso on January 31, 2010 | Tips, Wordpress | A comment?
Tags: , ,

Data Profiling with Windows PowerShell

A customer asked me the other day about a method to do some data profiling against a file system.  So I thought I would share the request, my suggestion and little PowerShell script I crafted to do some data profiling.  The request read as follows:  “Do you know of any tools that will list all files in a directory, and all subs and provide attributes like filename, path, owner, create date, modify date, last access date and maybe some other attributes in report format?”

My recommendation was a commercial product called TreeSize Professional by JAM Software the product license cost is ~ $50 and worth every penny, scan speeds are good, supports UNC paths and reporting is intuitive.  Overall an excellent product.

As an alternative below is a quick PowerShell script (also attached to post as data_profile.ps1) that will create a CSV file with data profiling information, once the CSV file is create the CSV can be opened in Excel (or your spreadsheet tool of choice) or imported into a DB and manipulated.

# Script Starts Here #

$root = "c:\\files"
$report = ".\report.csv"

$AllFiles = @()
foreach ($file in get-childitem $root  -recurse| Select-Object FullName, Root, Directory, Parent, Name, Extension, PSIsContainer, IsReadOnly, Length, CreationTime, LastAccessTime, LastWriteTime, Attributes)
{
    $acl = get-acl $file.fullname | select-object path,owner,accesstostring,group
    $obj = new-object psObject
    #$obj | Add-Member -membertype noteproperty -name FilePathandName -Value $file.FullName
    $obj | Add-Member -membertype noteproperty -name Root -Value $file.Root
    $obj | Add-Member -membertype noteproperty -name Ditrectory -Value $file.Directory
    $obj | Add-Member -membertype noteproperty -name Parent -Value $file.Parent
    $obj | Add-Member -membertype noteproperty -name Name -Value $file.Name
    $obj | Add-Member -membertype noteproperty -name Extension -Value $file.Extension
    $obj | Add-Member -membertype noteproperty -name IsDIR -Value $file.PSIsContainer
    $obj | Add-Member -membertype noteproperty -name IsReadOnly -Value $file.IsReadOnly
    $obj | Add-Member -membertype noteproperty -name Size -Value $file.Length
    $obj | Add-Member -membertype noteproperty -name CreationTime -Value $file.CreationTime
    $obj | Add-Member -MemberType noteproperty -Name LastAccessTime -Value $file.LastAccessTime
    $obj | Add-Member -MemberType noteproperty -Name LastWriteTime -Value $file.LastWriteTime
    $obj | Add-Member -MemberType noteproperty -Name Attributes -Value $file.Attributes
    #$obj | Add-Member -MemberType noteproperty -Name Path -Value $acl.path
    $obj | Add-Member -MemberType noteproperty -Name Owner -Value $acl.owner
    $obj | Add-Member -MemberType noteproperty -Name AccessToString -Value $acl.accesstostring
    $obj | Add-Member -MemberType noteproperty -Name Group -Value $acl.group
    $AllFiles += $obj
}
$AllFiles |Export-Csv $report –NoTypeInformation

# Script Ends Here #

The above script scans all files recursively starting at c:\files and outputs the results to results.csv.  One thing to note is that the scan stores all data in an array in memory, the is because the PowerShell Export-Csv function does not support appending to a CSV file (you gotta wonder what Microsoft talks about in design meetings).  I will likely create a version of the script that uses the out-file function to write each row to the csv file as the scan happens rather then storing in memory until the scan is completes and then writing the entire array to the report.csv file, goal here is to reduce the memory footprint during large scans.

The output of this file script will be similar to the following:

Parent Name Extension IsDIR IsReadOnly Size CreationTime LastAccessTime LastWriteTime Attributes Owner Group
files Program Files   TRUE     1/27/2010 13:33 1/30/2010 21:23 1/27/2010 13:33 Directory BUILTIN\Administrators NT AUTHORITY\SYSTEM
Program Files Microsoft.NET .NET TRUE     1/27/2010 13:33 1/30/2010 21:23 1/27/2010 13:33 Directory BUILTIN\Administrators NT AUTHORITY\SYSTEM
Microsoft.NET Primary Interop Assemblies   TRUE     1/27/2010 13:33 1/30/2010 21:23 1/27/2010 13:33 Directory BUILTIN\Administrators NT AUTHORITY\SYSTEM
  adodb.dll .dll FALSE FALSE 110592 10/26/2006 14:40 1/27/2010 13:33 10/26/2006 14:40 Archive BUILTIN\Administrators NT AUTHORITY\SYSTEM
  Microsoft.mshtml.dll .dll FALSE FALSE 8007680 10/26/2006 14:40 1/27/2010 13:33 10/26/2006 14:40 Archive BUILTIN\Administrators NT AUTHORITY\SYSTEM
  Microsoft.stdformat.dll .dll FALSE FALSE 13312 10/26/2006 14:40 1/27/2010 13:33 10/26/2006 14:40 Archive BUILTIN\Administrators NT AUTHORITY\SYSTEM
  msdatasrc.dll .dll FALSE FALSE 4096 10/26/2006 14:40 1/27/2010 13:33 10/26/2006 14:40 Archive BUILTIN\Administrators NT AUTHORITY\SYSTEM
  stdole.dll .dll FALSE FALSE 16384 10/26/2006 14:40 1/27/2010 13:33 10/26/2006 14:40 Archive BUILTIN\Administrators NT AUTHORITY\SYSTEM


Attached Files:

By rbocchinfuso on January 30, 2010 | General Discussion | 2 comments

Blackberry Issues

So about a week ago my Blackberry (8900) booted to a screen stating “Error [some number I can’t remember]:  Reload OS”, obviously not good.  So I broke out JLcmder (a must have for all hard core Blackberry hackers), and proceeded to wipe and OS and reload my BB.  Yesterday afternoon I am sitting at my desk and I look down at my Blackberry and it is sitting there with a white screen, nothing but a white screen.  I try a soft reboot, and back to the white screen, I try a battery pull, back to the white screen.  Then in not my finest moment I some how rationalize that running over to the T-Mobile store will be the easiest/quickest fix, they waste a solid 30 mins of my life pulling the battery repeatedly and praying that it will boot, I will never get that 30 mins back.  As usual I returned to the office hooked the BB up to a laptop to see if I could connect from JLcmder, no luck.  I removed the battery, sim card and my MicroSD memory card, replaced the battery and rebooted, my BB returned.  I then stated scouring the forums, turns out that a few others had seen an issue with a corrupted SD card that caused the white screen of death.  Last night I formatted my SD card (fat32) and placed it back into my BB and the phone booted fine (happy about that).  When will I realize to never call my carrier for technical support (I have been with Verizon, AT&T and now T-Mobile and they are all the same. When you go to a BB specialist and the first thing they tell you do is pull your batter, you have to wonder how special he or she is.)  Hope this helps someone.

By rbocchinfuso on October 20, 2009 | General Discussion | 1 comment

What have I been up to… Project Hive…

Obviously my post frequency has dramatically decreased this is due to a couple of factors.  First I am busy so I have less time to turn my experiences into easy to digest blog posts and second myself and a few of my comrades have been developing something we call “Project Hive” .  As you can probably tell from many of my blog posts most of my work in recent years has been associated with EMC technologies.  Throughout the years we realized that while there are some good framework tools out there they are costly, require significant customization and often don’t solve the common day-to-day operational issues that system administrators face.  The goal of “Project Hive” is to dramatically simplify the common tasks associated with managing EMC technologies.  Being intimately familiar with these tasks we have developed a platform that is based on a distributed collection, aggregation and presentation, we call this the “Honeycomb”, each Honeycomb contains modules, we call these “Workers” which are responsible for the collection, aggregation and analysis of data from discrete infrastructure components, all workers are centrally managed on the Honeycomb and use standard based methods to collect data (i.e. – WMI, SSH, SNMP, APIs, etc…).  “Project Hive” is a very active project and we are continually adding functionality to existing workers and building new workers as time permits or requirements dictate.

Any EMC customer who has been through an upgrade is familiar with the EMCGrab process (the process of running the EMCGrab utility on each individual SAN attach host within the environment and providing the output to EMC so they can validate the host environment prior to the upgrade).

In a reasonably sized environment this process can be tedious and time consuming, one of our released workers centralizes and automates the EMCGrab process.  I recently created a video which contrasts the process of running an EMCGrab manually on an individual host vs. using the Hive Worker.  My hope is to publish more of these videos in the future but as you can imagine they take a bit of time to produce.  If you are looking for more information contact the Project Hive team at dev@projecthive.info

A hi-resolution video is available here .

By rbocchinfuso on August 12, 2009 | General Discussion | A comment?

Benchmarks
Cisco Live 2010
Demos
EMC
EMC World 2009
EMC World 2010
Gartner Data Center Summit 06
General Discussion
Get Adobe Flash playerPlugin by wpburn.com wordpress themes

This site is protected with Urban Giraffe's plugin 'HTML Purified' and Edward Z. Yang's Powered by HTML Purifier. 307 items have been purified.